Editing Vim

Jump to navigation Jump to search
Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.

Latest revision Your text
Line 28: Line 28:


== Accessing GNU Octave info ==
== Accessing GNU Octave info ==
GNU Octave info package can be found in almost all Linux distributions. To install the package under Ubuntu, you can type:
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
  $ sudo apt-get install octave<version>-info


where {{Codeline|<version>}} must be substituted by the appropriate string.
where {{Codeline|<version>}} must be substituted by the appropriate string. Add the following line to your {{Path|~/.vimrc}} file:
 
Add the following line to your {{Path|~/.vimrc}} file:


  autocmd FileType matlab setlocal keywordprg=info\ octave\ --vi-keys\ --index-search
  autocmd FileType matlab setlocal keywordprg=info\ octave\ --vi-keys\ --index-search
Line 40: Line 38:
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.


Unfortunately info does not work in dumb terminals. As gVim has only a dumb terminal, a workaround must be done to access info. Two methods are possible. First, one can to use a plugin, like [https://github.com/carlobaldassi/ConqueTerm ConqueTerm], which can turn a gVim buffer into a terminal emulator.
Unfortunately info does not work in dumb terminals. As gVim has only dumb terminal, a workaround must be done to access info. Two methods are possible. First one is to use some plugin, like [https://github.com/carlobaldassi/ConqueTerm ConqueTerm], which turn gVim buffer into terminal emulator.
Second, one can use an external terminal emulator, preferably a fast loading one such as xterm, and install it. To installing xterm under Ubuntu, you can type:
Second method is to select an external terminal emulator, preferably fast loading one, such as xterm, and install it. For installing it under Ubuntu, you can type:


  $ sudo apt-get install xterm
  $ sudo apt-get install xterm
Line 49: Line 47:
  autocmd FileType octave setlocal keywordprg=xterm\ -e\ info\ octave\ --vi-keys\ --index-search
  autocmd FileType octave setlocal keywordprg=xterm\ -e\ info\ octave\ --vi-keys\ --index-search


Now you can type {{Key|K}} in normal mode and a new terminal window will opened and the word under the cursor will be searched for in the GNU Octave documentation index. You can set a larger font and a specific window geometry for xterm with the following line:
Now you can type {{Key|K}} in normal mode and a new terminal window will opened and the word under the cursor will be searched for in the GNU Octave documentation index. You can set bigger font and specific window geometry of xterm by following line:


  autocmd FileType octave setlocal keywordprg=xterm\ -fa\ 'DejaVu\ Sans\ Mono:style=Book'\ -fs\ 12\ -geometry\ 80x50\ -e\ info\ octave\ --vi-keys\ --index-search
  autocmd FileType octave setlocal keywordprg=xterm\ -fa\ 'DejaVu\ Sans\ Mono:style=Book'\ -fs\ 12\ -geometry\ 80x50\ -e\ info\ octave\ --vi-keys\ --index-search


'''NOTE:''' If using Rik's [http://www.vim.org/scripts/script.php?script_id=3600 syntax.vim] syntax, replace {{Codeline|matlab}} by {{Codeline|octave}}.
'''NOTE:''' If using Rik's [http://www.vim.org/scripts/script.php?script_id=3600 octave.vim] syntax, replace {{Codeline|matlab}} by {{Codeline|octave}}.


== Jumping between control statements ==
== Jumping between control statements ==
Please note that all contributions to Octave may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see Octave:Copyrights for details). Do not submit copyrighted work without permission!

To edit this page, please answer the question that appears below (more info):

Cancel Editing help (opens in new window)

Templates used on this page: