I'd like to add the short hostname to the statusline in vim. I've looked around but short of installing the Powerline plugin, it doesn't seem posible. Below is my .vimrc
. How can I add thehostname
variable to it?
let hostname=system('hostname -s')
set laststatus=2
set statusline+=%F\ %P\ %c:%l
UPDATE: to remove the '^@' which appears after the hostname on the vim status line (I suspect is a newline charcter from the hostname call) I use this instead:
let hostname=system('echo -n $LOGNAME@$(/bin/hostname -s)')
Best Answer
statusline
can be modified to include variable names.For example, I'm using the
statline
plugin, so mystatusline
is:All of which is concatenated by the plugin itself.
In your case, you can use: