Hints for vim
.vimrc file can save lots of time and make editing easier. Put the following commands in
set nohlsearch set autoindent set tabstop=4 set shiftwidth=4 set ruler set showcmd syntax on set bg=dark set spell " enables live spell checking nnoremap <up> gk nnoremap <down> gj inoremap <up> <C-o>gk inoremap <down> <C-o>gj
If you dislike vim jumping over all lines when you have a line
that wraps, use
gj to move up and down. If you want to map
these to the up and down arrows, add the following two lines to your
nnoremap <up> gk nnoremap <down> gj
Fortunately, doing this does not make it so that
gj are inserted when in insert mode. Up and down return to their normal mode.
To have up and down have the same behavior in insert mode add the following to your
inoremap <up> <C-o>gk inoremap <down> <C-o>gj
To begin, download the latest stable version of MacVim. Move the
.app to your Applications folder.
Make sure you have a
~/.bin folder and it is included in you PATH variable in your
.bin folder create the following script named gvim and make sure you
chmod +x the file.
#!/bin/bash if [ $# -eq 0 ]; then # just open GVim open /Applications/MacVim.app else # create the file if it does not exist if [ ! -f "$1" ]; then touch $1 fi # open the file with GVim open $1 -a /Applications/MacVim.app fi
Next create your
~/.gvimrc file. Example file:
set backspace=indent,eol,start " allows all proper backspacing set vb " visual beep set lines=56 set columns=92 set anti " antialiasing on set gfn=Monaco:h12 " set the font and size colorscheme torte " set the colorscheme to torte, if torte is not found, use billw set guioptions-=T " removes toolbar
vim uses regular expressions for search and replace.
/foo to find
foo in the text.
s/foo/bar replaces all
foo on a line with
To replace all
bar in the whole file use
When searching for text it can be helpful to highlight all occurrences. To enable this use the command
:set hlsearch. To disable it use
To search for
foo and replace it with
within a visual selection use
To enable live spell checking in vim, use