" NEOVIM SETTINGS - settings regarding Neovim itself " Set leader key to comma, since the default sucks for nordic keyboards let mapleader = ',' " This setting makes search case-insensitive when all characters in the string " being searched are lowercase. However, the search becomes case-sensitive if " it contains any capital letters. This makes searching more convenient. set ignorecase set smartcase " Enable searching as you type, rather than waiting till you press enter. set incsearch " Always show 4 lines above and below the cursor set scrolloff=4 " Allow using uppercase :W to save command W call VSCodeCall('workbench.action.files.save') " Press Enter to clear search highlighting nnoremap :nohlsearch " Make yank use system clipboard as default :nnoremap y (v:register ==# '"' ? '"+' : '') . 'y' :nnoremap yy (v:register ==# '"' ? '"+' : '') . 'yy' :nnoremap Y (v:register ==# '"' ? '"+' : '') . 'Y' :xnoremap y (v:register ==# '"' ? '"+' : '') . 'y' :xnoremap Y (v:register ==# '"' ? '"+' : '') . 'Y' " Map 'gp' to paste from system clipboard :nnoremap gp (v:register ==# '"' ? '"+' : '') . 'p' :nnoremap gP (v:register ==# '"' ? '"+' : '') . 'P' :xnoremap gp (v:register ==# '"' ? '"+' : '') . 'p' :xnoremap gP (v:register ==# '"' ? '"+' : '') . 'P' " Map leader bindings to VSCode commands nnoremap p call VSCodeNotify('workbench.action.quickOpen') nnoremap b call VSCodeNotify('workbench.action.showAllEditors') nnoremap o call VSCodeNotify('workbench.action.quickOpen') nnoremap f call VSCodeNotify('workbench.action.findInFiles') nnoremap : call VSCodeNotify('workbench.action.showCommands') nnoremap c call VSCodeNotify('workbench.action.showCommands') nnoremap d call VSCodeNotify('workbench.view.scm') nnoremap n call VSCodeNotify('workbench.action.toggleSidebarVisibility') nnoremap rn call VSCodeNotify('editor.action.rename') xnoremap gc call VSCodeNotify('editor.action.commentLine') nnoremap gc call VSCodeNotify('editor.action.commentLine') nnoremap gcc call VSCodeNotify('editor.action.commentLine') xnoremap gb call VSCodeNotify('editor.action.blockComment') nnoremap gb call VSCodeNotify('editor.action.blockComment') " PLUGINS - installation and configuration " Install Plug (plugin manager) if not already installed let data_dir = has('nvim') ? stdpath('data') . '/site' : '~/.vim' if empty(glob(data_dir . '/autoload/plug.vim')) silent execute '!curl -fLo '.data_dir.'/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim' autocmd VimEnter * q endif " Install plugins automatically when launching Neovim autocmd VimEnter * if len(filter(values(g:plugs), '!isdirectory(v:val.dir)')) \| PlugInstall --sync | source $MYVIMRC \| endif " Fetch plugins with Plug call plug#begin() " Easy handling of surroundings (tags, brackets etc.) Plug 'tpope/vim-surround' " End of plugin fetching call plug#end() " Fix for output panel opening on search set shortmess+=s " Fix for hanging in VSCode set re=0