-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.vim
289 lines (226 loc) Β· 7.78 KB
/
config.vim
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
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
let mapleader =","
let g:loaded_matchit = 1
call plug#begin('~/.vim/plugged')
"Plug 'python-mode/python-mode', { 'for': 'python', 'branch': 'develop' }
Plug 'andymass/vim-matchup'
Plug 'voithos/vim-python-matchit'
Plug 'nvim-lualine/lualine.nvim'
Plug 'https://gitlab.com/code-stats/code-stats-vim.git'
"Plug 'dart-lang/dart-vim-plugin'
Plug 'preservim/nerdcommenter'
Plug 'junegunn/goyo.vim'
Plug 'fatih/vim-go'
Plug 'airblade/vim-gitgutter'
Plug 'pangloss/vim-javascript'
Plug 'kmyk/brainfuck-highlight.vim', { 'autoload' : { 'filetypes' : 'brainfuck' } }
Plug 'ryanoasis/vim-devicons'
Plug 'lervag/vimtex'
Plug 'terryma/vim-multiple-cursors'
Plug 'maxmellon/vim-jsx-pretty'
Plug 'justinmk/vim-sneak'
Plug 'elixir-editors/vim-elixir'
Plug 'jiangmiao/auto-pairs'
Plug 'tpope/vim-endwise'
Plug 'prettier/vim-prettier', { 'do': 'yarn install' }
Plug 'leafgarland/typescript-vim'
Plug 'habamax/vim-godot'
Plug 'nvim-tree/nvim-tree.lua'
" Lua
Plug 'euclidianAce/BetterLua.vim'
Plug 'folke/neodev.nvim'
Plug 'f-person/git-blame.nvim'
Plug 'f-person/auto-dark-mode.nvim'
Plug 'f-person/nvim-sort-dart-imports'
Plug 'f-person/pubspec-assist-nvim'
"Plug '/Users/fperson/workspace/personal_projects/git-blame.nvim'
" Plug '/Users/fperson/workspace/personal_projects/auto-dark-mode.nvim'
" Plug '/Users/fperson/workspace/personal_projects/pubspec-assist-nvim'
Plug 'neovim/nvim-lspconfig'
"Plug 'nvim-lua/completion-nvim'
Plug 'RishabhRD/popfix'
Plug 'RishabhRD/nvim-lsputils'
Plug 'catppuccin/nvim', { 'as': 'catppuccin' }
Plug 'nvim-lua/popup.nvim'
Plug 'nvim-lua/plenary.nvim'
"Plug 'nvim-telescope/telescope.nvim'
Plug 'blue-pitaya/telescope.nvim', { 'branch': 'full-diagnostic-message' }
Plug 'mhartington/formatter.nvim'
Plug 'jose-elias-alvarez/null-ls.nvim'
Plug 'jose-elias-alvarez/nvim-lsp-ts-utils'
Plug 'hrsh7th/cmp-nvim-lsp'
Plug 'hrsh7th/cmp-buffer'
Plug 'hrsh7th/cmp-path'
Plug 'hrsh7th/cmp-cmdline'
Plug 'hrsh7th/nvim-cmp'
Plug 'hrsh7th/cmp-vsnip'
Plug 'hrsh7th/vim-vsnip'
Plug 'github/copilot.vim'
Plug 'ckipp01/stylua-nvim'
Plug 'aznhe21/actions-preview.nvim'
Plug 'nvim-tree/nvim-web-devicons'
Plug 'folke/trouble.nvim'
"Plug '/Users/fperson/workspace/forks/trouble.nvim'
"Plug 'onsails/diaglist.nvim'
Plug 'akinsho/flutter-tools.nvim'
Plug 'HampusHauffman/block.nvim'
"Plug 'nvim-treesitter/nvim-treesitter', { 'commit': '33eb472b459f1d2bf49e16154726743ab3ca1c6d' , 'do': ':TSUpdate' }
Plug 'HiPhish/rainbow-delimiters.nvim'
Plug 'utilyre/barbecue.nvim'
Plug 'SmiteshP/nvim-navic'
Plug 'kkharji/sqlite.lua'
Plug 'danielfalk/smart-open.nvim'
call plug#end()
syntax on
let g:gruvbox_contrast_dark="hard"
let g:gruvbox_contrast_light="hard"
set colorcolumn=80,100
lang en_US.UTF-8
highlight link luaOperator Special
syntax on
set tabstop=4
set shiftwidth=4
filetype on
set nu
set ruler
set mouse=a
set showmatch
set number relativenumber
set splitbelow splitright
set encoding=utf-8
set clipboard+=unnamedplus
set updatetime=50
set hidden
" codestats config
source ~/.config/nvim/codestats_api_key.vim
nnoremap <leader>fa :FlutterRun<cr>
nnoremap <leader>fq :FlutterQuit<cr>
nnoremap <leader>fr :FlutterHotReload<cr>
nnoremap <leader>fR :FlutterHotRestart<cr>
map <leader>f<leader> :Goyo \| set linebreak<CR>
" exit terminal mode
tnoremap <Esc> <C-\><C-n>
" Ctrl+S to save
nmap <c-s> :w<CR>
imap <c-s> <Esc>:w<CR>a
" Alt+` to switch tab
nmap <m-`> :tabNext<CR>
imap <m-`> <Esc> :tabNext<CR>i
tnoremap <m-`> <C-\><C-n> :tabNext<CR>
nnoremap <leader>ph :GitGutterPreviewHunk<cr>
nmap <silent> <c-k> :wincmd k<CR>
nmap <silent> <c-j> :wincmd j<CR>
nmap <silent> <c-h> :wincmd h<CR>
nmap <silent> <c-l> :wincmd l<CR>
" Resize currently focused split with arrow keys
map <up> <C-w>+
map <down> <C-w>-
map <left> <C-w><
map <right> <C-w>>
" disabled keys
nnoremap <PageUp> <Nop>
nnoremap <PageDown> <Nop>
" o/O
" Start insert mode with [count] blank lines.
" The default behavior repeats the insertion [count]
" times, which is not so useful.
function! s:NewLineInsertExpr( isUndoCount, command )
if ! v:count
return a:command
endif
let l:reverse = { 'o': 'O', 'O' : 'o' }
" First insert a temporary '$' marker at the next line (which is necessary
" to keep the indent from the current line), then insert <count> empty lines
" in between. Finally, go back to the previously inserted temporary '$' and
" enter insert mode by substituting this character.
" Note: <C-\><C-n> prevents a move back into insert mode when triggered via
" |i_CTRL-O|.
return (a:isUndoCount && v:count ? "\<C-\>\<C-n>" : '') .
\ a:command . "$\<Esc>m`" .
\ v:count . l:reverse[a:command] . "\<Esc>" .
\ 'g``"_s'
endfunction
nnoremap <silent> <expr> o <SID>NewLineInsertExpr(1, 'o')
nnoremap <silent> <expr> O <SID>NewLineInsertExpr(1, 'O')
function GDScriptFormat()
silent !gdformat %:p
:e
endfunction
autocmd FileType gdscript :command! -buffer GDScriptFormat call GDScriptFormat()
" autoformat
"au BufWrite *.dart :DartFmt
augroup sortDartImports
autocmd!
autocmd BufWrite *.dart lua vim.lsp.buf.format()
"autocmd BufWrite *.dart :DartSortImports
augroup END
"autocmd FileType cpp au BufWritePost *cpp :FormatWrite
autocmd FileType javascript au BufWrite * :PrettierAsync
autocmd FileType typescript au BufWrite * :PrettierAsync
"autocmd FileType gdscript au BufWritePost *gd call GDScriptFormat()
autocmd FileType python map <leader>b<leader> :w !python3 %:p <CR>
autocmd FileType dart map <leader>b<leader> :w !dart %:p <CR>
"autocmd FileType lua au BufWritePost *lua :lua require("stylua-nvim").format_file()
" go config
nmap <c-g> :GoImports<CR>
imap <c-g> <Esc>:GoImports<CR>a
let g:go_code_completion_enabled = 0
let g:go_highlight_extra_types = 1
let g:go_highlight_functions = 1
let g:go_highlight_function_parameters = 1
let g:go_highlight_function_calls = 1
let g:go_highlight_types = 1
let g:go_highlight_fields = 1
let g:go_gopls_options=['-remote=auto']
"let g:go_fmt_command = "golines"
"let g:go_fmt_options = {
"\ 'golines': '-m 80 --base-formatter gofmtrlx',
"\ }
autocmd FileType dart set expandtab
autocmd FileType dart set tabstop=2
autocmd FileType dart set shiftwidth=2
autocmd FileType cpp set expandtab
autocmd FileType cpp set tabstop=2
autocmd FileType cpp set shiftwidth=2
autocmd FileType json set expandtab
autocmd FileType json set tabstop=2
autocmd FileType json set shiftwidth=2
autocmd FileType yaml set expandtab
autocmd FileType yaml set tabstop=2
autocmd FileType yaml set shiftwidth=2
autocmd FileType lua set expandtab
if ! has('gui_running')
set ttimeoutlen=10
augroup FastEscape
autocmd!
au InsertEnter * set timeoutlen=0
au InsertLeave * set timeoutlen=1000
augroup END
endif
" icons
let g:webdevicons_enable = 1
" Use <Tab> and <S-Tab> to navigate through popup menu
inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"
" Set completeopt to have a better completion experience
set completeopt=menuone,noinsert,noselect
" Avoid showing message extra message when using completion
set shortmess+=c
let g:completion_matching_ignore_case = 1
function! s:check_back_space() abort
let col = col('.') - 1
return !col || getline('.')[col - 1] =~ '\s'
endfunction
augroup highlight_yank
autocmd!
autocmd TextYankPost * silent! lua require'vim.highlight'.on_yank()
augroup END
let g:tex_flavor = 'latex'
autocmd FileType lua let g:completion_confirm_key = "\<C-Y>"
autocmd FileType markdown nmap j gj
autocmd FileType markdown nmap k gk
imap <silent><script><expr> <C-J> copilot#Accept("\<CR>")
imap <silent><script><expr> <C-F> copilot#Accept("\<CR>")
let g:copilot_no_tab_map = v:true
imap <silent><script><expr> <C-S-I> copilot#Suggest()
map <C-U> <C-Y><C-Y><C-Y><C-Y><C-Y><C-Y><C-Y><C-Y><C-Y><C-Y><C-Y><C-Y><C-Y><C-Y><C-Y><C-Y>
map <C-D> <C-E><C-E><C-E><C-E><C-E><C-E><C-E><C-E><C-E><C-E><C-E><C-E><C-E><C-E><C-E><C-E>