|Vim Tips: scp URLs, "set tabpagemax" and fixing C indentation
||[Feb. 18th, 2012|06:24 pm]
Shlomif's Technical Posts Community
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
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.
2012-02-19 08:28 pm (UTC)
As I understand it, two slashes just mean that you start from the root directory of the host, while one slash starts from the $HOME of the specified user.
2012-04-06 11:16 am (UTC)
Re: vim tips
sorry for the late response.
That's an interesting perspective. However, using KDE’s KParts (with Konqueror, kate, etc.), a ":" starts from the home directory while a "/" is an absolute path. I don’t know which scheme is more standard.
-- Shlomi Fish