In this video I go through the basics on how to move around a file using Vim. There are many different commands and shortcuts available - here I share the ones that I use most frequently. #vimeditor #vim #programming
Once you're comfortable with the tips in this video, check out Vim-Fu #2 - How to edit efficiently in Vim: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-SO9Sre5v6NA.html
You can use _ to move to the first non blank character of line, it's easier than 0w. Similarly g_ to move to last non blank character, this is not used much but it can be handy while creating macro for removing trailing space. Using Ctrl+f or ctrl+u can be disorienting when used for first time but it's very useful. Great video btw.
@@TheArtofSoftware Well, ive looked at several videos, and most start with: hjkl, then bweE, going to g and gg, and then switch to edit skills etc. your approach to grouping the vertical commands, then the horizontal commands, instead of grouping movement by "skill level" makes it a LOT more beginner friendly. Personally, I found it frustrating that you have to "advance" through vim levels before you learn things like the f and search option, paragraph hopping with {} and moving the document
Great tutorial. I wish I had found it earlier this year when I was struggling to learn vim, because of the lack of "absolute beginner friendly" materials; I had to skim through articles, posts, and sometimes documentation. But here we are, I still watch materials I already know, just to have an idea how other people utilize what I am using, if they are more efficient (or cooler) then I'll adapt things their way. One suggestion though, marks should be included in vim navigation category. When used right, can be THE fastest way to navigate back and forth between things. In my head, marks feel like cursor teleporting. Although marks are harder to incorporate into your daily workflow, they're good to know.
Great explanation 👌 Another shortcut I like for vertical movement is: zz It moves the cursor to the middle of the screen by scrolling the entire doc (leaving the cursor on the same line #)
from my experience the biggest slow down for me is moving from insert to normal mode.. I always remap my escape key to "hh" coz i use dvorak which is also "jj" for qwerty.
w => start of the word e => end of the next word b => backwards to the start of the word 3w => number before command to execute multiple times yy => copy a whole line y => copy selection p => paste Shift + p => paste on top of current line u => undo dd => delete and cut a line cc => delete and cut a line, puts you to insert mode after the command i => engage insert mode and go left a => engage insert mode and go right 0(zero) => move to start of the line Shift + ^ => move to first character on the line Alt + 4 (aka $) => move to end of the line Shift + 5 (aka %) => move to corresponding bracket, toggle brackets f + h (character) => go to first occurrance of a character on a line Shift + F => go to first occurance of a character on a line backwards /searchterm => to type across the file, press Enter to go to the first result ?searchterm => search backwards, press Enter to go to the first result n => go to next search result Shift + n => go backwards in search results v => engage visual mode, selects text Shift + v => visual mode with lines selection < > => in visual mode change the intention . => to repeat latest command Shift + ` => visual mode changes the case of the word v + i + w => visual mode select a word Ctrl + v => visual multi-line select Ctrl + u => move half a page up Ctrl + d => move half a page down Shift + 8 or 9 => move to ( or ) Alt + 7 or 0 => move to { or } Shift + h => move to highest point of viewport Shift + m => move to middle point of viewport Shift + l => move to highest point of viewport :200 => go to line 200 d + t + (character) => delete everything until this character
7 месяцев назад
Thank you very much! This goes straight into my cheatsheet file. :D
How can i move my cursor to the last recent position? Ex: I am now at line number 30. I enter 67G. How can I move to line 30 ? And I don't know that at which line i was before.
using { and } messes with your jump list, and then when you wanna jump back and forth between your jump list (for example going back from LSP's "go to definition") it becomes a pain in the ass I don't recommend it
Very nice job. That said, you seem too bright to be mispronouncing "regex". As it is shorthand for "regular expression", you should obviously pronounce is accordingly as you (hopefully) would not ever speak of a "rejular expression". To be honest, I see this as just one of many examples in our very competitive field where people essentially mimic (copy/paste) popular terms and lingo in an effort to seemingly fit in. With that out of the way, I'll just add that using command mode to jump to a given line is better than prefixing G with a number. The reason using command mode is better is due to the fact other operations like move, copy, etc can be used. For example, one can easily move a text object 10 lines up with :-10m