-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.vimrc
157 lines (132 loc) · 3.93 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
"------------------------------------
"vim fugitive
"------------------------------------
"------------------------------------
"fzf
"------------------------------------
function! Rooter() abort
" https://vi.stackexchange.com/questions/20605/find-project-root-relative-to-the-active-buffer/20606
let l:dir = finddir('.git/..', expand('%:p:h').';')
"echom 'cwd: ' . l:dir
execute 'lcd ' . l:dir
endfunction
augroup rooter
autocmd!
autocmd BufRead * call Rooter()
augroup END
"------------------------------------
"VIM-LSP
"------------------------------------
highlight link LspErrorHighlight NONE
highlight link LspWarningHighlight NONE
let g:lsp_diagnostics_enabled = 0 " disable diagnostics support
"let g:lsp_inlay_hints_enabled = 0
function g:StartLsp()
function! OnLspBufferEnabled() abort
setlocal omnifunc=lsp#complete
setlocal signcolumn=yes
nmap <buffer> gi <plug>(lsp-definition)
nmap <buffer> gd <plug>(lsp-declaration)
nmap <buffer> gr <plug>(lsp-references)
nmap <buffer> gl <plug>(lsp-document-diagnostics)
nmap <buffer> <f2> <plug>(lsp-rename)
nmap <buffer> <f3> <plug>(lsp-hover)
endfunction
augroup lsp_install
au!
autocmd User lsp_buffer_enabled call OnLspBufferEnabled()
augroup END
endfunction
"------------------------------------
"Ale
"------------------------------------
let g:ale_linters = { 'python': ['flake8']}
"------------------------------------
"Colorsheme
"------------------------------------
set background=dark
let g:everforest_background = 'soft'
"------------------------------------
set t_ut= "Reload vimrc when saving
let mapleader = "\\"
let maplocalleader = "\\"
"------------------------------------
" REQUIRED. This makes vim invoke Latex-Suite when you open a tex file.
filetype plugin on
" IMPORTANT: win32 users will need to have 'shellslash' set so that latex
" can be called correctly.
set shellslash
" OPTIONAL: This enables automatic indentation as you type.
filetype indent on
" OPTIONAL: Starting with Vim 7, the filetype of empty .tex files defaults
"to 'plaintex' instead of 'tex', which results in vim-latex not being loaded.
" The following changes the default filetype back to 'tex':
let g:tex_flavor='latex'
"------------------------------------
syntax enable
filetype plugin on
filetype indent on
filetype indent plugin on
set backspace=indent,eol,start
set tabstop=2 shiftwidth=2 expandtab
set shiftwidth=4
set fdm=indent
set ts=8
set et
set sts=4
set ai
set nu
set nowrap
set noexpandtab
set spelllang=en
set nospell
set hlsearch
map <leader>vimrc :tabe ~/.vimrc<cr>
autocmd bufwritepost .vimrc source $MYVIMRC
"----------------------------------------
:vnoremap <Up> <nop>
:vnoremap <Down> <nop>
:vnoremap <Right> <nop>
:vnoremap <Left> <nop>
:vnoremap cp "*y
:vnoremap ps "*p
:vnoremap jk <esc>
"----------------------------------------
:nnoremap + ddkkp
:nnoremap - ddp
"Turn off highlight
:nnoremap <leader>c :noh<cr>
"Open fuzzy finder
:nnoremap <leader>f :FZF<cr>
"Git fugitive
:nnoremap <leader>g :Git<cr>
"Switch to last file
:nnoremap <leader>l :e #<cr>
"Switch between preview and main
:nnoremap <leader>p <c-w>p
"Quit
:nnoremap <leader>q :q<cr>
"reload vimrc
:nnoremap <leader>r :so $MYVIMRC<cr>
"remove spaces at the end of lines
:nnoremap <leader>s :%s/\s\+$//<cr>
"Save
:nnoremap <leader>w :w<cr>
:nnoremap <S-j> <nop>
:nnoremap <S-k> <nop>
:nnoremap <S-l> <nop>
:nnoremap <S-h> <nop>
:nnoremap <Up> <nop>
:nnoremap <Down> <nop>
:nnoremap <Right> <nop>
:nnoremap <Left> <nop>
"----------------------------------------
:inoremap <c-d> <esc>ddi
:inoremap <c-u> <esc>vwUi
:inoremap <c-z> <esc>ui
" Autocomplete
:inoremap <c-c> <C-x><C-o>
:inoremap jk <esc>
:hi Type ctermfg=green ctermbg=none cterm=bold
:hi Folded ctermfg=gray ctermbg=none
:hi Search cterm=NONE ctermfg=black ctermbg=white