let mapleader=" " " Basic stuff set mouse=a set nocompatible set nohlsearch filetype plugin on syntax on set encoding=utf-8 set number set termguicolors set splitbelow splitright set scrolloff=5 " coc specific set updatetime=300 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' \ | exe "normal! g`\"" \ | endif " Enable spell checking, s for spell check map se :setlocal spell! spelllang=en map sr :setlocal spell! spelllang=ro " ### " # Plugins " ### call plug#begin('~/.local/share/nvim/plugged') " REMINDER - some plugins have the following external dependencies " hexokinase(color preview): go " coc(code completion): nodejs, yarn """ TODO write here what to do to install the C syntax server and watnot " vimdiscord: nvim installed from pip (python extension thingy) "Plug 'vbe0201/vimdiscord' Plug 'rrethy/vim-hexokinase', { 'do': 'make hexokinase' } Plug 'vimwiki/vimwiki' "Plug 'franbach/miramare' Plug 'cocopon/iceberg.vim' Plug 'patstockwell/vim-monokai-tasty' Plug 'antoinemadec/FixCursorHold.nvim' Plug 'lambdalisue/fern.vim' Plug 'neoclide/coc.nvim', {'branch': 'release'} call plug#end() colorscheme iceberg " hexokinase let g:Hexokinase_refreshEvents = ['InsertLeave'] 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 f :Fern . -drawer -toggle function! s:init_fern() abort nmap H (fern-action-open:split) nmap V (fern-action-open:vsplit) nmap R (fern-action-rename) nmap M (fern-action-move) nmap C (fern-action-copy) "nmap N (fern-action-new-path) nmap T (fern-action-new-file) nmap D (fern-action-new-dir) nmap S (fern-action-hidden-toggle) nmap dd (fern-action-trash) nmap m (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('%'), )) " ### " # Key Remapping " ### " Reload this config file map :source ~/.config/nvim/init.vim nnoremap e :Ex " Easier Write and Quit aliases "nnoremap q :CocCommand cord.disconnect:q nnoremap q :q nnoremap Q :wq nnoremap w :w " Split navigation with leader key nnoremap h h nnoremap j j nnoremap k k nnoremap l l " Make adjusing split sizes a bit more friendly noremap :vertical resize +3 noremap :vertical resize -3 noremap :resize +3 noremap :resize -3 " New splits nnoremap sv :Vex nnoremap sh :Sex nnoremap t :24sp:term:startinsert nnoremap cc :CompileAndRun " exit insert mode in terminal easier tnoremap tnoremap h tnoremap j tnoremap k tnoremap l inoremap h inoremap j inoremap k inoremap l nnoremap h nnoremap j nnoremap k nnoremap l " COC "" Use tab for trigger completion with characters ahead and navigate. "inoremap " \ pumvisible() ? "\" : " \ check_back_space() ? "\" : " \ coc#refresh() "inoremap pumvisible() ? "\" : "\" " "function! s:check_back_space() abort " let col = col('.') - 1 " return !col || getline('.')[col - 1] =~# '\s' "endfunction " "" Use to trigger completion. "if has('nvim') " inoremap coc#refresh() "else " inoremap coc#refresh() "endif " "" Make auto-select the first completion item and notify coc.nvim to "" format on enter, could be remapped by other vim plugin "inoremap pumvisible() ? coc#_select_confirm() " \: (((add a double quote here after uncommenting this)\u\\=coc#on_enter()\"