" An example for a vimrc file.
"
" Maintainer: Bram Moolenaar <Bram@vim.org>
" 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', '<!DOCTYPE html>', '</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()<CR><LF>
nnoremap <F8> :call OnF8()<CR><LF>
nnoremap ;s :set spell spelllang=sl<CR><LF>
nnoremap ;a :set spell spelllang=en<CR><LF>
nnoremap ;n :set spell spelllang=de<CR><LF>
nnoremap ;i :set spell nospell<CR><LF>
map <C-j> <200b>
function SpellSet(language)
set spell spelllang=en_us
endfunction
set breakindent
function TurnWrapOn()
setlocal wrap linebreak nolist
set virtualedit=
setlocal display+=lastline
nnoremap <buffer> <Up> gk
nnoremap <buffer> <Down> gj
nnoremap <buffer> <Home> g<Home>
nnoremap <buffer> <End> g<End>
inoremap <buffer> <Up> <C-o>gk
inoremap <buffer> <Down> <C-o>gj
inoremap <buffer> <Home> <C-o>g<Home>
inoremap <buffer> <End> <C-o>g<End>
endfunction
call TurnWrapOn()
noremap <silent> <Leader>w :call ToggleWrap()<CR>
function ToggleWrap()
if &wrap
echo "Wrap OFF"
setlocal nowrap
set virtualedit=all
silent! nunmap <buffer> <Up>
silent! nunmap <buffer> <Down>
silent! nunmap <buffer> <Home>
silent! nunmap <buffer> <End>
silent! iunmap <buffer> <Up>
silent! iunmap <buffer> <Down>
silent! iunmap <buffer> <Home>
silent! iunmap <buffer> <End>
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 [1;5D <C-Left>
map [1;5C <C-Right>
map OA <C-Up>
map [1;5B <C-Down>
hi MatchParen cterm=none ctermbg=green ctermfg=blue
au FileType tex setlocal nonumber
au FileType tex setlocal norelativenumber
nnoremap đ <C-w>w
inoremap đ <C-o><C-w>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
set guifont=terminus\ 12
let g:rust_recommended_style = 0