User Tools

Site Tools


geek:vim

Vim Hacks

Search&Replace n lines

Search and replace over next n lines

If I copy and paste code in a windows/putty environment it often replaces tabs with space characters and I'd prefer to change these back. For example, to replace spaces with a tab in the next 20 lines:

:.,+20s/\s\+/\t/

Stop line wrap word break

Stop vim wrapping sentences in the middle of a word

:set linebreak

Highlighting

I like to tweak the syntax highlighting and comment colours in vim. Create or add to ~/.vimrc.

syntax on
hi Comment ctermfg=darkgray

Window Title

I also find it useful, when I'm working in lots of xterms, for vim to change the window title to the filename I'm editing. Add these lines to ~/.vimrc:

set titlestring=%f
set title
geek/vim.txt · Last modified: 2019/09/27 14:10 by neil