A piggy bank of commands, fixes, succinct reviews, some mini articles and technical opinions from a (mostly) Perl developer.

Jump to

Quick reference

Showing posts with label vim. Show all posts
Showing posts with label vim. Show all posts

Syntax highlight in vim by file extension

How to add file extension syntax highlighting to vi.
Whack this in your ~/.vimrc

au BufNewFile,BufRead *.tt set filetype=perl

(source)

vim tabs and buffers basics


in vim type  ":grep -Ri search_string *"
...it executes... press enter to get back to vim
then type ":copen" to open a window with the search results in
and you can browse the matches really easily

:help grep

then if you press enter to open one of the files found,
to get back to your original file type :buffers or :ls

:tabe #[number against file] will open the original file in a new tab
:sp #[number against file] will open the original file in a new window

:buffer [number against original file] will open the original file again
and you could make the F keys load the buffers

I prefer tabs over buffers because they're more visible
in bash vim -p file1 file2 will open 2 files in two different tabs
gt and gT will cycle through the files (I have that mapped to alt+left and alt+right)
:tabe will open a file in a new tab


Thanks Phill