Skip to content

Instantly share code, notes, and snippets.

@sijanec
Last active October 15, 2020 21:36
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sijanec/dd1a5e7b3a99246492e20b5259c70b98 to your computer and use it in GitHub Desktop.
Save sijanec/dd1a5e7b3a99246492e20b5259c70b98 to your computer and use it in GitHub Desktop.
""""""""""""""""""""""""" BEGIN VUNDLE # nevermind i will not use vindle
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'
" now plugins:
" Plugin 'beautify-web/js-beautify'
Plugin 'LaTex-Suite-aka-Vim-LaTex'
call vundle#end() " required
filetype plugin indent on " required
""""""""""""""""""""""""" END VUNDLE
" 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
" 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=78
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=2
set shiftwidth=2
set backupdir=.backup/,~/.backup/,/tmp//
set directory=.swp/,~/.swp/,/tmp//
set undodir=.undo/,~/.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 &
endif
endfunction
function OnRead()
if (&ft == 'tex')
setl nocin nosi inde=
" :silent !firefox %:p:r.pdf &
endif
endfunction
function OnMekiC()
:silent !firefox %:p:r.pdf > /dev/null 2>&1 &
:redraw!
endfunction
autocmd BufWritePost * call OnWrite()
autocmd BufReadPost,FileReadPost * call OnRead()
nnoremap ć :call OnMekiC()<CR><LF>
set breakindent
function TurnWrapOn()
setlocal wrap linebreak nolist
set virtualedit=
setlocal display+=lastline
noremap <buffer> <silent> <Up> gk
noremap <buffer> <silent> <Down> gj
noremap <buffer> <silent> <Home> g<Home>
noremap <buffer> <silent> <End> g<End>
inoremap <buffer> <silent> <Up> <C-o>gk
inoremap <buffer> <silent> <Down> <C-o>gj
inoremap <buffer> <silent> <Home> <C-o>g<Home>
inoremap <buffer> <silent> <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=unnamedplus
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment