Difference between revisions of "Vim"
Revision as of 12:02, 11 November 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.
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"
A better GNU Octave syntax file
As for now, Vim hasn't a dedicated, officially distributed filetype for GNU Octave. The community agreed the best solution is to use octave.vim by Rik. All the instructions for installing it can be found on the hyperlink.
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
<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 in normal mode and the word under the cursor will be searched for in the GNU Octave documentation index. Pressing yields the next occurrence.
OBS: If using the Rik's octave.vim syntax, replace