-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvimrc
More file actions
153 lines (136 loc) · 4.36 KB
/
vimrc
File metadata and controls
153 lines (136 loc) · 4.36 KB
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
"""" SETTINGS {{{
filetype plugin indent on
syntax on
set colorcolumn=120
set comments+=b:\"
set encoding=utf-8
set expandtab
set foldcolumn=3
set hidden
set hlsearch
" set ignorecase
set incsearch
set laststatus=2
set list
set listchars=tab:\|\ ,trail:·
set nowrap
set number
set relativenumber
set ruler
set scrolloff=5
set shiftwidth=4
set signcolumn=yes
set showcmd
set softtabstop=4
set ts=4
set sidescroll=10
set wildmenu
set wildmode=list:longest,full
" }}}
let completeopt="menuone,longest,preview"
let mapleader = ' '
nnoremap <space> <nop>
"""" MAPPINGS {{{
nnoremap <silent> <leader> :WhichKey '<space>'<CR>
" tab select
nnoremap <A-1> 1gt
nnoremap <A-2> 2gt
nnoremap <A-3> 3gt
nnoremap <A-4> 4gt
nnoremap <A-5> 5gt
nnoremap <A-6> 6gt
nnoremap <A-7> 7gt
nnoremap <A-8> 8gt
nnoremap <A-9> 9gt
" previous tab
nnoremap <A-[> gT
" next tab
nnoremap <A-]> gt
" close tab
nnoremap <A-'> <Esc>:q<CR>
inoremap {<Space> { }<Left><Left>
inoremap {<CR> {<CR>}<Esc>O
inoremap ( ()<Left>
inoremap <expr> ) strpart(getline('.'), col('.')-1, 1) == ")" ? "\<Right>" : ")"
inoremap [ []<Left>
inoremap <expr> ] strpart(getline('.'), col('.')-1, 1) == "]" ? "\<Right>" : "]"
inoremap <expr> " strpart(getline('.'), col('.')-1, 1) == '"' ? "\<Right>" : '""<Left>'
inoremap <expr> ' strpart(getline('.'), col('.')-1, 1) == "'" ? "\<Right>" : "''<Left>"
inoremap <expr> ` strpart(getline('.'), col('.')-1, 1) == "`" ? "\<Right>" : "``<Left>"
noremap <F1> <ESC>:BufExplorer<CR>
" new tab
nnoremap <C-n> <ESC>:silent Texplore<CR>
" turn off highlight search
noremap <C-h> :nohlsearch<CR>
" new empty buffer
noremap <C-F6> :enew<CR>
" close lower buffer
noremap <F7> <Esc><C-w>j:q<CR>
" close upper buffer
noremap <F8> <Esc><C-w>k:q<CR>
noremap <C-F9> <Esc>:TagbarToggle<CR>
" toggle fold
" nnoremap <space> za
" }}}
" Don't screw up folds when inserting text that might affect them, until
" leaving insert mode. Foldmethod is local to the window. Protect against
" screwing up folding when switching between windows.
augroup folds
autocmd!
autocmd InsertEnter * if !exists('w:last_fdm') | let w:last_fdm=&foldmethod | setlocal foldmethod=manual | endif
autocmd InsertLeave,WinLeave * if exists('w:last_fdm') | let &l:foldmethod=w:last_fdm | unlet w:last_fdm | endif
augroup END
augroup filetype_vim
autocmd!
autocmd FileType vim setlocal foldmethod=marker
augroup END
augroup filetype_xt
au BufNewFile,BufRead *.xt setf xt
augroup END
"""" VimPlug {{{
" Installs VimPlug if not exists
if empty(glob('~/.vim/autoload/plug.vim'))
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif
call plug#begin('~/.vim/bundle')
source ~/.vim/config/plugins/ale.vim
source ~/.vim/config/plugins/bufexplorer.vim
source ~/.vim/config/plugins/coc.vim
source ~/.vim/config/plugins/emmet-vim.vim
source ~/.vim/config/plugins/fzf.vim
source ~/.vim/config/plugins/lightline.vim
source ~/.vim/config/plugins/indentLine.vim
source ~/.vim/config/plugins/nerdtree.vim
source ~/.vim/config/plugins/nerdtree-git-plugin.vim
source ~/.vim/config/plugins/phpactor.vim
source ~/.vim/config/plugins/quick-scope.vim
source ~/.vim/config/plugins/signify.vim
source ~/.vim/config/plugins/tagbar.vim
source ~/.vim/config/plugins/ultisnips.vim
source ~/.vim/config/plugins/vim-commentary.vim
source ~/.vim/config/plugins/vim-fugitive.vim
source ~/.vim/config/plugins/vim-project.vim
source ~/.vim/config/plugins/vim-unimpaired.vim
source ~/.vim/config/plugins/vdebug.vim
source ~/.vim/config/plugins/vim-rest-console.vim
source ~/.vim/config/plugins/vim-surround.vim
source ~/.vim/config/plugins/vim-test.vim
source ~/.vim/config/plugins/vim-which-key.vim
source ~/.vim/config/plugins/vimwiki.vim
call plug#end()
" }}}
"""" persistent undo {{{
" https://stackoverflow.com/questions/5700389/using-vims-persistent-undo/22676189
set undofile " Save undos after file closes
set undodir=$HOME/.vim/undo " where to save undo histories
set undolevels=1000 " How many undos
set undoreload=10000 " number of lines to save for undo
" }}}
" If host specific configuration is needed, create unversioned file config.vim
" You may use config.vim.example as a template
if filereadable(expand($HOME."/.vim/config.vim"))
source ~/.vim/config.vim
endif
" Nothing should go below this line.