Hey all, I'm the author. Feedback is welcome! :) The reason I wrote this is because I've been pair programming quite a bit lately and also mentoring some new vim users—so I wrote this little guide to help vim beginners level up their skills a bit. What I noticed is that a lot of vim beginners find composing commands and text-objects to be kind of mind blowing.. and even more experienced vim users mentioned that these…
instead of "52gg" I prefer ":52"
Intermediate Vim
51–60 of 130 posts
Re: Intermediate Vim
#52Earlier quoted context omitted.
I have capslock mapped to escape and never notice which one I use (started doing that after my escape key broke on a laptop about 15 years ago) I believe people with poor keyboards don't even have escape keys any more though
What do you mean by "poor keyboards"?
Re: Intermediate Vim
#53Maybe you can cover macros since they are conceptually very simple and very powerful. They may seem a bit complex but are quite simple. Basically you just record your editing movements and play it back. How macros work: press q x to record and q to end. Then repeat with @ x, where x is the name of the macro you want to use (you can have several macros). Anything you do will be played back. That's it... Conceptually s…
I've used vim for a couple of decades, but never pushed to many advanced features. For your example above I'd do :%s/^/"/ and :%s/$/",/ Unless I use a feature regularly I find it's a higher cognative load. I use bash, sed and perl regexps on a near daily basis. Macros are very rare.
Re: Intermediate Vim
#54Re: Intermediate Vim
#55Maybe you can cover macros since they are conceptually very simple and very powerful. They may seem a bit complex but are quite simple. Basically you just record your editing movements and play it back. How macros work: press q x to record and q to end. Then repeat with @ x, where x is the name of the macro you want to use (you can have several macros). Anything you do will be played back. That's it... Conceptually s…
edit I see someone else answered this - use @@ instead of .
Re: Intermediate Vim
#56The defaults in vim 8 in debian and ubuntu really changed the way vim worked, it was horrendous As far as I'm concerned, the following is an non-negotiable requirement for vimrc. source /usr/share/vim/vim80/defaults.vim set noincsearch set scrolloff=0 set mouse=
" Workaround stupid defaults.vim behaviour
if filereadable("/usr/share/vim/vim80/defaults.vim")
source /usr/share/vim/vim80/defaults.vim
endif
let g:skip_defaults_vim = 1
" Disable stupid seeking to last position
autocmd! vimStartup BufRead
" Disable stupid mouse support
set mouse=Re: Intermediate Vim
#57Maybe you can cover macros since they are conceptually very simple and very powerful. They may seem a bit complex but are quite simple. Basically you just record your editing movements and play it back. How macros work: press q x to record and q to end. Then repeat with @ x, where x is the name of the macro you want to use (you can have several macros). Anything you do will be played back. That's it... Conceptually s…
I use the . (dot) command a lot out of habit. It executes the last command. If the last command was a macro execution, dot doesn't execute the macro - it executes the last command of the macro. Is there a way to fix this? edit I see someone else answered this - use @@ instead of .
Re: Intermediate Vim
#58Earlier quoted context omitted.
I have capslock mapped to escape and never notice which one I use (started doing that after my escape key broke on a laptop about 15 years ago) I believe people with poor keyboards don't even have escape keys any more though
What do you mean by "poor keyboards"?
Re: Intermediate Vim
#59Earlier quoted context omitted.
What do you mean by "poor keyboards"?
My collegues are constantly complaining their (mac) laptop keyboards are terrible, however aren't ballsy enough to say "F-U" to the corporate choice of a mac or a windows laptop.
Re: Intermediate Vim
#60Maybe you can cover macros since they are conceptually very simple and very powerful. They may seem a bit complex but are quite simple. Basically you just record your editing movements and play it back. How macros work: press q x to record and q to end. Then repeat with @ x, where x is the name of the macro you want to use (you can have several macros). Anything you do will be played back. That's it... Conceptually s…
I've used vim for a couple of decades, but never pushed to many advanced features. For your example above I'd do :%s/^/"/ and :%s/$/",/ Unless I use a feature regularly I find it's a higher cognative load. I use bash, sed and perl regexps on a near daily basis. Macros are very rare.
:%s/.*/"&",/
The & special character gets replaced with the whole matched pattern.