From 4ed8ae198dbda377a83b8fdfeea2f1ba9477a9cb Mon Sep 17 00:00:00 2001 From: templis Date: Thu, 2 Aug 2018 13:48:23 +0200 Subject: [PATCH] many changes in neovim init.vim --- .config/nvim/init.vim | 78 +++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 75 insertions(+), 3 deletions(-) diff --git a/.config/nvim/init.vim b/.config/nvim/init.vim index dab26a3..515c7d0 100644 --- a/.config/nvim/init.vim +++ b/.config/nvim/init.vim @@ -9,6 +9,10 @@ call plug#begin('~/.config/nvim/plugged') Plug 'morhetz/gruvbox' " neomake is a code linting tool that runs in the background. Plug 'neomake/neomake' + "autocompletion Plugin for Code autocomplete + Plug 'zchee/deoplete-jedi' + " Left side File Tree + "Plug 'scrooloose/nerdtree' " install with nvim +PlugInstall +qall " update with nvim +PlugUpgrade +PlugUpdate +PlugClean +qall " you can also update it in nvim with syntax autocompletion and stuff - simply @@ -25,8 +29,9 @@ let mapleader="\" set nocindent " I indent my code myself. "set smartindent " Or I let the smartindent take care of it. set breakindent " Indent line-breaks at the same level as code. - set ttimeoutlen=100 + set fileencoding=utf-8 + set fileencodings=utf-8,gbk,chinese,cp936,gb18030,utf-16le,utf-16,big5,euc-jp,euc-kr,latin-1 " } " Search { @@ -40,6 +45,14 @@ let mapleader="\" endif " } +" Spellcorrection { + setlocal spell spelllang=en_us + "setlocal spell spelllang=de_20 + map :setlocal spell spelllang=de_20 + map :setlocal spell spelllang=en_us + map :w!:!aspell check %:e! % + + " Formatting { set showmatch " Show matching brackets. set number " Show the line numbers on the left side. @@ -134,6 +147,13 @@ let mapleader="\" " Toggle between normal and relative numbering. nnoremap r :call NumberToggle() + + " Opaque Background (Comment out to use terminal's profile) + "set termguicolors + + " Transparent Background (For i3 and compton) + "highlight Normal guibg=NONE ctermbg=NONE + "highlight LineNr guibg=NONE ctermbg=NONE " } " Keybindings { @@ -149,8 +169,35 @@ let mapleader="\" vmap P "+P " Move between buffers - nmap l :bnext nmap h :bprevious + + " Switch between Buffers + map j_ + map k_ + map h_ + map l_ + + " Switch between tabs + map :tabprevious + map :tabnext + + " Go to tab by number + noremap 1gt + noremap 2gt + noremap 3gt + noremap 4gt + noremap 5gt + noremap 6gt + noremap 7gt + noremap 8gt + noremap 9gt + noremap :tablast + + " Open init.vim + map ee :e $HOME/.config/nvim/init.vim + + " Open a File in new Tab + map t :tabnew " } @@ -193,10 +240,35 @@ let mapleader="\" let g:netrw_liststyle=3 " tree (change to 0 for thin) let g:netrw_banner=0 " no banner let g:netrw_altv=1 " open files on right - let g:netrw_winsize=80 " only use 20% screen for netrw + let g:netrw_winsize=25 " only use 20% screen for netrw " FIXME: Preview opens to left and is very narrow let g:netrw_preview=1 " open previews vertically + let g:netrw_browse_split =3 " open files in new Tab + nmap n :Vexplore " } " } + " Filetype-Specific Configurations { + " HTML, XML, Jinja + autocmd FileType html setlocal shiftwidth=2 tabstop=2 softtabstop=2 + autocmd FileType css setlocal shiftwidth=2 tabstop=2 softtabstop=2 + autocmd FileType xml setlocal shiftwidth=2 tabstop=2 softtabstop=2 + autocmd FileType htmldjango setlocal shiftwidth=2 tabstop=2 softtabstop=2 + autocmd FileType htmldjango inoremap {{ {{ }} + autocmd FileType htmldjango inoremap {% {% %} + autocmd FileType htmldjango inoremap {# {# #} + " } + + " Markdown and Journal { + autocmd FileType markdown setlocal shiftwidth=2 tabstop=2 softtabstop=2 + autocmd FileType journal setlocal shiftwidth=2 tabstop=2 softtabstop=2 + " } + + " Trim Whitespaces { + function! TrimWhitespace() + let l:save = winsaveview() + %s/\\\@