PaleoEarthLabs wiki

One bucket of limited wisdom

User Tools

Site Tools


software:gvim

GVim tips and tricks

This largely relates to getting GVim set up on the beautiful Windows operating system.

Navigation

Between files

Open demo files, enter:

$ vi /tmp/foo /tmp/bar

OR

  $ vi /tmp/{foo,bar}

To list open files:

  :ls

Sample outputs:

 1 %a   "/tmp/foo"                     line 1
 2      "/tmp/bar"                     line 0

To switch to next file:

:n

OR

:bn

To switch to previous file:

:p

OR

:bp

To open specific file buffer called 10 (use :ls command to list all open file buffers):

:b10

You can also switch between all open files, using the following syntax:

:b foo

OR

:b bar

Modern text editor such as vim supports enhanced tab completion to get list of open file:

:b [HIT-TAB-KEY]

To save currently open file:

:w

Visual editor

To split the current window vertically:

CTRL+W v

To split the current window horizontally:

CTRL-W s

To switch between vertically open windows i.e. navigate through open windows:

CTRL-W h

and/or

CTRL-W l

To switch between horizontally open windows i.e. navigate through open windows:

CTRL-W k

and/or

CTRL-W j

Once switched you can load file using any one of syntax as discussed above:

:n
:b10
:p

Templates and scripts

From Stackoverflow

In $MYVIMRC, add the line:

set guifont=DejaVu\ Sans\ Mono:h11

…where :h11, specifies a height of 11 points.

Internal file linking like in the GVim help

From http://vim.wikia.com/wiki/Keep_a_to-do_memo_file_with_links_as_in_Vim_help

*memo.txt* My Memo - extending my poor memory |guide|
----------------------------------------------------------------
*subjects* *toc*
|cmd| command tips |def| definitions
|dev| developments |ed| editors |friends| friends
|lang| languages |misc| others
|private| personal info |sys| system
----------------------------------------------------------------
Commands *cmd*
*General
http://www.cslab.vt.edu/manuals
...
|doskey| DOS key utility
<F8>: expand history
|man| Unix manual
man foo
nroff -man foo.1 | less
nroff -man foo.1 | a2ps -m
|unix|
http://gd.tuwien.ac.at/linuxcommand.org/
|winhelp|
...
----------------------------------------------------------------
Development *develop* *dev*
...
----------------------------------------------------------------
vim:tw=78:fo=tcq2:isk=!-~,^*,^\|,^\":ts=8:ft=help:norl:

Vim needs to have the following tag file to go to where you want it to go:

%userprofile% memo.txt /*%userprofile%*
.htaccess meo.txt /*.htaccess*
access memo.txt /*access*
access.conf memo.txt /*access.conf*
addressbook memo.txt /*addressbook*
anchor_keyword memo.txt /*anchor_keyword*
apache memo.txt /*apache*
as index.txt /*as*
at index.txt /*at*
awk index.txt /*awk*

Tags in Vim

Turning Vim into an IDE, using Tags as index: http://peterodding.com/code/vim/easytags/

software/gvim.txt · Last modified: 2017/02/23 08:24 (external edit)