-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit.vim
More file actions
301 lines (250 loc) · 7.58 KB
/
Copy pathinit.vim
File metadata and controls
301 lines (250 loc) · 7.58 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
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
290
291
292
293
294
295
296
297
298
299
300
301
" vim:foldmethod=marker:foldlevel=0
" zo + zc to open / close folds
" PLUG {{{
call plug#begin('~/.config/nvim/plugged')
function! DoRemote(arg)
UpdateRemotePlugins
endfunction
"Plug 'Shougo/deoplete.nvim', { 'do': function('DoRemote') }
Plug 'tomtom/tcomment_vim' " gc comments
Plug 'airblade/vim-gitgutter'
Plug 'w0rp/ale'
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
"Old
Plug 'mg979/vim-visual-multi'
Plug 'morhetz/gruvbox'
Plug 'instant-markdown/vim-instant-markdown'
Plug 'jiangmiao/auto-pairs'
Plug 'mxw/vim-jsx'
Plug 'hadolint/hadolint'
Plug 'ixru/nvim-markdown'
"Plug 'itchyny/lightline.vim'
"Plug 'github/copilot.vim'
"Markdown
" Declared once only: a second, bare `Plug` for the same repo would override
" this one and silently drop the ':TSUpdate' hook. Parsers must be updated in
" lockstep with the plugin, so losing that hook breaks highlighting on update.
Plug 'nvim-treesitter/nvim-treesitter', {'branch': 'main', 'do': ':TSUpdate'}
Plug 'tree-sitter-grammars/tree-sitter-markdown'
Plug 'HakonHarnes/img-clip.nvim'
"Plug 'tadmccorkle/markdown.nvim'
Plug 'https://github.com/MeanderingProgrammer/render-markdown.nvim'
"SystemVerilog Plugins
Plug 'wbthomason/packer.nvim'
Plug 'hrsh7th/nvim-cmp'
Plug 'hrsh7th/cmp-buffer'
Plug 'hrsh7th/cmp-path'
Plug 'hrsh7th/cmp-cmdline'
Plug 'saadparwaiz1/cmp_luasnip'
Plug 'hrsh7th/cmp-nvim-lsp'
Plug 'hrsh7th/cmp-nvim-lua'
Plug 'neovim/nvim-lspconfig'
Plug 'jose-elias-alvarez/null-ls.nvim'
Plug 'https://codeberg.org/Guilty/VerilogImproved'
"telescope
Plug 'nvim-lua/plenary.nvim'
Plug 'BurntSushi/ripgrep'
Plug 'nvim-telescope/telescope.nvim'
Plug 'sharkdp/fd'
Plug 'nvim-tree/nvim-web-devicons'
" FZF / Ctrlp for file navigation
if executable('fzf')
" OSX vs Linux loading (depending on where fzf is)
let s:uname = system("echo -n \"$(uname)\"")
if !v:shell_error && s:uname == "Darwin"
Plug '/opt/homebrew/bin/fzf'
else
Plug 'junegunn/fzf', {'dir': '~/.local/src/fzf', 'do': './install --all' }
endif
Plug 'junegunn/fzf.vim'
else
Plug 'ctrlpvim/ctrlp.vim'
endif
Plug 'junegunn/fzf', {'dir': '~/.local/src/fzf', 'do': './install --all' }
call plug#end()
"lua require('markdown').setup()
" }}}
" LOOK AND SYNTAX HILIGHTING {{{
set t_Co=256
syntax off
highlight Normal ctermbg=233
colorscheme nnkd
" whitespace
" highlight ExtraWhitespace ctermbg=red guibg=red
" autocmd Syntax * syn match ExtraWhitespace /\s\+$/ containedin=ALL
" Undefined Marks
highlight UndefinedMarks ctermfg=yellow
autocmd Syntax * syn match UndefinedMarks /???/ containedin=ALL
" Automatic syntax highlighting for files
au BufRead,BufNewFile *.sbt set filetype=scala
au BufRead,BufNewFile *.conf set filetype=dosini
au BufRead,BufNewFile *.bash* set filetype=sh
au BufRead,BufNewFile *.jsonnet* set filetype=c
au BufRead,BufNewFile *.libsonnet* set filetype=c
au BufRead,BufNewFile todo* set filetype=todo
au BufRead,BufNewFile *.txt set filetype=todo
au BufRead,BufNewFile *.pp set filetype=puppet
" Automatically disable ALE for C files
autocmd FileType C ALEDisable
" Better split character
" Override color scheme to make split them black
" set fillchars=vert:\|
set fillchars=vert:│
set colorcolumn=101
set cursorline
"My changes
highlight LineNr ctermfg=grey
highlight CursorLineNr cterm=bold
" treesitter
" nvim-treesitter is on its `main` branch, which dropped the old
" `nvim-treesitter.configs` module: parsers are installed explicitly and
" highlighting is turned on per-filetype by Neovim itself.
lua << EOF
require('nvim-treesitter').setup {}
local parsers = {
'c', 'cpp', 'lua', 'python', 'javascript', 'html', 'css',
'markdown', 'markdown_inline',
}
-- Asynchronous, and a no-op once the parsers are present.
require('nvim-treesitter').install(parsers)
vim.api.nvim_create_autocmd('FileType', {
pattern = {
'c', 'cpp', 'lua', 'python', 'javascript', 'javascriptreact',
'html', 'css', 'markdown',
},
callback = function() pcall(vim.treesitter.start) end,
})
EOF
" }}}
" KEYMAPPINGS {{{
" Leader key
let mapleader = ","
" arrow keys disable
nnoremap <right> <nop>
nnoremap <down> <nop>
nnoremap <left> <nop>
nnoremap <up> <nop>
vnoremap <right> <nop>
vnoremap <down> <nop>
vnoremap <left> <nop>
vnoremap <up> <nop>
" j/k move virtual lines, gj/jk move physical lines
" noremap <silent> <expr> j (v:count == 0 ? 'gj' : 'j')
" noremap <silent> <expr> k (v:count == 0 ? 'gk' : 'k')
" Remap increment and decrement numbers to something that works on macs/linux
" nnoremap <A-a> <C-a>
" nnoremap <A-x> <C-x>
" panes
nnoremap <leader>d :vsp<cr>
set splitright
nnoremap <leader>s :split<cr>
set splitbelow
" map <C-w>w (switch buffer focus) to something nicer
nnoremap <leader>w <C-w>w
" tabs
nnoremap <leader>] :tabn<cr>
nnoremap <leader>[ :tabp<cr>
nnoremap <leader>T :tabe<cr>
" Insert date
nnoremap <leader>fd "=strftime("%m-%d-%y")<CR>p
" Edit vimrc
nnoremap <leader>ev :edit $MYVIMRC<cr>
nnoremap <leader>evs :source $MYVIMRC<cr>
" Toggle paste with F2
" set pastetoggle=<F2>
" Terminal Mode
" Use escape to go back to normal mode
tnoremap <Esc> <C-\><C-n>
" }}}
" BRACE COMPLETION {{{
set showmatch
" inoremap { {}<Left>
" inoremap {<CR> {<CR>}<Esc>O
" inoremap <expr> } strpart(getline('.'), col('.')-1, 1) == "}" ? "\<Right>" : "}"
" inoremap {} {}
"
" inoremap ( ()<Left>
" inoremap (<CR> (<CR>)<Esc>O
" inoremap <expr> ) strpart(getline('.'), col('.')-1, 1) == ")" ? "\<Right>" : ")"
" inoremap () ()
"
" inoremap [ []<Left>
" inoremap [<CR> [<CR>]<Esc>O
" inoremap <expr> ] strpart(getline('.'), col('.')-1, 1) == "]" ? "\<Right>" : "]"
" inoremap [] []
" }}}
" GENERAL/TOGGLEABLE SETTINGS {{{
" horizontal split splits below
set splitbelow
" indentation
set tabstop=4
set shiftwidth=4
set softtabstop=4
set expandtab
set autoindent
filetype indent off
au BufNewFile,BufRead *.py
\ setlocal tabstop=4
\ shiftwidth=4
\ softtabstop=4
\ autoindent
\ expandtab
" line numbers
set number
" set relativenumber
" show title
set title
" mouse
set mouse-=a
" utf-8 ftw
" nvim sets utf8 by default, wrap in if because prevents reloading vimrc
if !has('nvim')
set encoding=utf-8
endif
" Ignore case unless use a capital in search (smartcase needs ignore set)
set ignorecase
set smartcase
" }}}
" PLUGINS + CUSTOM FUNCTIONS {{{
" Custom
source ~/.config/nvim/custom/functions.vim
nnoremap <leader>t :call ToggleTodo()<cr>
vnoremap <leader>t :call ToggleTodo()<cr>
" deoplete
let g:deoplete#enable_at_startup=1
inoremap <silent><expr> <Tab> pumvisible() ? "\<C-n>" : "\<C-i>"
" Ripgrep for search
if executable('rg')
set grepprg=rg\ -i\ --vimgrep
" Ripgrep on /
command! -nargs=+ -complete=file -bar Rg silent! grep! <args>|cwindow|redraw!
nnoremap <leader>/ :Rg<SPACE>
endif
" airline
set laststatus=2
" FZF
if executable('rg')
let $FZF_DEFAULT_COMMAND = 'rg --files --no-messages "" .'
set grepprg=rg\ --vimgrep
endif
let g:fzf_command_prefix = 'Fzf'
if executable('fzf')
nnoremap <leader>v :FzfFiles<cr>
nnoremap <leader>u :FzfTags<cr>
nnoremap <leader>j :call fzf#vim#tags("'".expand('<cword>'))<cr>
if executable('rg')
" :Find <term> runs `rg <term>` and passes it to fzf
command! -bang -nargs=* Find call fzf#vim#grep('rg --column --line-number --no-heading --fixed-strings --ignore-case --color "always" '.shellescape(<q-args>), 1, <bang>0)
nnoremap <leader>/ :Find
nnoremap <leader>' :execute "Find " . expand("<cword>")<cr>
endif
else
nnoremap <leader>v :CtrlP<Space><cr>
endif
" ALE
let g:ale_linters = {'go': ['golint', 'gofmt']}
let g:ale_lint_delay = 800
nmap <silent> <C-k> <Plug>(ale_previous_wrap)
nmap <silent> <C-j> <Plug>(ale_next_wrap)
" }}}y