-
Notifications
You must be signed in to change notification settings - Fork 1
/
.vimrc
executable file
·121 lines (96 loc) · 2.99 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
" Set Vim properties
set nocompatible " be iMproved, required
set hlsearch
set rnu
set number
set ff=unix
set guioptions+=a
set encoding=utf8
set guifont=Monaco:h18
set rtp+=~/.vim/bundle/Vundle.vim
filetype off " required
" Vim Plugins
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
Plugin 'tpope/vim-surround'
Plugin 'scrooloose/nerdtree'
Plugin 'tiagofumo/vim-nerdtree-syntax-highlight'
Plugin 'slim-template/vim-slim.git'
Plugin 'ctrlpvim/ctrlp.vim'
Plugin 'vim-scripts/ZoomWin'
Plugin 'flazz/vim-colorschemes'
Plugin 'vim-airline/vim-airline'
Plugin 'tpope/vim-rails'
Plugin 'tpope/vim-fugitive'
Plugin 'ntpeters/vim-better-whitespace'
Plugin 'jceb/vim-orgmode'
Plugin 'majutsushi/tagbar'
Plugin 'xolox/vim-misc'
Plugin 'tpope/vim-speeddating'
Plugin 'tommcdo/vim-exchange'
Plugin 'tpope/vim-dispatch'
" Snippets
Plugin 'MarcWeber/vim-addon-mw-utils'
Plugin 'tomtom/tlib_vim'
Plugin 'garbas/vim-snipmate'
Plugin 'honza/vim-snippets'
" Vuejs
Plugin 'posva/vim-vue'
" Golang
Plugin 'fatih/vim-go'
call vundle#end() " required
syntax enable
filetype plugin indent off" required
" remap , to be the leader key
" let maplocalleader=','
"
" Toggle Tagbar
nmap <F12> :Tagbar<CR>
nmap <F10> :set rnu!<CR>
" Shift Enter will insert new line without going to insert mode
nmap <S-Enter> O<Esc>
nmap <CR> o<Esc>
" Press Space to turn off highlighting and clear any message already displayed.
:nnoremap <Space> :nohlsearch<Bar>:echo<CR>
" NERDTree helpers
" autocmd VimEnter * NERDTree
" autocmd BufEnter * NERDTreeMirror
nmap <silent> <c-n> :NERDTreeToggle<CR>
let NERDTreeIgnore=['\.pyc$', '\~$', '__pycache__'] "ignore files in NERDTree
" Close vim if only one tab is open
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
" Vim Better Whitespace
" Remove whitespace by default
autocmd BufWritePre * StripWhitespace
" Styling
colorscheme jellybeans
set cursorline
"Reload vimrc on pressing ,rv in normal mode
nnoremap rv :w!<Esc>:source $MYVIMRC<CR>
nnoremap ev :e $MYVIMRC<CR>
" Use decimal formats only
" <C-a> on 007 will increment to 008 and not octal value which is 010.
" ref Practical Vim
set nrformats=
" For vim-orgmode, Have to check and start using it
" :let g:org_agenda_files=['~/org/index.org']
" Temp map jj key to escape till seil issue is fixed
" inoremap jj <Esc>
" bind K to grep word under cursor
nnoremap K :grep! "\b<C-R><C-W>\b"<CR>:cw<CR>
" The Silver Searcher
if executable('ag')
" Use ag over grep
set grepprg=ag\ --nogroup\ --nocolor
" Use ag in CtrlP for listing files. Lightning fast and respects .gitignore
let g:ctrlp_user_command = 'ag %s -l --nocolor -g ""'
" ag is fast enough that CtrlP doesn't need to cache
let g:ctrlp_use_caching = 0
endif
" bind \ (backward slash) to grep shortcut
" command -nargs=+ -complete=file -bar Ag silent! grep! <args>|cwindow|redraw!
" nnoremap \ :Ag<SPACE>
" vim-go bindings
map <C-n> :cnext<CR>
map <C-m> :cprevious<CR>
nnoremap <leader>a :cclose<CR>