many changes in neovim init.vim

This commit is contained in:
templis 2018-08-02 13:48:23 +02:00
parent 44deddba85
commit 4ed8ae198d

View File

@ -9,6 +9,10 @@ call plug#begin('~/.config/nvim/plugged')
Plug 'morhetz/gruvbox' Plug 'morhetz/gruvbox'
" neomake is a code linting tool that runs in the background. " neomake is a code linting tool that runs in the background.
Plug 'neomake/neomake' Plug 'neomake/neomake'
"autocompletion Plugin for Code autocomplete
Plug 'zchee/deoplete-jedi'
" Left side File Tree
"Plug 'scrooloose/nerdtree'
" install with nvim +PlugInstall +qall " install with nvim +PlugInstall +qall
" update with nvim +PlugUpgrade +PlugUpdate +PlugClean +qall " update with nvim +PlugUpgrade +PlugUpdate +PlugClean +qall
" you can also update it in nvim with syntax autocompletion and stuff - simply " you can also update it in nvim with syntax autocompletion and stuff - simply
@ -25,8 +29,9 @@ let mapleader="\<SPACE>"
set nocindent " I indent my code myself. set nocindent " I indent my code myself.
"set smartindent " Or I let the smartindent take care of it. "set smartindent " Or I let the smartindent take care of it.
set breakindent " Indent line-breaks at the same level as code. set breakindent " Indent line-breaks at the same level as code.
set ttimeoutlen=100 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 { " Search {
@ -40,6 +45,14 @@ let mapleader="\<SPACE>"
endif endif
" } " }
" Spellcorrection {
setlocal spell spelllang=en_us
"setlocal spell spelllang=de_20
map <F7> :setlocal spell spelllang=de_20 <return>
map <F8> :setlocal spell spelllang=en_us <return>
map <F9> :w!<CR>:!aspell check %<CR>:e! %<CR>
" Formatting { " Formatting {
set showmatch " Show matching brackets. set showmatch " Show matching brackets.
set number " Show the line numbers on the left side. set number " Show the line numbers on the left side.
@ -134,6 +147,13 @@ let mapleader="\<SPACE>"
" Toggle between normal and relative numbering. " Toggle between normal and relative numbering.
nnoremap <leader>r :call NumberToggle()<cr> nnoremap <leader>r :call NumberToggle()<cr>
" 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 { " Keybindings {
@ -149,8 +169,35 @@ let mapleader="\<SPACE>"
vmap <Leader>P "+P vmap <Leader>P "+P
" Move between buffers " Move between buffers
nmap <Leader>l :bnext<CR>
nmap <Leader>h :bprevious<CR> nmap <Leader>h :bprevious<CR>
" Switch between Buffers
map <C-j> <C-w>j<C-w>_
map <C-k> <C-w>k<C-w>_
map <C-h> <C-w>h<C-w>_
map <C-l> <C-w>l<C-w>_
" Switch between tabs
map <A-h> :tabprevious<CR>
map <A-l> :tabnext<CR>
" Go to tab by number
noremap <A-1> 1gt
noremap <A-2> 2gt
noremap <A-3> 3gt
noremap <A-4> 4gt
noremap <A-5> 5gt
noremap <A-6> 6gt
noremap <A-7> 7gt
noremap <A-8> 8gt
noremap <A-9> 9gt
noremap <A-0> :tablast<cr>
" Open init.vim
map <silent> <leader>ee :e $HOME/.config/nvim/init.vim<cr>
" Open a File in new Tab
map <silent> <leader>t :tabnew
" } " }
@ -193,10 +240,35 @@ let mapleader="\<SPACE>"
let g:netrw_liststyle=3 " tree (change to 0 for thin) let g:netrw_liststyle=3 " tree (change to 0 for thin)
let g:netrw_banner=0 " no banner let g:netrw_banner=0 " no banner
let g:netrw_altv=1 " open files on right 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 " FIXME: Preview opens to left and is very narrow
let g:netrw_preview=1 " open previews vertically let g:netrw_preview=1 " open previews vertically
let g:netrw_browse_split =3 " open files in new Tab
nmap <Leader>n :Vexplore<CR>
" } " }
" } " }
" 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 {{ {{ }}<left><left><left>
autocmd FileType htmldjango inoremap {% {% %}<left><left><left>
autocmd FileType htmldjango inoremap {# {# #}<left><left><left>
" }
" 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/\\\@<!\s\+$//e
call winrestview(l:save)
endfunction
" }
" vim:set ft=vim sw=4 ts=4: " vim:set ft=vim sw=4 ts=4: