Does anybody have recommendations on how to go from "comfortable" to "expert"?
I've been using vim as my daily driver via the intellij plugin for a few years. I mostly just navigate and never do anything complicated, it gets the job done. For example I mostly use w, d, o, hjkl, y, p, w, b, t and recently discovered the `c+i` combo which is awesome. But I feel like there's still a side of vim I haven't conquered. Any tips?
I've been using Vim for many years and felt like there was constantly stuff to learn. So a partner and I started an email newsletter that sends tips twice a week:
https://vimtricks.com The idea was that by forcing myself to write about Vim consistently, I would learn and absorb more and boy has it worked.
As an aside, I love the vim keybinds with IntelliJ combo, vim makes it so easy to navigate and perform operations, eg. the one I use most being dt to delete until a char.
Never can seem to get vim selections and deletions right though, because it deletes the character after the cursor as well so the mouse comes clutch there.
yes! my path to "expert" was more in the lines of questioning my commonly used editing functions:
1. how to delete text inside a double quote and go to insert mode? - c+i+" 2. how to move to the end of line? - $ 3. how to delete everything before "x" character and go insert mode" - c+t+x ... EDIT: updated mistakes.
> 1. how to edit words inside a double quote? - "ciw"
ciw will change inner word,
ci" will change inside quotes > 2. how to move to the end of line? - "g_" $ is generally used as the noun object to represent "end of the current line" > 3. how to delete everything before "x" character" - "ctx" dtx would delete everything before the next x. ctx would delete and then put you in insert mode :)
I would recommend using vim in the console without the mouse because your editor will always give you a way out of learning. Every time you get stuck or feel inefficient, do a web search and learn one thing. Learn to use and love :help. I think a few plugins can really improve the experience such as coc, ultisnips, vim-surround. Also set some settings like relative number and highlighted yank. Some other stuff to investigate... zz and scrolling, folding, G, macros, registers, f, $ and ^ and 0, %, }, ctrl-o, ctrl-] and ctags, formatting gq = etc Edit: also remembered enable set hidden and use buffers and splits (eg :sbp). Use markers. Also I like the fzf plugin for quickly opening files etc.
I use vim as my main driver at work. Some things that helped me out personally:
- Playing some vimgolf and seeing what neat tricks people used. This is where I learned about “.” - Going into the deep-end of just using vim (or just vim in IntelliJ without the mouse) will make you notice all the issues that make you unproductive with only vim e.g getting around with only hjkl is really slow so you might investigate other ways to navigate or deleting a word always involves getting to the end of the word and using lots of backspace may make you wonder if there are more efficient ways to do the same thing - if you decide not to go into the deep-end, just being more picky about how much you’re spamming certain keys may help you gradually incorporate new commands into your flow
> For example I mostly use w, d, o, hjkl, y, p, w, b, t and recently discovered the `c+i` combo which is awesome.
In addition to these, I've found (my personal experience, ymmv): 1) f/F to jump to next/previous occurrence of character to help navigating within a line very effectively, in conjunction with ; and , to jump around within these occurences.
2) use relative line numbers in conjunction with your hjkl. E.g. jump up 5 lines and go to the start of a bracket is '5kf('. If it's a nested bracket you want, then '5kf(;'.
Read the user manual. I'm not trying to be snarky - the user manual is explicitly something that isn't the same as the reference and the user manual is called out as the next step after `vimtutor`.
Comments (280) 72 threads
Show all comments
Showing thread 23 of 72
I've been using vim as my daily driver via the intellij plugin for a few years. I mostly just navigate and never do anything complicated, it gets the job done.
For example I mostly use w, d, o, hjkl, y, p, w, b, t and recently discovered the `c+i` combo which is awesome.
But I feel like there's still a side of vim I haven't conquered.
Any tips?
https://vimtricks.com
The idea was that by forcing myself to write about Vim consistently, I would learn and absorb more and boy has it worked.
[1] https://vimtricks.com/p/undo-from-insert-mode/
Continue this thread — 1 reply
Never can seem to get vim selections and deletions right though, because it deletes the character after the cursor as well so the mouse comes clutch there.
1. how to delete text inside a double quote and go to insert mode? - c+i+"
2. how to move to the end of line? - $
3. how to delete everything before "x" character and go insert mode" - c+t+x
...
EDIT: updated mistakes.
ciw will change inner word, ci" will change inside quotes
> 2. how to move to the end of line? - "g_"
$ is generally used as the noun object to represent "end of the current line"
> 3. how to delete everything before "x" character" - "ctx"
dtx would delete everything before the next x. ctx would delete and then put you in insert mode :)
I would recommend using vim in the console without the mouse because your editor will always give you a way out of learning.
Every time you get stuck or feel inefficient, do a web search and learn one thing.
Learn to use and love :help.
I think a few plugins can really improve the experience such as coc, ultisnips, vim-surround. Also set some settings like relative number and highlighted yank.
Some other stuff to investigate... zz and scrolling, folding, G, macros, registers, f, $ and ^ and 0, %, }, ctrl-o, ctrl-] and ctags, formatting gq = etc
Edit: also remembered enable set hidden and use buffers and splits (eg :sbp). Use markers. Also I like the fzf plugin for quickly opening files etc.
- Playing some vimgolf and seeing what neat tricks people used. This is where I learned about “.”
- Going into the deep-end of just using vim (or just vim in IntelliJ without the mouse) will make you notice all the issues that make you unproductive with only vim e.g getting around with only hjkl is really slow so you might investigate other ways to navigate or deleting a word always involves getting to the end of the word and using lots of backspace may make you wonder if there are more efficient ways to do the same thing
- if you decide not to go into the deep-end, just being more picky about how much you’re spamming certain keys may help you gradually incorporate new commands into your flow
In addition to these, I've found (my personal experience, ymmv):
1) f/F to jump to next/previous occurrence of character to help navigating within a line very effectively, in conjunction with ; and , to jump around within these occurences. 2) use relative line numbers in conjunction with your hjkl.
E.g. jump up 5 lines and go to the start of a bracket is '5kf('. If it's a nested bracket you want, then '5kf(;'.
Start with `:h user-manual` and go from there!