-
Notifications
You must be signed in to change notification settings - Fork 1
/
.vimrc
163 lines (128 loc) · 2.87 KB
/
.vimrc
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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
" Vundle
filetype off
let g:vundle_default_git_proto = 'git'
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" Bundles
Plugin 'VundleVim/Vundle.vim'
Plugin 'tpope/vim-fugitive'
Plugin 'sjl/gundo.vim'
Plugin 'godlygeek/tabular'
Plugin 'bling/vim-airline'
Plugin 'vim-airline/vim-airline-themes'
Plugin 'altercation/vim-colors-solarized'
Plugin 'scrooloose/nerdtree'
Plugin 'TomNomNom/xoria256.vim'
Plugin 'fatih/vim-go'
Plugin 'rust-lang/rust.vim'
call vundle#end()
" Required for vundle
"filetype plugin indent on
filetype plugin on
" Highlighting
syntax on
set encoding=utf-8
" Airline config
let g:airline_powerline_fonts = 1
let g:airline#extensions#tabline#enabled = 1
let g:airline_theme='powerlineish'
" History
set history=50
" Display
set ls=2
set showmode
set showcmd
set modeline
set ruler
set title
set nu
"No swap
set noswapfile
" Line wrapping
set number
set nowrap
set linebreak
set showbreak=▹
" Auto indent what you can
set autoindent
" Searching
set ignorecase
set smartcase
set gdefault
set hlsearch
set showmatch
" Enable jumping into files in a search buffer
set hidden
" Make backspace a bit nicer
set backspace=eol,start,indent
" Indentation
set shiftwidth=4
set tabstop=4
set softtabstop=4
set shiftround
set expandtab
" Disable mouse
set mouse=
" Colorscheme
if &t_Co == 256
try
color xoria256
catch /^Vim\%((\a\+)\)\=:E185/
" Oh well
endtry
endif
" Switch tabs
map 8 <Esc>:tabe
map 9 gT
map 0 gt
" Gundo toggle
map <F5> <Esc>:GundoToggle<CR>
" Toggle line-wrap
map <F6> <Esc>:set wrap!<CR>
" Open file under cursor in new tab
map <F9> <Esc><C-W>gF<CR>:tabm<CR>
" Direction keys for wrapped lines
nnoremap <silent> k gk
nnoremap <silent> j gj
nnoremap <silent> <Up> gk
nnoremap <silent> <Down> gj
inoremap <silent> <Up> <Esc>gka
inoremap <silent> <Down> <Esc>gja
" Bash / emacs keys for command line
cnoremap <C-a> <Home>
cnoremap <C-e> <End>
" Base64 decode word under cursor
nmap <Leader>b :!echo <C-R><C-W> \| base64 -d<CR>
" grep recursively for word under cursor
nmap <Leader>g :tabnew\|read !grep -Hnr '<C-R><C-W>'<CR>
" sort the buffer removing duplicates
nmap <Leader>s :%!sort -u --version-sort<CR>
" Visual prompt for command completion
set wildmenu
" Write current file with sudo perms
"command! W w !sudo tee % > /dev/null
command! W w
" folding
set nofoldenable
" Open word under cursor as ctag in new tab
map <C-\> :tab split<CR>:exec("tag ".expand("<cword>"))<CR>
if $VIMENV == 'talk'
set background=light
let g:solarized_termcolors=256
colo solarized
noremap <Space> :n<CR>
noremap <Backspace> :N<CR>
else
" Trans background
hi Normal ctermbg=none
hi NonText ctermbg=none
endif
if $VIMENV == 'prev'
noremap <Space> :n<CR>
noremap <Backspace> :N<CR>
set noswapfile
endif
set noesckeys
set nocompatible
" set the interactive flag so bash functions are sourced from ~/.bashrc etc
"set shellcmdflag=-ci