From 25b613f755424edad38ab7616365bb618237b9fe Mon Sep 17 00:00:00 2001 From: --global Date: Sun, 19 Dec 2021 12:03:01 +0100 Subject: migration to dwm; home cleanup --- nvim/.config/nvim/init.vim | 60 ++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 53 insertions(+), 7 deletions(-) (limited to 'nvim/.config') diff --git a/nvim/.config/nvim/init.vim b/nvim/.config/nvim/init.vim index 806a1ca..08963fe 100644 --- a/nvim/.config/nvim/init.vim +++ b/nvim/.config/nvim/init.vim @@ -9,6 +9,7 @@ endif call plug#begin('~/.config/nvim/plugged') "Plug 'ervandew/supertab' +Plug 'nekonako/xresources-nvim' Plug 'scrooloose/nerdtree' Plug 'lervag/vimtex' Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' } @@ -19,8 +20,10 @@ Plug 'jpalardy/vim-slime' Plug 'JuliaEditorSupport/julia-vim' Plug 'xuhdev/vim-latex-live-preview', { 'for': 'tex' } Plug 'christoomey/vim-tmux-navigator' +Plug 'vimwiki/vimwiki' call plug#end() +colorscheme xresources " experimental set title @@ -28,15 +31,15 @@ set bg=light set go=a set mouse=a set nohlsearch +" allow copy-paste to X11 clipboard set clipboard+=unnamedplus set noshowmode set noruler set laststatus=0 set noshowcmd - set nocompatible -filetype plugin on +filetype plugin indent on syntax on set encoding=utf-8 set number relativenumber @@ -47,7 +50,7 @@ set shiftwidth=4 set autoindent set smartindent " don't use acual character -set expandtab +set expandtab " autocompletion set wildmode=longest:list,full @@ -93,7 +96,7 @@ map r :vsp$REFER nnoremap S :%s//g " compile document, be it groff/LaTeX/markdown/etc. -map c :w! \| !compiler "%" +map c :w! \| !compile "%" " open corresponding .pdf/.html or preview map p :!opout % @@ -113,9 +116,22 @@ autocmd BufRead,BufNewFile *.tex set filetype=tex cnoremap w!! execute 'silent! write !sudo tee % >/dev/null' edit! " automatically delete all trailing whitespace and newlines at end of file on save -autocmd BufWritePre * %s/\s\+$//e -autocmd BufWritePre * %s/\n\+\%$//e -autocmd BufWritePre *.[ch] %s/\%$/\r/e +"autocmd BufWritePre * %s/\s\+$//e +"autocmd BufWritePre * %s/\n\+\%$//e +"autocmd BufWritePre *.[ch] %s/\%$/\r/e +fun! TrimWhitespace() + let l:save = winsaveview() + keeppatterns %s/\s\+$//e + call winrestview(l:save) +endfun +fun! TrimTrailingLines() + let l:save = winsaveview() + keeppatterns :v/\_s*\S/d + call winrestview(l:save) +endfun +autocmd BufWritePre * call TrimWhitespace() +autocmd BufWritePre * call TrimTrailingLines() + " turn off highlighting on the bits of code that are changed, so the line that is changed is highlighted but the actual text that has changed stands out on the line and is readable if &diff @@ -200,3 +216,33 @@ let g:livepreview_use_biber = 1 let g:livepreview_cursorhold_recompile = 1 set updatetime=1000 + + +" copy-paste remapping for newbies like me +" CTRL-X and SHIFT-Del are Cut +vnoremap "+x +vnoremap "+x +" CTRL-C and CTRL-Insert are Copy +vnoremap "+y +vnoremap "+y + + + +" Enable saving of undo history data from the buffer to a file. Next +" time Vim starts, the undo file is loaded. +set undofile + +" Directory for the undo files. This can be multiple entries separated +" by comma, in which the first found one will be used. "." means +" current directory of the file. +if !isdirectory($HOME."/.cache/nvim/") + call mkdir($HOME."/.cache/nvim", "", 0770) +endif +if !isdirectory($HOME."/.cache/nvim/undodir") + call mkdir($HOME."/.cache/nvim/undodir", "", 0700) +endif +set undodir=~/.cache/nvim/undodir + + +" autocompile dwmblocks +autocmd BufWritePost ~/.local/src/dwmblocks/config.h !cd ~/.local/src/dwmblocks/; sudo make install && { killall -q dwmblocks;setsid dwmblocks & } -- cgit v1.2.3