19 Feb 2012 shlomif   » (Master)

Vim Tips: scp URLs, "set tabpagemax" and fixing C indentation

Here are some Vim tips I ran into recently. First of all, when opening scp:// URLs, one should use two slashes after the hostname instead of 1, like scp://hostname//home/myuser/foo.txt instead of scp://hostname/home/myuser/foo.txt. I don’t know why that is the case, but it does not work properly without it. It also seems that netrw is buggy as it displays an irritating grey line on the cursor, the syntax highlighting tends to be off and saving a file displays several lines at the bottom.

Another tip is that gvim limits the number of tabs it opens when doing gvim -p [file1] [file2] [file3]. As a result, it is possible that not all files will be opened. If you want to change it you can set set tabpagemax in your .vimrc.

Finally, I noticed that Vim c-indentation tends to indent parameters to functions on subsequent lines using 8 spaces instead of 4 by default. I was able to change it to 4, which is my preference by adding set cinoptions+='(0,W4' to my .vimrc. There is plenty of other nifty stuff available in the cinoptions parameter.

Enjoy!

Syndicated 2012-02-18 16:24:14 from shlomif

Latest blog entries     Older blog entries

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!