much stuff

This commit is contained in:
Cheri 2020-11-05 10:26:43 +02:00 committed by vibikim
parent 1e3eb0215f
commit af221b79fa
6 changed files with 149 additions and 38 deletions

View file

@ -13,6 +13,10 @@ set splitbelow splitright
set cursorline
" Netrw settings
let g:netrw_liststyle = 0
let g:netrw_banner = 0
" restore cursor to the last position after reopening a file
autocmd BufReadPost *
\ if line("'\"") >= 1 && line("'\"") <= line("$") && &ft !~# 'commit'
@ -28,10 +32,15 @@ map <leader>sr :setlocal spell! spelllang=ro<CR>
" ###
call plug#begin('~/.local/share/nvim/plugged')
" REMINDER - on a new system install go for hexokinase (color preview)
" REMINDER - some plugins have the following external dependencies
" hexokinase(color preview): go
" coc(code completion): nodejs, yarn
Plug 'rrethy/vim-hexokinase', { 'do': 'make hexokinase' }
Plug 'vimwiki/vimwiki'
Plug 'franbach/miramare'
Plug 'antoinemadec/FixCursorHold.nvim'
Plug 'lambdalisue/fern.vim'
Plug 'neoclide/coc.nvim', {'branch': 'release'}
call plug#end()
@ -44,6 +53,45 @@ let g:Hexokinase_highlighters = ['backgroundfull']
autocmd VimEnter * HexokinaseTurnOn
" ###
" # Fern -- sidebar file manager
" ###
let g:fern#drawer_width = 30
let g:fern#default_hidden = 1
let g:fern#disable_drawer_auto_quit = 1
""" KEYBIND TO TOGGLE FERN
noremap <leader>f :Fern . -drawer -toggle <CR>
function! s:init_fern() abort
nmap <buffer> H <Plug>(fern-action-open:split)
nmap <buffer> V <Plug>(fern-action-open:vsplit)
nmap <buffer> R <Plug>(fern-action-rename)
nmap <buffer> M <Plug>(fern-action-move)
nmap <buffer> C <Plug>(fern-action-copy)
"nmap <buffer> N <Plug>(fern-action-new-path)
nmap <buffer> T <Plug>(fern-action-new-file)
nmap <buffer> D <Plug>(fern-action-new-dir)
nmap <buffer> S <Plug>(fern-action-hidden-toggle)
nmap <buffer> dd <Plug>(fern-action-trash)
nmap <buffer> m <Plug>(fern-action-mark)
endfunction
augroup fern-custom
autocmd! *
autocmd FileType fern call s:init_fern()
augroup END
""" C Compiler!
function! TermWrapper(command) abort
exec '20sp '
exec 'term ' . a:command
exec 'startinsert'
endfunction
command! -nargs=0 CompileAndRun call TermWrapper(printf('gcc -lm %s && ./a.out', expand('%'), <args>))
" ###
" # Key Remapping
" ###
@ -53,7 +101,8 @@ map <C-s> :source ~/.config/nvim/init.vim<CR>
nnoremap <leader>e :Ex<CR>
" Easier Write and Quit aliases
nnoremap <leader>q :q<CR>
"nnoremap <silent> <leader>q :CocCommand cord.disconnect<CR>:q<CR>
nnoremap <silent> <leader>q :q<CR>
nnoremap <leader>Q :wq<CR>
nnoremap <leader>w :w<CR>
@ -64,16 +113,29 @@ nnoremap <leader>k <C-w>k
nnoremap <leader>l <C-w>l
" Make adjusing split sizes a bit more friendly
noremap <silent> <C-Left> :vertical resize +3<CR>
noremap <silent> <C-Right> :vertical resize -3<CR>
noremap <silent> <C-Up> :resize +3<CR>
noremap <silent> <C-Down> :resize -3<CR>
noremap <silent> <C-h> :vertical resize +3<CR>
noremap <silent> <C-l> :vertical resize -3<CR>
noremap <silent> <C-k> :resize +3<CR>
noremap <silent> <C-j> :resize -3<CR>
" New splits
nnoremap <leader>sv :Vex<CR>
nnoremap <leader>sh :Sex<CR>
nnoremap <leader>t :24sp<CR>:term<CR>:startinsert<CR>
nnoremap <leader>cc :CompileAndRun<CR>
" exit insert mode in terminal easier
tnoremap <C-\> <C-\><C-N>
tnoremap <A-k> <C-w>k
tnoremap <A-h> <C-\><C-N><C-w>h
tnoremap <A-j> <C-\><C-N><C-w>j
tnoremap <A-k> <C-\><C-N><C-w>k
tnoremap <A-l> <C-\><C-N><C-w>l
inoremap <A-h> <C-\><C-N><C-w>h
inoremap <A-j> <C-\><C-N><C-w>j
inoremap <A-k> <C-\><C-N><C-w>k
inoremap <A-l> <C-\><C-N><C-w>l
nnoremap <A-h> <C-w>h
nnoremap <A-j> <C-w>j
nnoremap <A-k> <C-w>k
nnoremap <A-l> <C-w>l