2022-07-04 21:39:27 -04:00
|
|
|
set tabstop=4 shiftwidth=4 noexpandtab relativenumber ai nu rnu nosmd ignorecase smartcase
|
2023-03-19 13:10:16 -04:00
|
|
|
set showtabline=0
|
2022-07-04 21:39:27 -04:00
|
|
|
set lazyredraw nocursorline ttyfast
|
2021-06-19 15:50:50 -04:00
|
|
|
|
2023-03-19 12:55:08 -04:00
|
|
|
let mapleader = ","
|
2022-12-10 11:45:48 -05:00
|
|
|
|
|
|
|
set shell=/bin/sh
|
|
|
|
|
2021-07-26 09:32:48 -04:00
|
|
|
hi Search cterm=NONE ctermfg=white ctermbg=blue
|
2021-08-24 21:36:54 -04:00
|
|
|
hi StatusLine ctermbg=NONE cterm=italic
|
|
|
|
|
|
|
|
autocmd InsertEnter * hi StatusLine cterm=bold
|
|
|
|
autocmd InsertLeave * hi StatusLine cterm=italic
|
2021-07-26 09:32:48 -04:00
|
|
|
|
2021-06-19 15:50:50 -04:00
|
|
|
highlight LineNr ctermfg=grey
|
2022-06-01 20:02:57 -04:00
|
|
|
|
2022-07-01 18:18:55 -04:00
|
|
|
" Disable highlighting when searching
|
2022-07-05 17:28:32 -04:00
|
|
|
nnoremap <silent> <esc> :noh<return><esc>
|
2022-06-28 21:14:41 -04:00
|
|
|
|
2022-07-01 18:18:55 -04:00
|
|
|
|
|
|
|
" NetRW
|
|
|
|
|
2022-06-28 21:14:41 -04:00
|
|
|
set splitbelow splitright
|
|
|
|
|
|
|
|
let g:netrw_banner = 0
|
|
|
|
let g:netrw_liststyle = 3
|
|
|
|
let g:netrw_browse_split = 4
|
|
|
|
let g:netrw_altv = 1
|
|
|
|
let g:netrw_winsize = 20
|
|
|
|
|
|
|
|
function! OpenNetRW()
|
2022-06-28 21:46:11 -04:00
|
|
|
Vexplore
|
2022-06-28 21:14:41 -04:00
|
|
|
endfunction
|
|
|
|
|
|
|
|
aug netrw_close
|
|
|
|
au!
|
|
|
|
au WinEnter * if winnr('$') == 1 && getbufvar(winbufnr(winnr()), "&filetype") == "netrw"|q|endif
|
|
|
|
aug END
|
2022-06-28 21:46:11 -04:00
|
|
|
|
2022-07-01 18:18:55 -04:00
|
|
|
nnoremap - :call OpenNetRW()<cr>
|
|
|
|
|
|
|
|
|
|
|
|
" gdb integration
|
|
|
|
|
|
|
|
let g:termdebug_popup = 0
|
2023-03-19 12:55:08 -04:00
|
|
|
let g:termdebug_wide = 50
|
2022-07-01 18:18:55 -04:00
|
|
|
|
2022-08-01 16:08:28 -04:00
|
|
|
" Enter insert mode automatically in terminal windows
|
|
|
|
"au BufEnter term://* startinsert
|
|
|
|
|
2022-07-01 18:18:55 -04:00
|
|
|
au BufEnter *.c,*.cpp,*.h,*.hpp packadd termdebug
|
2023-03-19 13:10:16 -04:00
|
|
|
au TermOpen * setlocal nonumber norelativenumber
|
2022-07-01 18:18:55 -04:00
|
|
|
|
2022-07-16 18:56:03 -04:00
|
|
|
tnoremap <silent> <esc> <c-\><c-n><c-\><c-n>
|
2023-03-19 12:55:08 -04:00
|
|
|
" start debugger
|
|
|
|
nnoremap <silent> <leader>dd :execute "Termdebug" $HOME .. "/.cache/termdebug/" .. expand("%:r")<cr>:Source<cr>
|
|
|
|
" compile
|
|
|
|
nnoremap <silent> <leader>dc :Source<cr>:w<cr>:execute "make ~/.cache/termdebug/" .. expand("%:r") .. " -f ~/.config/nvim/makefile"<cr>
|
|
|
|
" start, stop, continue forwards
|
|
|
|
nnoremap <silent> <leader>rs :Run<cr>
|
|
|
|
nnoremap <silent> <leader>rr :Stop<cr>
|
|
|
|
nnoremap <silent> <leader>rf :Continue<cr>
|
|
|
|
" clear, add breakpoints
|
|
|
|
nnoremap <silent> <leader>dsc :Clear<cr>
|
|
|
|
nnoremap <silent> <leader>dsf :Break<cr>
|
2022-07-09 18:57:36 -04:00
|
|
|
|
2022-08-01 16:08:28 -04:00
|
|
|
nnoremap <silent> <C-h> :vertical resize -5<cr>
|
|
|
|
nnoremap <silent> <C-l> :vertical resize +5<cr>
|
2022-07-05 17:28:32 -04:00
|
|
|
nnoremap <silent> <c-p> :Step<cr>
|
2022-07-09 18:57:36 -04:00
|
|
|
nnoremap <silent> <c-n> :Over<cr>
|
|
|
|
|
2023-03-19 12:55:08 -04:00
|
|
|
" quickfix window (after running make)
|
|
|
|
nnoremap <silent> <leader>dqf :tab cope<cr>
|
|
|
|
nnoremap <silent> <leader>df :tabNext<cr>
|
|
|
|
|
2022-07-09 18:57:36 -04:00
|
|
|
vnoremap <silent> K :'<,'>Evaluate<cr>
|
2022-12-10 11:45:48 -05:00
|
|
|
|
2023-03-19 12:55:08 -04:00
|
|
|
" tab, window management
|
|
|
|
nnoremap <C-j> <C-w>w
|
|
|
|
nnoremap <C-k> <C-w>W
|
|
|
|
" force exit (akin to ZZ, ZQ)
|
2023-03-19 13:10:16 -04:00
|
|
|
nnoremap <silent> ZF :qa!<cr>
|
2023-03-19 12:55:08 -04:00
|
|
|
|
2022-12-10 11:45:48 -05:00
|
|
|
" Plugins
|
|
|
|
|
2023-01-12 18:18:34 -05:00
|
|
|
" Run PlugInstall if there are missing plugins
|
2023-02-14 19:16:14 -05:00
|
|
|
" (disabled because it's kind of intense for weak devices)
|
|
|
|
"autocmd VimEnter * if len(filter(values(g:plugs), '!isdirectory(v:val.dir)'))
|
|
|
|
"\| PlugInstall --sync | source $MYVIMRC
|
|
|
|
"\| endif
|
|
|
|
|
2023-01-12 18:18:34 -05:00
|
|
|
|
2022-12-10 11:45:48 -05:00
|
|
|
call plug#begin()
|
|
|
|
|
|
|
|
filetype plugin indent on
|
|
|
|
|
|
|
|
Plug 'lervag/vimtex'
|
|
|
|
let g:vimtex_view_method = 'zathura'
|
|
|
|
let g:vimtex_compiler_method = 'latexmk'
|
|
|
|
set conceallevel=0
|
|
|
|
let g:tex_conceal='abdmg'
|
|
|
|
let g:vimtex_view_forward_search_on_start=1
|
|
|
|
let g:vimtex_compiler_latexmk = {
|
|
|
|
\ 'build_dir' : $HOME.'/.cache/latexmk/',
|
|
|
|
\ 'callback' : 1,
|
|
|
|
\ 'continuous' : 1,
|
|
|
|
\ 'executable' : 'latexmk',
|
|
|
|
\ 'hooks' : [],
|
|
|
|
\ 'options' : [
|
|
|
|
\ '-verbose',
|
|
|
|
\ '-file-line-error',
|
|
|
|
\ '-synctex=1',
|
|
|
|
\ '-interaction=nonstopmode',
|
|
|
|
\ ],
|
|
|
|
\}
|
|
|
|
|
2023-01-01 14:20:01 -05:00
|
|
|
" spellcheck
|
|
|
|
au BufEnter *.tex set spell spelllang=en_ca
|
|
|
|
|
2022-12-10 11:45:48 -05:00
|
|
|
" Autowrite in tex files
|
|
|
|
" au TextChanged,TextChangedI *.tex silent write
|
|
|
|
|
|
|
|
|
2023-01-20 20:27:07 -05:00
|
|
|
if has('python3')
|
|
|
|
Plug 'SirVer/ultisnips'
|
|
|
|
let g:UltiSnipsExpandTrigger="<c-m>"
|
|
|
|
let g:UltiSnipsJumpForwardTrigger="<c-m>"
|
|
|
|
let g:UltiSnipsJumpBackwardTrigger="<c-b>"
|
|
|
|
let g:UltiSnipsSnippetDirectories=[$HOME.'/.config/nvim/ultisnips/']
|
|
|
|
endif
|
2022-12-10 11:45:48 -05:00
|
|
|
|
2023-01-21 21:46:35 -05:00
|
|
|
Plug 'nvim-treesitter/nvim-treesitter'
|
|
|
|
|
2022-12-10 11:45:48 -05:00
|
|
|
call plug#end()
|
2023-01-21 21:46:35 -05:00
|
|
|
|
|
|
|
lua << EOF
|
|
|
|
require'nvim-treesitter.configs'.setup {
|
2023-02-14 19:03:17 -05:00
|
|
|
ensure_installed = { "c", "cpp", "javascript", "python", "vim", "latex", "fish", "bash" },
|
2023-01-21 21:46:35 -05:00
|
|
|
sync_install = false,
|
|
|
|
auto_install = false,
|
|
|
|
highlight = {
|
|
|
|
enable = true,
|
|
|
|
|
|
|
|
disable = function(lang, buf)
|
|
|
|
local max_filesize = 100 * 1024 -- 100 KB
|
|
|
|
local ok, stats = pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(buf))
|
|
|
|
if ok and stats and stats.size > max_filesize then
|
|
|
|
return true
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
EOF
|
2023-01-22 15:40:46 -05:00
|
|
|
|
|
|
|
" Code folding
|
2023-02-03 13:11:37 -05:00
|
|
|
"set foldmethod=expr
|
2023-01-22 15:40:46 -05:00
|
|
|
set foldexpr=nvim_treesitter#foldexpr()
|
2023-02-03 13:11:37 -05:00
|
|
|
"autocmd BufEnter * normal zR
|