This post is in the category: Configurations

Posts here will mostly contain full configuration files for my own reference and will not likely not have much explanation. See posts in the Guides category for more explanational posts.

Vim is the text editor that I have been working on learning recently. I will eventually have a dotfiles repository on GitHub, but for now, I will keep this here.


syntax on
set number
set hlsearch
set wildmenu
set hidden
set mouse=a
set tabstop=4

let mapleader = ","

"Learning mode!
map <up> <nop>
map <down> <nop>
map <left> <nop>
map <right> <nop>

imap <up> <nop>
imap <down> <nop>
imap <left> <nop>
imap <right> <nop>

"Set locations for swap files
set backupdir=~/.vim/tmp,~/tmp,/var/tmp,/tmp,.
set directory=~/.vim/tmp,~/tmp,/var/tmp,/tmp,.

"Configure whitespace display
silent! set listchars=tab:>-,trail:·,eol:$
nnoremap <silent> <Leader>w :set nolist!<CR>

"Enable better matching with %
runtime macros/matchit.vim

"Toggle wrap
nnoremap <F3> :set nowrap!<CR>

"Clear search highlighting
nnoremap <silent> <Leader>s :let @/ = ""<CR>

"Toggle line numbers with <F2> for easy code copying
nnoremap <F2> :set nonumber!<CR>:set foldcolumn=0<CR>

"Tab reordering
nnoremap <silent> <A-Left> :execute 'silent! tabmove ' . (tabpagenr()-2)<CR>
nnoremap <silent> <A-Right> :execute 'silent! tabmove ' . tabpagenr()<CR>

" Execute run command in a makefile
map <Leader>e :update<CR>:!clear<CR>:!% <CR>
map <silent> <Leader>fx :%! tidy -utf8 -xml -w 5 -i -q -asxml \| sed "s/^\(  \)*\w/  \0/"<CR>
map <silent> <Leader>fj :%! python -c "import sys; import json as j; print(j.dumps(j.loads(, indent=1))"<CR>
command! Reload :source ~/.vimrc

set noignorecase

colorscheme desert

Additional Notes

Pasting Text in Putty and XFCE-Terminal

When the mouse functions are enabled (set mouse=a), it is difficult to use the mouse functions built in to the terminal. This includes Putty.

For putty, I found that I can temporarily disable mouse integration by holding down the shift key.

For xfce-terminal, use CTRL+SHIFT+V when in insert mode to paste text, or click on Edit -> Paste.

Otherwise, the Vim mouse functions can be disabled by using the command set mouse-=a.

This entry was posted in Configurations on by .

About Andrew Wells

I have been developing on the LAMP stack since about 2006. I run Ubuntu XFCE on my desktop and have a history of managing Ubuntu and CentOS servers. I code web applications mostly in PHP but have experience with other languages as well. When I'm not working, I can be found working in my home lab or out snowboarding, hiking, camping, or biking depending on the season.

Leave a Reply

Your email address will not be published. Required fields are marked *