Vim: Difference between revisions
(Accessing GNU Octave info within VIM) |
(VIM as the default editor) |
||
Line 13: | Line 13: | ||
Now, when editing a {{Path|*.m}} file, you can type {{Key|K}} in normal mode and the word under the cursor will be searched for in the GNU Octave documentation index. Pressing {{Key|,}} yields the next occurrence. | Now, when editing a {{Path|*.m}} file, you can type {{Key|K}} in normal mode and the word under the cursor will be searched for in the GNU Octave documentation index. Pressing {{Key|,}} yields the next occurrence. | ||
== VIM as the default editor == | |||
To set VIM as the default editor launched by the GNU Octave {{Codeline|edit}} command, add the following line to your {{Path|~/.octaverc}} file: | |||
edit mode async | |||
and one of the following: | |||
edit editor "<terminal> -e 'vim %s'" | |||
edit editor "gvim %s" | |||
where {{Codeline|<terminal>}} can be [http://directory.fsf.org/wiki/Gnome-terminal gnome-terminal], [http://directory.fsf.org/wiki/Xterm xterm], or any other terminal of your preference. Please note the {{Codeline|-e}} option is common to the mentioned terminals, change it if necessary. |
Revision as of 00:17, 11 April 2012
VIM the editor is one of the most famous text editors in the hacker programming universe. It has a plenty of extensible (script-based) capabilities and very comfortable shortcuts that makes the programmer the fastest gun of the old west. (I can imagine VIM in front of Emacs on a desert city, VIM's shot is much faster!). In this page you'll learn some tips to better adapt VIM for GNU Octave programming.
If you aren't familiar with VIM script language, you can also use Python to write VIM plugins. If you do some for GNU Octave, please let us now.
Accessing GNU Octave info
GNU Octave info package can be found in almost all Linux distributions. For installing it under Ubuntu, you can type:
$ sudo apt-get install octave<version>-info
where <version>
must be substituted by the appropriate string. Add the following line to your ~/.vimrc file:
autocmd FileType matlab setlocal keywordprg=info\ octave\ --vi-keys\ --index-search
Now, when editing a *.m file, you can type K in normal mode and the word under the cursor will be searched for in the GNU Octave documentation index. Pressing , yields the next occurrence.
VIM as the default editor
To set VIM as the default editor launched by the GNU Octave edit
command, add the following line to your ~/.octaverc file:
edit mode async
and one of the following:
edit editor "<terminal> -e 'vim %s'"
edit editor "gvim %s"
where <terminal>
can be gnome-terminal, xterm, or any other terminal of your preference. Please note the -e
option is common to the mentioned terminals, change it if necessary.