Reputation: 11110
In vim on the console, I can move the cursor on the name of a file which lies in the same directory as the currently open file, and issue the command !xdg-open %:p:h/<cfile>
. This will open the file in an external viewer, as defined by the OS. This is great, but on my system, it doesn't seem to work when using gvim.
This is the command I put into my ~/.vimrc
file:
nnoremap <leader>o :silent !xdg-open %:p:h/<cfile><CR>
What do I have to do so that this works both in vim on the console and in gvim?
I'm running Ubuntu Linux 12.04LTS.
Upvotes: 3
Views: 435
Reputation: 499
Put an &
at the end of the command. I learned this from how LaTeX-Box does it.
Upvotes: 3
Reputation: 11110
Following this post here: https://superuser.com/a/407675/104415, putting a &
at the end of the command makes it work in both gvim and vim:
nnoremap <leader>o :silent !xdg-open %:p:h/<cfile>&<CR>
Upvotes: 1
Reputation: 1558
Maybe you could try
:set debug=msg
and then see whether there are any errors?
Upvotes: 0