My .vimrc file

This page is managed by StJohn Piano.

My .vimrc file

If you have any questions, comments, corrections, or suggestions - please contact StJohn Piano on Tela:

To disable auto-comment when pasting this into vim, run this command first:
:set formatoptions-=cro


" A line starting with a double quotation mark (") is a comment.

" When in vim, to reload the .vimrc file, without restarting or leaving vim, run this command:
" :source ~/.vimrc

" If you are using putty to connect to a screen session on another machine, the function key effects in this file won't work unless the TERM environment variable on the remote machine is set to 'putty'. 
" To set this while in Bash: Run the commmand { $ TERM=putty }
" To set this while in screen: Run the command { :set term=putty }



" Keep the existing indentation level when pressing enter to move to the next line. 
set autoindent

" Defines number of spaces per tab. Existing tabs will be shown as this number of spaces.
set tabstop=2

" Insert spaces when tab is pressed.
set expandtab

" When using '>' or '<' to indent, use 2 spaces width.
set shiftwidth=2

" Backspace will delete to the appropriate level of indentation.
set softtabstop=2

" Show line numbers.
set number

" Pressing the space bar will now allow the insertion of a single character while in command mode.
:nnoremap <Space> i_<Esc>r

" Auto-remove trailing spaces when saving.
" autocmd BufWritePre * %s/\s\+$//e

" Make F2 key into a set paste / nopaste toggle, with visual feedback shown in the status line.
nnoremap <F2> :set invpaste paste?<CR>
set pastetoggle=<F2>
set showmode
" Setting the 'paste' toggle turns off vim's automatic addition of indentation, which is good if you are pasting in multi-line text that already contains its own indentation (i.e. various tabs and spaces).

" Make F3 key into a set number / nonumber toggle, with visual feedback shown in the status line.
" nnoremap line is for command mode, inoremap line is for insert mode.
nnoremap <F3> :set invnumber<CR>
inoremap <F3> <C-O>:set invnumber<CR>