23 August 2011

script to use terminal vim as default gnome editor http://goo.gl/OxAtC

Set terminal vim as the default editor instead of using one of the gui vims.

1. Create script:
vim vim-gnome
2. Script contents:
#!/bin/sh
ARGS="$@"
gnome-terminal -t "" -e "vim $ARGS"
3. Write buffer to file and close:
:wq
4. Make script executable:
chmod +x vim-gnome
5. Copy script to scripts directory (if you use one) eg.:
cp vim-gnome /home/lxtips/Dropbox/bin/
6. Set it as the default editor (in Ubuntu) right click the file in nautilus (ie. .bashrc) and select Properties > Open With.


7. Click Add > 'Use a custom command' and add the path to the script for example:
/home/lxtips/Dropbox/bin/vim-gnome
Repeat steps 6 and 7 for any other file types that still revert to the previous default editor.

8. Use an alternate gnome-terminal custom color scheme like the one below to match your favorite vim color scheme. If anyone knows how I might get gnome-terminal to replicate bolded text This is my attempt at Desert:



Script contents from vim.wikia.com 

No comments:

Post a Comment

Pages