dot_testing/nvim/init.vim

103 lines
2.1 KiB
VimL
Raw Normal View History

2021-05-09 19:04:25 -05:00
" randomuser's vimrc
2022-03-31 12:05:22 -05:00
" vim-plug {{{
call plug#begin()
Plug 'honza/vim-snippets'
Plug 'sirver/ultisnips'
2022-06-07 23:43:31 -05:00
Plug 'tridactyl/vim-tridactyl'
Plug 'chrisbra/csv.vim'
Plug 'trapd00r/vimpoint'
2022-06-13 13:58:42 -05:00
Plug 'vimwiki/vimwiki'
2022-03-31 12:05:22 -05:00
cal plug#end()
" }}}
2021-05-09 19:04:25 -05:00
2022-03-31 12:05:22 -05:00
" misc {{{
2021-05-09 19:04:25 -05:00
nnoremap ; :
nnoremap : ;
2022-03-30 20:55:31 -05:00
let mapleader = " "
2022-03-31 12:05:22 -05:00
set nocompatible
" }}}
2022-03-30 20:55:31 -05:00
2022-03-31 12:05:22 -05:00
" defined settings {{{
2021-05-09 19:04:25 -05:00
set number
2022-03-31 12:05:22 -05:00
set foldmethod=marker
2022-03-30 20:55:31 -05:00
set encoding=utf8
2022-03-30 21:45:56 -05:00
set list
2022-03-30 20:55:31 -05:00
set lcs=tab:->,trail:_,eol:^
set clipboard=unnamedplus
2022-03-30 21:45:56 -05:00
set spell
set spelllang=en_us
2022-06-07 23:43:31 -05:00
set title
2022-06-13 13:58:42 -05:00
set ts=2
set sw=2
set hlsearch
set incsearch
set ignorecase
set smartcase
2022-03-30 20:55:31 -05:00
colorscheme earth
2022-03-31 12:05:22 -05:00
" }}}
2022-03-30 20:55:31 -05:00
2022-03-30 21:45:56 -05:00
" shortcuts {{{
" toggle line numbers and listchars
2022-03-30 20:55:31 -05:00
nnoremap <Leader>ym :set number!<CR>:set list!<CR>
2022-03-30 21:45:56 -05:00
" vimrc thing
2022-03-30 20:55:31 -05:00
nnoremap <Leader>rr :source ~/.config/nvim/init.vim<CR>
nnoremap <Leader>re :edit ~/.config/nvim/init.vim<CR>
2022-03-30 21:45:56 -05:00
" show the file explorer
nnoremap <Leader>fs :Lexplore<CR>
" show the shortcuts in the vimrc
2022-03-31 12:05:22 -05:00
nnoremap <Leader>ke :e ~/.config/nvim/init.vim <CR>ggzR/shortcuts<CR>z<CR>
2022-03-30 21:45:56 -05:00
" jk to escape insert mode
2022-03-30 20:55:31 -05:00
inoremap jk <esc>
inoremap <esc> <esc>:echo "use jk instead!"<CR>2gsi
2022-03-30 21:45:56 -05:00
" go back to the previous error, then correct
inoremap <C-d> <c-g>u<Esc>[s1z=`]a<c-g>u
inoremap <C-s> <Esc>zgi
nnoremap <C-s> zg
" }}}
2021-05-09 19:04:25 -05:00
2022-03-31 12:05:22 -05:00
" autocmds {{{
2022-03-30 20:55:31 -05:00
au Filetype python setl et ts=4 sw=4
2022-06-13 13:58:42 -05:00
function SwapExistsHandler()
silent !vim-swap-handler "%:p"
if v:shell_error == 0
let v:swapchoice='o'
return
elseif v:shell_error == 1
let v:swapchoice='o'
echom "The file has been opened read-only, as there is not another vim instance editing this file."
elseif v:shell_error == 127
echom "The vim-swap-handler command doesn't exist."
else
echom "An unknown error occurred."
endif
endfunction
autocmd SwapExists * call SwapExistsHandler()
2022-03-31 12:05:22 -05:00
" }}}
2021-05-09 19:04:25 -05:00
2022-03-31 12:05:22 -05:00
" statusline {{{
2022-03-30 20:55:31 -05:00
set statusline=%f
set statusline+=\
2022-06-13 13:58:42 -05:00
set statusline+=%r%m%q%h
2022-03-30 20:55:31 -05:00
set statusline+=%=
2022-06-13 13:58:42 -05:00
set statusline+=%y\ 0x%02B\ %04l:%03c:%03p
" }}}
" titlebar {{{
let &titlestring='%{expand("%:p")}'
2022-03-31 12:05:22 -05:00
" }}}
2022-03-30 21:45:56 -05:00
2022-03-31 12:05:22 -05:00
" netrw {{{
2022-03-30 21:45:56 -05:00
let g:netrw_banner=0
2022-03-31 12:05:22 -05:00
" }}}
" ultisnips {{{
let g:UltiSnipsExpandTrigger = '<tab>'
let g:UltiSnipsJumpForwardTrigger="<c-b>"
let g:UltiSnipsJumpBackwardTrigger="<c-z>"
" }}}