Lurker News

Comments (280) 72 threads

Show all comments

Showing thread 23 of 72

fokinsean11 replies#
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?

fokinsean#
This looks great! Thank you!
colinbartlett2 replies#
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.

fokinsean#
Looks great, subscribed!
yjftsjthsd-h2 replies#
Um. I think that's wrong, though. Pressing c-u just erases to the beginning of the line in insert mode, it's not an undo.
colinbartlett#
Updated the post, thanks!
clashmeifyoucan1 reply#
Ah, I guess should've tried before saying. Just excited there's a way.
yjftsjthsd-h#
Oh, I was excited too:) So excited that I immediately tried it...
clashmeifyoucan#
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.

westoque1 reply#
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.

nsomaru1 reply#
> 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 :)

westoque#
thanks for correcting my mistakes :)
jchook#
Maybe try vim golf for fun.

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.

brianvli#
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

phonebucket1 reply#
> 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(;'.

fokinsean#
nice, thanks for the tips
RMPR#
Practical Vim by Drew Neil is definitely a way to go. It teached me stuff I wouldn't have discovered otherwise.
ttt0#
RTFM. Seriously.
ludston#
I found that learning q has made coding without vim very annoying.
windowojji#
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`.

Start with `:h user-manual` and go from there!