-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvimrc
111 lines (86 loc) · 2.66 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
" Instantiate plugin manager
execute pathogen#infect()
syntax on
filetype plugin indent on
set nocompatible
" Tab settings
set expandtab
set smarttab
set shiftwidth=4
set tabstop=4
" Unix file format
set ffs=unix,dos,mac
" Toggle paste mode for insert
set pastetoggle=<F4>
" color scheme
colorscheme desert
set background=dark
" Performance improvement
" set lazydraw
" Show matching [({})]
set showmatch
" Pop up menu
set wildmenu
set wildignore+=*.o,*.obj,*.pyc,*.DS_STORE,*.db,*.swc
set noerrorbells " No sound on errors
set novisualbell " No sound on errors
" Configure backspace
set backspace=indent,eol,start " Backspace into previous line
set whichwrap+=<,>,h,l
" Make \s turn on/off trailing whitespace
set listchars=tab:>-,trail:·,extends:>,precedes:<,nbsp:_,eol:$
nmap <silent> <leader>s :set nolist!<CR>
set title " Update the terminal title
set scrolloff=3 " More context around scrolling
set sidescrolloff=5 " More context around scrolling horizontally
set ruler " Show on-screen position
set showcmd " Show (partial) command in status line
set ttyfast " High bandwidth editing more for performance
set shell=bash " Use the right shell
" Keyboard mapping
nore ; :
" Editing
set history=1000
" Buffers moving between buffers
map <C-j> :bprev<CR>
map <C-k> :bnext<CR>
map <Leader>a :A<CR>
map <Leader>l :b#<CR>
map <Leader>k :Bclose<CR>
map <Leader>K :Bclose!<CR>
set hidden " Allow moving between buffers with file changes
" highlight last inserted
noremap gV `[v`]
" Toggle search highlighting
noremap <F3> :set hlsearch!<CR>
" Minibuffer explorer
map <Leader>b :MBEToggle<CR>
" Return to last edit position when opening files
autocmd BufReadPost *
\ if line("'\"") > 0 && line("'\"") <= line("$") |
\ exe "normal! g`\"" |
\ endif
" Remember info about open buffers on close
" "set viminfo^=%
" Delete trailing white space on save, useful for Python, C, C++
func! DeleteTrailingWS()
exe "normal mz"
%s/\s\+$//ge
exe "normal `z"
endfunc
autocmd BufWrite *.pyx :call DeleteTrailingWS()
autocmd BufWrite *.py :call DeleteTrailingWS()
autocmd BufWrite *.cpp :call DeleteTrailingWS()
autocmd BufWrite *.hpp :call DeleteTrailingWS()
autocmd BufWrite *.c :call DeleteTrailingWS()
autocmd BufWrite *.h :call DeleteTrailingWS()
" Super undo
nnoremap <leader>u :GundoToggle<CR>
" Edit vimrc \ev
nnoremap <silent> <Leader>ev :e $MYVIMRC<CR>
" Directory browsing
nnoremap <silent> <Leader>d :NERDTreeToggle<CR>
nnoremap <silent> <Leader>r :NERDTreeFind<CR>
" CtrlP settings
let g:ctrlp_working_path_mode = 0
let g:ctrlp_user_command = 'ag %s -l --nocolor -g ""'