From dc347d18ed9fdeefd26aae3765c81e0c5f0c81b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anton=20Luka=20=C5=A0ijanec?= Date: Sun, 22 Jan 2023 22:59:22 +0100 Subject: .vimrc -- following https://www.ackama.com/what-we-think/the-best-way-to-store-your-dotfiles-a-bare-git-repository-explained/ --- root/.vimrc | 231 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 231 insertions(+) create mode 100644 root/.vimrc diff --git a/root/.vimrc b/root/.vimrc new file mode 100644 index 0000000..0ade755 --- /dev/null +++ b/root/.vimrc @@ -0,0 +1,231 @@ +" An example for a vimrc file. +" +" Maintainer: Bram Moolenaar +" Last change: 2017 Sep 20 +" +" To use it, copy it to +" for Unix and OS/2: ~/.vimrc +" for Amiga: s:.vimrc +" for MS-DOS and Win32: $VIM\_vimrc +" for OpenVMS: sys$login:.vimrc + +set nocompatible " be iMproved, required +filetype off " required + +" When started as "evim", evim.vim will already have done these settings. +if v:progname =~? "evim" + finish +endif + +" Get the defaults that most users want. +source $VIMRUNTIME/defaults.vim + +if has("vms") + set nobackup " do not keep a backup file, use versions instead +else + set backup " keep a backup file (restore to previous version) + if has('persistent_undo') + set undofile " keep an undo file (undo changes after closing) + endif +endif + +if &t_Co > 2 || has("gui_running") + " Switch on highlighting the last used search pattern. + set hlsearch +endif + +" Only do this part when compiled with support for autocommands. +if has("autocmd") + + " Put these in an autocmd group, so that we can delete them easily. + augroup vimrcEx + au! + + " For all text files set 'textwidth' to 78 characters. + autocmd FileType text setlocal textwidth=0 + + augroup END + +else + + set autoindent " always set autoindenting on + +endif " has("autocmd") + +" Add optional packages. +" +" The matchit plugin makes the % command work better, but it is not backwards +" compatible. +" The ! means the package won't be loaded right away but when plugins are +" loaded during initialization. +if has('syntax') && has('eval') + packadd! matchit +endif + +set tabstop=8 +set shiftwidth=8 + +set backupdir=.backup//,~/.vim/backup//,/tmp// +set directory=.swp//,~/.vim/swp//,/tmp// +set undodir=.undo//,~/.vim/undo//,/tmp// + +function! TextEnableCodeSnip(filetype,start,end,textSnipHl) abort + let ft=toupper(a:filetype) + let group='textGroup'.ft + if exists('b:current_syntax') + let s:current_syntax=b:current_syntax + " Remove current syntax definition, as some syntax files (e.g. cpp.vim) + " do nothing if b:current_syntax is defined. + unlet b:current_syntax + endif + execute 'syntax include @'.group.' syntax/'.a:filetype.'.vim' + try + execute 'syntax include @'.group.' after/syntax/'.a:filetype.'.vim' + catch + endtry + if exists('s:current_syntax') + let b:current_syntax=s:current_syntax + else + unlet b:current_syntax + endif + execute 'syntax region textSnip'.ft.' + \ matchgroup='.a:textSnipHl.' + \ keepend + \ start="'.a:start.'" end="'.a:end.'" + \ contains=@'.group +endfunction + +call TextEnableCodeSnip('javascript', '@begin=js@', '@end=js@', 'comment') +call TextEnableCodeSnip('html', '@begin=html@', '@end=html@', 'comment') +call TextEnableCodeSnip('html', '', '', 'comment') +syn sync fromstart + +function OnWrite() + " echom fnamemodify(expand("%:p"), ":r") + if (&ft == 'tex' && match(readfile(expand("%:p")), "do-vimlatex-onwrite")!=-1) + " :silent !~/projects/doc/f5ff.sh %:p:r > stdout.log 2> stderr.log & + :silent !pdflatex -shell-escape %:p:r > stdout.log 2> stderr.log & + " preveč dela, če bi zaganjali f5ff.sh - med urejanjem itak ne + " rabimo časa generiranja ampak predvsem hitrost + endif +endfunction + +function OnRead() + if (&ft == 'tex' || &ft == 'php') + setl nocin nosi inde= + " :silent !firefox %:p:r.pdf & + endif +endfunction + +function OnMekiC() + :silent !firefox %:p:r.pdf > /dev/null 2>&1 & + :redraw! +endfunction + +function OnF8() + :silent !xdotool search --class Chrome windowactivate --sync %1 key F5 windowactivate $(xdotool getactivewindow) + +endfunction + +autocmd BufWritePost * call OnWrite() +autocmd BufReadPost,FileReadPost * call OnRead() +" nnoremap ć :call OnMekiC() +nnoremap :call OnF8() +nnoremap ;s :set spell spelllang=sl +nnoremap ;a :set spell spelllang=en +nnoremap ;n :set spell spelllang=de +nnoremap ;i :set spell nospell +map <200b> +function SpellSet(language) + set spell spelllang=en_us +endfunction +set breakindent +function TurnWrapOn() + setlocal wrap linebreak nolist + set virtualedit= + setlocal display+=lastline + nnoremap gk + nnoremap gj + nnoremap g + nnoremap g + inoremap gk + inoremap gj + inoremap g + inoremap g +endfunction +call TurnWrapOn() +noremap w :call ToggleWrap() +function ToggleWrap() + if &wrap + echo "Wrap OFF" + setlocal nowrap + set virtualedit=all + silent! nunmap + silent! nunmap + silent! nunmap + silent! nunmap + silent! iunmap + silent! iunmap + silent! iunmap + silent! iunmap + else + echo "Wrap ON" + call TurnWrapOn() + endif +endfunction + +"""""" vim-tex +let g:Imap_UsePlaceHolders = 0 +let g:Tex_SmartKeyBS = 0 +let g:Tex_SmartKeyQuote = 0 +let g:Tex_SmartKeyDot = 0 +let g:Tex_Leader = '`tex' +let g:Tex_Leader2 = ',tex' +let g:Imap_FreezeImap=1 +" cross terminal copy +set clipboard+=unnamed +set ignorecase +set smartcase +hi Search cterm=NONE ctermfg=grey ctermbg=blue +hi Comment cterm=NONE ctermfg=cyan ctermbg=NONE +hi SpellBad cterm=NONE ctermfg=black ctermbg=magenta +hi SpellCap cterm=NONE ctermfg=black ctermbg=cyan +hi Visual cterm=NONE ctermfg=black ctermbg=white gui=none +map  +map  +map OA +map  +hi MatchParen cterm=none ctermbg=green ctermfg=blue +au FileType tex setlocal nonumber +au FileType tex setlocal norelativenumber +nnoremap đ w +inoremap đ w +set breakindentopt=shift:8,min:40,sbr +" colorscheme peachpuff " <<< za belo x11 okno +colorscheme koehler +" autocmd ModeChanged * { +" if mode() == 'v' +" set number +" set rnu +" else +" set nornu +" set nonumber +" endif +" } +set number +set rnu +" disable hard wrap +set textwidth=0 + +au BufNewFile,BufRead *.frag,*.vert,*.fp,*.vp,*.glsl setf glsl +if has("gui_running") + set guioptions -=m " menubar + set guioptions -=T " toolbar + set guioptions -=r " no scrollbar +endif + +let g:python_recommended_style = 0 +syntax on + +autocmd FileType python set tabstop=2 +autocmd FileType python set shiftwidth=2 -- cgit v1.2.3