-
Notifications
You must be signed in to change notification settings - Fork 0
/
vimrc
executable file
·213 lines (177 loc) · 5.8 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
"""""""""""""""""""""""""""""""""""""""""
"""" Vim Plug
""""""""""""""""""""""""""""""""""""""""
call plug#begin('~/.config/nvim/plugged')
"""""""""""""""""""""""""""""""""""""""""""""""
""" Improve Vim Capabilities
"""""""""""""""""""""""""""""""""""""""""""""""
Plug 'chrisbra/unicode.vim'
Plug 'nathanaelkane/vim-indent-guides'
Plug 'tpope/vim-vinegar'
Plug 'rking/ag.vim'
Plug 'tpope/vim-endwise'
Plug 'tpope/vim-jdaddy'
Plug 'tpope/vim-fugitive'
Plug 'kien/ctrlp.vim'
Plug 'tpope/vim-eunuch'
Plug 'tpope/vim-dispatch'
Plug 'mg979/vim-visual-multi', {'branch': 'master'}
Plug 'tpope/vim-abolish'
Plug 'rbgrouleff/bclose.vim'
Plug 'francoiscabrol/ranger.vim'
""" Add language support
Plug 'jparise/vim-graphql'
Plug 'rust-lang/rust.vim'
Plug 'leafgarland/typescript-vim'
Plug 'vim-ruby/vim-ruby'
Plug 'isRuslan/vim-es6'
Plug 'plasticboy/vim-markdown'
Plug 'posva/vim-vue'
Plug 'pangloss/vim-javascript'
Plug 'briancollins/vim-jst'
Plug 'mxw/vim-jsx'
Plug 'elzr/vim-json'
Plug 'tikhomirov/vim-glsl'
Plug 'xavierchow/vim-sequence-diagram'
Plug 'JuliaEditorSupport/julia-vim'
Plug 'hashivim/vim-terraform'
Plug 'styled-components/vim-styled-components', { 'branch': 'main' }
Plug 'nono/lezer.vim'
Plug 'chr4/nginx.vim'
Plug 'fatih/vim-go', { 'do': ':GoUpdateBinaries' }
""" Programming Tools
Plug 'ap/vim-css-color'
Plug 'editorconfig/editorconfig-vim'
Plug 'w0rp/ale'
Plug 'janko/vim-test'
""" Airline and Themes
Plug 'itchyny/lightline.vim'
Plug 'edkolev/tmuxline.vim'
Plug 'drewtempelmeyer/palenight.vim'
""" Navigation should override any other macros
Plug 'christoomey/vim-tmux-navigator'
call plug#end()
""""""""""""""""""""""""""""""""""""""""
" Basic Config
""""""""""""""""""""""""""""""""""""""""
au BufRead,BufNewFile */nginx.conf.template set ft=nginx
au BufRead,BufNewFile */nginx/*.conf.template set ft=nginx
autocmd BufNewFile,BufRead *.tsx set filetype=typescript
""" vim-json
let g:vim_json_syntax_conceal = 0
""" vim-markdown
let g:vim_markdown_fenced_languages = ['c++=cpp', 'viml=vim', 'bash=sh', 'ini=dosini', 'javascript=js', 'mermaid=sequence']
let g:vim_markdown_math = 1
let g:vim_markdown_frontmatter = 1
""" editorconfig options
let g:EditorConfig_exclude_patterns = ['fugitive://.*']
let g:EditorConfig_max_line_indicator = 'fill'
let g:EditorConfig_preserve_formatoptions = 1
""" ale
let g:ale_completion_enabled = 1
""" using unamed clipboard to match macOS
set clipboard=unnamed
set backspace=2 " make backspace work like most other apps
set wildignore+=\.DS_Store
set termguicolors
set number
syntax on
let g:ale_fixers = {
\ 'javascript': ['eslint'],
\ 'typescript': ['eslint', 'tslint'],
\ 'json': ['fixjson'],
\ 'python': ['trim_whitespace', 'remove_trailing_lines'],
\ 'go': [],
\ }
let g:ale_lint_on_save = 1
let g:ale_fix_on_save = 1
let g:ale_python_flake8_executable = 'pipenv'
let g:ale_linters = {
\ 'javascript': ['eslint', 'flow'],
\ 'typescript': ['eslint', 'tslint', 'tsserver'],
\ 'python': ['flake8'],
\ 'json': ['fixjson'],
\ 'rust': ['analyzer', 'cargo'],
\ 'go': ['go vet'],
\ }
set background=dark
colorscheme palenight
""" Make background clear for terminal emulator background images
hi Normal ctermbg=none
highlight ColorColumn ctermbg=235 guibg=#333333
hi Normal guibg=NONE ctermbg=NONE
filetype indent off
""" Always show statusline
set laststatus=2
set noshowmode
let g:lightline = {
\ 'colorscheme': 'palenight',
\ 'active': {
\ 'left': [ [ 'mode', 'paste' ],
\ [ 'gitbranch', 'filename', 'modified' ] ]
\ },
\ 'component_function': {
\ 'gitbranch': 'fugitive#head'
\ },
\ }
if (has("nvim"))
"For Neovim 0.1.3 and 0.1.4 < https://github.com/neovim/neovim/pull/2198 >
let $NVIM_TUI_ENABLE_TRUE_COLOR=1
endif
"For Neovim > 0.1.5 and Vim > patch 7.4.1799 < https://github.com/vim/vim/commit/61be73bb0f965a895bfb064ea3e55476ac175162 >
"Based on Vim patch 7.4.1770 (`guicolors` option) < https://github.com/vim/vim/commit/8a633e3427b47286869aa4b96f2bfc1fe65b25cd >
" < https://github.com/neovim/neovim/wiki/Following-HEAD#20160511 >
if (has("termguicolors"))
set termguicolors
endif
""""""""""""""""""""""""""""""""""""""""
" Plug Settings
""""""""""""""""""""""""""""""""""""""""
let g:ranger_replace_netrw = 1
""" Indentation Guides
au FileType * IndentGuidesEnable
let g:indent_guides_auto_colors = 0
autocmd VimEnter,Colorscheme * :hi IndentGuidesOdd guibg=#2a364f
autocmd VimEnter,Colorscheme * :hi IndentGuidesEven guibg=#283247
set nowrap
autocmd FileType md set wrap
set foldlevelstart=20
setlocal foldmethod=syntax
"""ctrlp should cache
let g:ctrlp_cache_dir = $HOME . '/.cache/ctrlp'
"""ctrlp should use ag to search
if executable('ag')
let g:ctrlp_user_command = 'ag %s -l --nocolor -g ""'
endif
""""""""""""""""""""""""""""""""""""""""
" Mappings
""""""""""""""""""""""""""""""""""""""""
map <Leader>sp :split<CR>
map <Leader>vs :vsplit<CR>
map <Leader>gtd :ALEGoToDefinition<CR>
map <Leader>gtds :ALEGoToDefinitionInSplit<CR>
map <Leader>gtdv :ALEGoToDefinitionInVSplit<CR>
map <Leader>fref :ALEFindReferences<CR>
map <Leader>hov :ALEHover<CR>
map <Leader>doc :ALEDocumentation<CR>
map <Leader>rename :ALERename<CR>
map <Leader>fix :ALEFixSuggest<CR>
map <leader>aj :ALENext<CR>
map <leader>ak :ALEPrevious<CR>
map <leader>alet :ALEToggle<CR>
map <leader>tn :TestNearest<CR>
map <leader>tf :TestFile<CR>
map <leader>ts :TestSuite<CR>
nmap - :Ranger<CR>
tnoremap <silent><C-j> <C-\><C-N>:TmuxNavigateDown<CR>i
tnoremap <silent><C-k> <C-\><C-N>:TmuxNavigateUp<CR>i
tnoremap <silent><C-h> <C-\><C-N>:TmuxNavigateLeft<CR>i
tnoremap <silent><C-l> <C-\><C-N>:TmuxNavigateRight<CR>i
""""""""""""""""""""""""""""""""""""""""
" Functions
""""""""""""""""""""""""""""""""""""""""
function! Notes()
cd ~/google_drive/notes
call RangeChooser()
endfunction
map <Leader>nts :call Notes()<CR>