-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy path.vimrc
225 lines (188 loc) · 6.61 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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
filetype plugin indent on
syntax on
colorscheme sorcerer
hi Normal guibg=NONE ctermbg=NONE
hi Search cterm=NONE ctermfg=black ctermbg=yellow
hi SpellBad ctermfg=0 ctermbg=225 guibg=LightMagenta
hi Normal ctermfg=white ctermbg=NONE
" Show partial commands in the last line of the screen
set showcmd
" Better command-line completion
set wildmenu
" Highlight searches (use <C-L> to temporarily turn off highlighting; see the
" mapping of <C-L> below)
set hlsearch
" Allow backspacing over autoindent, line breaks and start of insert action
set backspace=indent,eol,start
" Use case insensitive search, except when using capital letters
set ignorecase
set smartcase
" When opening a new line and no filetype-specific indenting is enabled, keep
" the same indent as the line you're currently on. Useful for READMEs, etc.
set autoindent
" Stop certain movements from always going to the first character of a line.
" While this behaviour deviates from that of Vi, it does what most users
" coming from other editors would expect.
set nostartofline
" Display the cursor position on the last line of the screen or in the status
" line of a window
set ruler
" Instead of failing a command because of unsaved changes, instead raise a
" dialogue asking if you wish to save changed files.
set confirm
" Display line numbers on the left
set number
" Indentation settings for using hard tabs for indent. Display tabs as
" two characters wide.
set noexpandtab
set shiftwidth=2
set tabstop=2
set undofile
set undodir=~/.vim/undodir
set relativenumber!
set path=,src/**,playground/**,test/**,forms/**,projects/laji/**,projects/laji-ui/**
"set wildignore+=tmp/*,*.so,*.swp,*.zip,lib/*,dist/*,node_modules/*
"
set hidden
cmap w!! w !sudo tee > /dev/null %
let mapleader = "\<Space>"
nnoremap <Leader>w :wa<CR>
nnoremap <Leader>W :wq<CR>
nnoremap <Leader>q :q<CR>
nnoremap <Leader>Q :q!<CR>
nnoremap <Leader>v viw<CR>
nnoremap <Leader>V viW<CR>
nnoremap <Leader>y yiw<CR>
nnoremap <Leader>Y yiW<CR>
"nnoremap <Leader><Leader> :ls<CR>:b<Space>
nnoremap <silent> <Leader><Leader> :Buffers<CR><Space>
nnoremap <Leader>x :bd<CR>
"nnoremap <Leader>f :find<Space>
nnoremap <silent> <Leader>f :GFiles<CR><Space>
nnoremap <Leader>s :mksession!<Space>.vimsession<CR>
nnoremap <Leader>S :mksession!<Space>.vimsession<CR>:wq<CR>
nnoremap <Leader>r ye:%s/<C-r>"//g<left><left>
autocmd FileType typescript nmap <buffer> <Leader>t : <C-u>echo tsuquyomi#hint()<CR>
map <C-J> :bprevious<CR>
map <C-K> :bnext<CR>
function! g:ToggleBothNums()
if &relativenumber && &number
set norelativenumber nonumber
else
set relativenumber number
endif
endfunction
nnoremap <silent> <leader>nr :set relativenumber!<cr>
nnoremap <silent> <leader>na :set number!<cr>
nnoremap <silent> <leader>nn :call g:ToggleBothNums()<cr>
function! g:OffRelNumPreserve()
let w:preserved_rnu = &relativenumber
let w:preserved_nu = &number
if &relativenumber || &number
set number norelativenumber
endif
endfunction
function! g:RestoreRelNum()
if exists('w:preserved_rnu')
let &relativenumber = w:preserved_rnu
endif
if exists('w:preserved_nu')
let &number = w:preserved_nu
endif
endfunction
au WinLeave * call g:OffRelNumPreserve()
au WinEnter * call g:RestoreRelNum()
set wildmode=longest,list,full
set wildmenu
set backupcopy=yes
autocmd Filetype javascript setlocal tabstop=2 shiftwidth=2
autocmd Filetype typescript setlocal tabstop=2 shiftwidth=2
call plug#begin('~/.vim/plugged')
Plug 'tpope/vim-surround'
"Plug 'vim-syntastic/syntastic'
Plug 'pangloss/vim-javascript', {'for': ['javascript', 'typescript']}
Plug 'mxw/vim-jsx', {'for': ['javascript', 'typescript']}
Plug 'xolox/vim-easytags'
Plug 'xolox/vim-misc'
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
"Plug 'ternjs/tern_for_vim', { 'do': 'npm install' }
"Plug 'w0rp/ale'
Plug 'editorconfig/editorconfig-vim'
Plug 'leafgarland/typescript-vim', {'for': ['javascript', 'typescript']}
"Plug 'Quramy/tsuquyomi'
Plug 'peitalin/vim-jsx-typescript', {'for': ['javascript', 'typescript']}
"Plug 'neoclide/coc.nvim', {'branch': 'release', 'for': ['javascript', 'typescript']}
Plug 'neoclide/coc.nvim', {'commit': '487d077e1131ee5b09e329d15f9d9ae53aa8f44a'}
Plug 'tomtom/tcomment_vim'
Plug 'preservim/nerdtree'
Plug 'tpope/vim-repeat'
"Plug 'ctrlpvim/ctrlp.vim'
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
Plug 'junegunn/fzf.vim'
let g:coc_global_extensions = [
\ 'coc-tsserver',
\ 'coc-eslint',
\ 'coc-json',
\ 'coc-angular'
\ ]
let g:coc_disable_transparent_cursor = 1
call plug#end()
"set statusline+=%#warningmsg#
"set statusline+=%{SyntasticStatuslineFlag()}
"set statusline+=%*
"let g:syntastic_always_populate_loc_list = 1
"let g:syntastic_auto_loc_list = 1
""let g:syntastic_check_on_open = 1
"let g:syntastic_check_on_wq = 0
"let g:syntastic_javascript_checkers = ['eslint']
let g:airline#extensions#tabline#enabled = 1
" let g:airline#extensions#ale#enabled = 1
" let g:ale_sign_error = '!'
" let g:ale_sign_warning = '#'
" let g:ale_linters = {
" \ 'javascript': ['eslint'],
" \}
"
" nmap <silent> <C-h> <Plug>(ale_previous_wrap)
" nmap <silent> <C-l> <Plug>(ale_next_wrap)
let g:jsx_ext_required = 0
let g:easytags_async = 1
let g:easytags_languages = {
\ 'javascript': {
\ 'cmd': 'jsctags',
\ 'args': [],
\ 'fileoutput_opt': '-f',
\ 'stdout_opt': '-f-',
\ 'recurse_flag': '-R'
\ }
\}
let g:airline_theme='alduin'
"map <C-l> <Plug>(TsuquyomiReferences)
map <C-^> :b#<CR>
" define the default minus c-^ (TsuquyomiReferendes)
"let g:tsuquyomi_disable_default_mappings = 1
"map <C-t> @<Plug>(TsuquyomiReferences)
"map <buffer> <C-]> <Plug>(TsuquyomiDefinition)
"map <buffer> <C-W>] <Plug>(TsuquyomiSplitDefinition)
"map <buffer> <C-W><C-]> <Plug>(TsuquyomiSplitDefinition)
"map <buffer> <C-t> <Plug>(TsuquyomiGoBack)
""map <buffer> <C-l> <Plug>(TsuquyomiReferences)
command! -nargs=* -range CocAction :call CocActionAsync('codeActionRange', <line1>, <line2>, <f-args>)
nnoremap <silent> <c-h> :call CocAction('diagnosticPrevious')<CR>
nnoremap <silent> <c-l> :call CocAction('diagnosticNext')<CR>
nnoremap <silent> <c-]> :call CocAction('jumpDefinition')<CR>
nnoremap <silent> <Leader>r :CocCommand document.renameCurrentWord<CR>
nnoremap <silent> <c-t> :call <SID>show_documentation()<CR>
nnoremap <silent> <c-\> :CocAction<CR>
function! s:show_documentation()
if (index(['vim','help'], &filetype) >= 0)
execute 'h '.expand('<cword>')
elseif (coc#rpc#ready())
call CocActionAsync('doHover')
else
execute '!' . &keywordprg . " " . expand('<cword>')
endif
endfunction
let g:fzf_preview_window = ['up:40%:hidden', 'ctrl-/']
nnoremap <silent> <buffer> <Leader><CR> :NERDTreeToggle<CR>