summaryrefslogtreecommitdiffstats
path: root/vimrc
blob: 7fc657387587d8ce98ba356b93db42dcf9365bd7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
" ~/.vimrc

"Use Vim mode
set nocompatible
"Basic startup settings
set encoding=utf-8
set termencoding=utf-8

" CUSTOM KEYBINDINGS "
"basic key remappings
"noremap <Space> <PageDown> "make vim act like pager in normal mode

"easy buffer flip shortcuts
nmap <F3> :bprev<CR> 
nmap <F4> :bnext<CR>
"toggle highlight search off and on
nmap <silent> <F5> :let &hls=!&hls<CR>
imap <silent> <F5> <Esc>:let &hls=!&hls<CR>a
"toggle view of taglist
nmap <silent> <F8> :TlistToggle<CR>
imap <silent> <F8> <Esc>:TlistToggle<CR>
"show BufExplorer
nmap <silent> <F6> :BufExplorer<CR>
imap <silent> <F6> <Esc>:BufExplorer<CR>
"toggle spell checking
nmap <silent> <F10> :let &spell=!&spell<CR>
imap <silent> <F10> <Esc>:let &spell=!&spell<CR>a
"VCS commands
nmap <Leader>vcsa <Plug>VCSAdd
nmap <Leader>vcsn <Plug>VCSAnnotate
nmap <Leader>vcsG <Plug>VCSClearAndGotoOriginal
nmap <Leader>vcsc <Plug>VCSCommit
nmap <Leader>vcsd <Plug>VCSDiff
nmap <Leader>vcsg <Plug>VCSGotoOriginal
nmap <Leader>vcsL <Plug>VCSLock
nmap <Leader>vcsl <Plug>VCSLog
nmap <Leader>vcsq <Plug>VCSRevert
nmap <Leader>vcsr <Plug>VCSReview
nmap <Leader>vcss <Plug>VCSStatus
nmap <Leader>vcsU <Plug>VCSUnlock
nmap <Leader>vcsu <Plug>VCSUpdate
nmap <Leader>vcsv <Plug>VCSVimDiff

" FILETYPE SETTINGS "
filetype on  "enable file detection
filetype indent on  "enable filetype indenting
filetype plugin on  "enable filetype plugins
set fileencodings=ucs-bom,utf-8,default,latin1 "encodings to try
let g:load_doxygen_syntax=1 "use doxygen syntax on c/cpp/idl files

" SYNTAX HIGHLIGHTING "
if (&t_Co > 2) || has("gui_running")
	syntax enable
endif

" GUI/NONGUI SETTINGS "
colorscheme desert

if has("gui_running")
	if has("gui_gtk2")
		set guifont=DejaVu\ Sans\ Mono\ 12
	endif
	colorscheme desert
	"colorscheme inkpot
	set columns=80 lines=40
else
	if (&t_Co >= 256)
		silent! colorscheme inkpot
	endif
	"set background=dark
endif

" BACKUP FILES "
set backup

" SWAP FILES "
set dir=~/.vim/tmp//,.,~/tmp,/var/tmp,/tmp

" SEARCHING SETTINGS "
set ignorecase  "ignore case in searches
set smartcase  "unless search contains uppercase
"set hlsearch  "highlight previous search term
set incsearch  "search-as-you-type

" FORMATTING SETTINGS "
set autoindent  "autoindent from previous line
set noexpandtab  "keep tabs as tabs
set tabstop=4  "set tabstop equiv for display
set shiftwidth=4  "set space equiv for each (auto)indent

" DISPLAY SETTINGS "
set ruler  "show cursor position
set rulerformat=%19([%5l,%-6(%c%V%)]\ %P%)
set showcmd  "display incomplete command
set cmdheight=1 "restrict command height (and no more 'press enter')
set showmode  "show current mode
set showmatch  "show matching []{}()
set shortmess+=r  "use short message to indicate read only
"set number  "show line numbers

" MISC SETTINGS "
set whichwrap=h,l,~,[,]  "allow cursor keys to wrap lines
set backspace=indent,eol,start  "allow backspacing of these chars
set ttyfast  "smoother on fast terminals
set history=50  "number of commands/searches to store
set wildchar=<tab>
set wildmenu
set wildmode=longest:full,full  "list possibilities when wildcard completing
set shell=bash  "shell for vim to use
set ttymouse=xterm  "use xterm mouse codes
if has('mouse')
	set mouse=a  "enable mouse in all modes
endif

" AUTOCOMMMANDS "
if has("autocmd")
  autocmd BufReadPost *
    \ if line("'\"") > 1 && line("'\"") <= line("$") |
    \   exe "normal! g`\"" |
    \ endif
endif

if !exists(":DiffOrig")
  command DiffOrig vert new | set bt=nofile | r # | 0d_ | diffthis
		  \ | wincmd p | diffthis
endif

" ABBREVIATIONS "
iab MAINTTAG # Maintainer: Dan McGee <dan@archlinux.org>
iab CONTRIBTAG # Contributor: Dan McGee <dpmcgee@gmail.com>