" *** *** *** Global Settings *** *** *** " *************************************** set expandtab set autowrite set showbreak=↪ set ignorecase set smartcase set list set listchars=tab:▸\ ,trail:·,nbsp:.,extends:❯,precedes:❮ set visualbell set termguicolors set number set relativenumber set backspace=indent,eol,start " Intuitive backspacing set hidden set iskeyword+=- " Add dashes to words set cpoptions+=$ " Don't delete the word, but put a $ to the end till exit the mode set title set shortmess=caoOtI " Welcome screen set tabstop=2 set shiftwidth=2 set softtabstop=2 set expandtab set copyindent set shiftround set mouse=a set clipboard=unnamedplus set nowrap set confirm set spelllang=de_de,en_us set timeoutlen=500 set signcolumn=yes:2 set foldmethod=syntax set splitbelow set splitright set scrolloff=8 set sidescrolloff=8 set virtualedit=all set cursorline set path+=** set nobackup set nowritebackup set noswapfile set undofile set redrawtime=10000 " Allow more time for loading syntax on large files set complete+=i,k,s,kspell set wildmode=longest:full,full " Spell Checker set spellfile+=~/.config/nvim/spell/de.utf-8.add " (1)zg, (1)zw set spellfile+=~/.vim/spell/en.utf-8.add " 2zg, 2zw " Custom Dictionaries ( ) set dictionary+=~/.config/nvim/dictionary/de_user.txt set dictionary+=~/.config/nvim/dictionary/de_neu.txt set dictionary+=~/.config/nvim/dictionary/en_us.txt " Custom Thesauri (Synonyms) ( ) set thesaurus+=~/.config/nvim/thesaurus/de_user.txt set thesaurus+=~/.config/nvim/thesaurus/de_openthesaurus.txt " *** *** *** Key Mappings *** *** *** " ************************************ let mapleader = "\" " Quick toggle between buffers noremap j :b# " Add semicolon or comma to the end of the line nnoremap ;; A; nnoremap ,, A, " Maintain the cursor position when yanking a visual selection vnoremap y myy`y vnoremap Y myY`y " Delete last character of line nnoremap x $x " Open vim config in a new buffer, reload vim config nnoremap ve :e $MYVIMRC nnoremap vr :source $MYVIMRC " Delete all buffers nnoremap da :bufdo bdelete " Allow gf to open non-existent files map gf :edit " Reselect visual selection after indenting vnoremap < >gv " Set spell checker to `s` " zg (good), zG (good temp), zw (wrong), zW (wrong temp) nnoremap s :set spell! " Switch off highlighting nnoremap h :nohlsearch " Toogle list nnoremap l :set list! " Indent the whole source code nnoremap ff gg=G'' " Reverse the mark mapping nnoremap ' ` nnoremap ` ' " Visuall select of just pasted content nnoremap gp `[v`] nnoremap gy `[v`]y " When text is wrapped, move by terminal rows, not lines, unless a count is provided noremap j (v:count == 0 ? 'gj' : 'j') noremap k (v:count == 0 ? 'gk' : 'k') " Open a quickfix window for the last search nnoremap ? :execute 'vimgrep /'.@/.'/g %':copen " Faster linewise scrolling noremap 3 noremap 3 " Keep the window centered noremap G Gzzzv noremap n nzzzv noremap N Nzzzv noremap } }zzzv noremap { {zzzv " Close all buffers nnoremap XX :qa " Add lines in NORMAL Mode nnoremap gn ok nnoremap gN Oj " Change to the folder of the current file nnoremap cf :cd %:p:h:pwd " Quickfix Window nnoremap qo :copen nnoremap qc :cclose " Exit INSERT MODE with 'jk' inoremap jj " Reformat a line into a block nnoremap q gqip " Reformat a block into a line nnoremap qq vipJ " Easier split navigation nnoremap nnoremap nnoremap nnoremap " *** *** *** Functions *** *** *** " ********************************* " Toggle between soft wrap and no wrap nnoremap tw :call ToggleWrap() function! ToggleWrap() if &wrap echo "Wrap OFF" set nowrap set nolinebreak set virtualedit=all else echo "Wrap ON" set wrap set linebreak set virtualedit= setlocal display+=lastline endif endfunction " *** *** *** Plugins *** *** *** " ******************************* " Automatically install vim-plug 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 * PlugInstall --sync | source $MYVIMRC endif call plug#begin(data_dir . '/plugins') source ~/.config/nvim/plugins/base16-vim.vim call plug#end() doautocmd User PlugLoaded