From 7786d72ec75f26802d26de5fcdcfbee3cd8615aa Mon Sep 17 00:00:00 2001 From: TiynGER Date: Tue, 14 Apr 2020 13:44:00 +0200 Subject: [PATCH] lets add some bling to vim --- .config/nvim/init.vim | 89 +++++++++++++++++++++++-------------------- 1 file changed, 48 insertions(+), 41 deletions(-) diff --git a/.config/nvim/init.vim b/.config/nvim/init.vim index 7b40b1f..77fb2b3 100644 --- a/.config/nvim/init.vim +++ b/.config/nvim/init.vim @@ -1,71 +1,81 @@ let mapleader ="," -if ! filereadable(expand('~/.config/nvim/autoload/plug.vim')) - echo "Downloading junegunn/vim-plug to manage plugins..." - silent !mkdir -p ~/.config/nvim/autoload/ - silent !curl "https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim" > ~/.config/nvim/autoload/plug.vim - autocmd VimEnter * PlugInstall -endif set go=a +" Enable mouse for all modes set mouse=a set nohlsearch -set clipboard=unnamedplus - -" Some basics: -nnoremap c "_c +set clipboard+=unnamedplus +" Enable command completion +set wildmode=longest,list,full +" Setting Tab-length +set expandtab +set tabstop=4 +set softtabstop=4 +set shiftwidth=4 +" Splits open at the bottom and right, which is non-retarded, unlike vim defaults. +set splitbelow splitright +" Set lines and colors +set cursorline +set cursorcolumn +" Disable case sensitive matching +set ignorecase +" Enable nocompatible mode set nocompatible +" Enable Plugins filetype plugin on +" Enable syntax highlighting syntax on +" Enable true colors +set termguicolors +" Set utf-8 encoding set encoding=utf-8 +" Show relative numbers on left side set number relativenumber -" Enable autocompletion: -set wildmode=longest,list,full +" Colorscheme +source /home/tiynger/.config/nvim/codedark.vim +highlight CursorLine ctermbg=Yellow cterm=bold guibg=#1b1b1b +highlight CursorColumn ctermbg=Yellow cterm=bold guibg=#1b1b1b +" Center screen on Insertion +autocmd InsertEnter * norm zz +" Delete trailing whitespaces on save +autocmd BufWritePre * %s/\s\+$//e " Disables automatic commenting on newline: autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o - -" Setting Tab-length -set tabstop=4 -set softtabstop=4 -set shiftwidth=4 - -" Splits open at the bottom and right, which is non-retarded, unlike vim defaults. -set splitbelow splitright - " Clean LaTex build files autocmd VimLeave *.tex !texclear % - -" Copy selected text to system clipboard (requires gvim/nvim/vim-x11 installed): -vnoremap "+y -map "+P - -" Save file as sudo on files that require root permission -cnoremap w!! execute 'silent! write !sudo tee % >/dev/null' edit! - -" Mapping Dictionaries -map :setlocal spell! spelllang=de -map :set spelllang=en_us - " Read files correctly autocmd BufRead,BufNewFile *.tex set filetype=tex +" Mapping Dictionaries +map :setlocal spell! spelllang=de_de +map :set spelllang=en_us " Compiler for languages map c :w! \| !compiler % - " Open corresponding file (pdf/html/...) map p :!opout % - -" Delete trailing whitespaces on save -autocmd BufWritePre * %s/\s\+$//e - " Shortcut for split navigation map h map j map k map l +" Copy selected text to system clipboard (requires gvim/nvim/vim-x11 installed): +map "+P +vnoremap "+y +" Save file as sudo on files that require root permission +cnoremap w!! execute 'silent! write !sudo tee % >/dev/null' edit! +" Alias for replacing +nnoremap S :%s//gI " Plugin section +if ! filereadable(expand('~/.config/nvim/autoload/plug.vim')) + echo "Downloading junegunn/vim-plug to manage plugins..." + silent !mkdir -p ~/.config/nvim/autoload/ + silent !curl "https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim" > ~/.config/nvim/autoload/plug.vim + autocmd VimEnter * PlugInstall +endif + call plug#begin('~/.local/share/nvim/plugged') Plug 'lervag/vimtex' , { 'for' : 'tex'} " Tex library for coc autocompletion Plug 'donRaphaco/neotex', { 'for': 'tex'} " Asynchronous pdf rendering @@ -80,9 +90,6 @@ Plug 'frazrepo/vim-rainbow' " Colorized matching brackets Plug 'junegunn/fzf.vim' " Quickly jump files using fzf call plug#end() -" Colorscheme -source /home/tiynger/.config/nvim/codedark.vim - " Rainbow au FileType java,c,cpp,py call rainbow#load()