" GENERAL let skip_defaults_vim=1 set nocompatible " do not force vi compatibility set encoding=UTF-8 " always use utf-8 encoding set viminfo="NONE" " no viminfo file set viewdir=~/.cache/vim/view set noswapfile " no swap file set shortmess+=c " avoid all |hit-enter| promts set autoread " automatically change the file if it has been changed outside vim set backspace=2 " the same as `set backspace=indent,eol,start` set noshowmatch " do not jump to a matching bracket set hidden " don't unload a buffer when no longer shown in a window set updatetime=50 " default is 4000ms set noerrorbells " no error message bells set spelllang=en " British English set lazyredraw " do not redraw screen while executing macros set nowrap set textwidth=0 set clipboard=unnamedplus " global clipboard set iskeyword+=- " treat dash separated words as a word text object" " TAB AND INDENTATION set tabstop=4 softtabstop=4 set shiftwidth=4 "set expandtab set smartindent " AUTOCOMPLETE "" Tab completion set wildmenu set wildmode=longest,list,full "" Omnicomplete (C-d start; accept; C-e cancel) filetype plugin on set omnifunc=syntaxcomplete#Complete set completeopt=menuone,noinsert,preview inoremap inoremap pumvisible() ? "\" : "\u\" " GUI colorscheme nord "" Syntax syntax on au FileType * setlocal formatoptions-=cro " disable automatic commenting on newline au BufRead,BufNewFile *.gmi,*.gemini,*.gemtext set filetype=gemtext au BufRead,BufNewFile *.tex set filetype=tex "" Cursor set guicursor= if exists('$TMUX') let &t_SI="\Ptmux;\\e[2 q\\\" let &t_SR="\Ptmux;\\e[2 q\\\" let &t_EI="\Ptmux;\\e[2 q\\\" else let &t_SI.="\e[2 q" "SI = INSERT mode let &t_SR.="\e[2 q" "SR = REPLACE mode let &t_EI.="\e[2 q" "EI = NORMAL mode (ELSE) endif """ Cursor settings: 1=blinking block; 2=solid block; 3=blinking underscore; 4=solid underscore; 5=blinking vertical bar; 6=solid vertical bar "" Line numbers set relativenumber " relative numbers set nu " cursor line global number "set cul " cursor line highlight "" Scroll set scrolloff=4 "" Visual mode highlight highlight Visual cterm=reverse ctermbg=NONE "" Status line set laststatus=2 " always show the statusline highlight highlightStatusline ctermfg=darkgrey ctermbg=233 set statusline=%#highlightStatusline#%f\ %y[%{strlen(&fenc)?&fenc:'none'}]%=%l:%c%V\ %P "" Command line set cmdheight=1 " SPLITS set splitbelow set splitright "" Navigation nnoremap h :split nnoremap v :vsplit map h map j map k map l "" Window resizing nnoremap :resize +2 nnoremap :resize -2 nnoremap :vertical resize -2 nnoremap :vertical resize +2 " HISTORY set noswapfile set nobackup set undodir=~/.vim/undodir set undofile " SEARCH set incsearch set smartcase set ignorecase set nohlsearch " MACROS let @w="/haha\xxxx\" " SCHEME augroup SCHEME autocmd! autocmd BufRead,BufNewFile *.ss syntax keyword Statement lambda conceal cchar=λ autocmd BufRead,BufNewFile *.ss syntax keyword Statement define conceal cchar=Δ autocmd BufRead,BufNewFile *.ss hi! link Conceal Statement autocmd BufRead,BufNewFile *.ss set conceallevel=2 autocmd BufRead,BufNewFile *.ss set concealcursor=nvi augroup END " KEY MAPPINGS "" au VimEnter * silent! !xmodmap -e 'clear Lock' -e 'keycode 0x42 = Escape' au VimLeave * silent! !xmodmap -e 'clear Lock' -e 'keycode 0x42 = Caps_Lock' imap jj "" let g:mapleader = " " " set leader key as "" General nnoremap /<+++>5x vnoremap . :normal . vnoremap < >gv """ navigation in INSERT mode inoremap h inoremap j inoremap k inoremap l """ delete to null register vnoremap d "_d """ open directory tree nnoremap ex :wincmd v :Ex :vertical resize 30 """ wrap nnoremap tw :call ToggleWrap() """ spell nnoremap ts :let &spell=!&spell "" Quotes nnoremap qs a‘’ nnoremap qd a“” nnoremap qa a»« "" XML autocmd FileType xml let @t="\<<+++>>>\" autocmd FileType xml nnoremap t "xdawi<"xpa>"xpa>cit autocmd FileType xml nnoremap e o<+++><+++><+++>5k "" Shell """ echo autocmd FileType sh nnoremap e aecho "" """ printf autocmd FileType sh nnoremap p aprintf "" """ if [[ ]] autocmd FileType sh nnoremap [ aif [[ ]]; thenfif] """ if (( )) autocmd FileType sh nnoremap ( aif (( )); thenfif) """ for number autocmd FileType sh nnoremap for afor ((i=;i<;i++)); dodonekf= """ iterate over values autocmd FileType sh nnoremap fval afor item in "${[@]}"; dodonekf{a """ iterate over keys autocmd FileType sh nnoremap fkey afor item in "${![@]}"; dodonekf!a """ read file line by line autocmd FileType sh nnoremap read awhile read line; dodone < $ "" LaTeX autocmd FileType tex nnoremap na i\documentclass[12pt]{article}\usepackage[utf8]{inputenc}\usepackage[T1]{fontenc}\usepackage[english]{babel}\usepackage{csquotes}\usepackage{amsmath,amssymb,amsfonts,amsthm,amscd}\usepackage{latexsym}\usepackage{tikz,graphicx,subfigure}\usepackage{subfigure}\usepackage{url}%\usepackage{biblatex}%\addbibresource{}\numberwithin{equation}{section}\newtheorem{defin}[equation]{Definition}\newtheorem{thm}[equation]{Theorem}\newtheorem{prop}[equation]{Proposition}\newtheorem{lem}[equation]{Lemma}\newtheorem{cor}[equation]{Corollary}\newtheorem{exam}[equation]{Example}\newtheorem{rem}[equation]{Remark}\newtheorem{obs}[equation]{Observation}\newtheorem{quest}[equation]{Question}\newtheorem{prob}[equation]{Problem}\newtheorem{conj}[equation]{Conjecture}\title{<+++>}\author{<+++>}\date{<+++>}\begin{document}\maketitle\begin{abstract}<+++>\end{abstract}%\printbibliography[title={References}]\end{document}41k autocmd FileType tex nnoremap b b"xdEa\begin{"xpa}\end{"xpa}F\i "" BibTex au BufRead,BufNewFile *.bib nnoremap a a@article{,author={},title={},abstract={},journal={},volume={},number={},pages={},month=,year={},issn={},url={},doi={},keywords={},}14kf, au BufRead,BufNewFile *.bib nnoremap b a@book{,author={},title={},year={},publisher={},address={},isbn={},url={},doi={},keywords={},}10kf, au BufRead,BufNewFile *.bib nnoremap c a@inbook{,author={},title={},chapter={},publisher={},year={},keywords={},}7kf, vnoremap ss "cy :call RunCode("c","ss") vnoremap pp "cy :call RunCode("c","perl") vnoremap ll "cy :call RunCode("c","lua") "inoremap ( ()i fun Testtest() let l:xxx =<< trim END of mice and men END echo l:xxx endfun " AUTOCMD "" Functions fun! TrimWhitespace() let l:save = winsaveview() keeppatterns %s/\s\+$//e call winrestview(l:save) endfun fun! ToggleWrap() if (&wrap) set nowrap else set wrap linebreak endif endfun fun RunCode(register,language) let l:tempname = tempname() if (a:language == "ss") call writefile(getreg(a:register,1,1), l:tempname) echom "= SCHEME RESULT BEGIN =" echom system("csi -s " . l:tempname) echom "== SCHEME RESULT END ==" call delete(l:tempname) endif if (a:language == "perl") call writefile(getreg(a:register,1,1), l:tempname) echom "= PERL RESULT BEGIN =" echo system("perl " . l:tempname) echom "== PERL RESULT END ==" call delete(l:tempname) endif if (a:language == "lua") call writefile(getreg(a:register,1,1), l:tempname) echom "= LUA RESULT BEGIN =" echo system("lua " . l:tempname) echom "== LUA RESULT END ==" call delete(l:tempname) endif endfun "" Commands augroup TRIM_WHITESPACES autocmd! autocmd BufWritePre * :call TrimWhitespace() augroup END augroup REMEMBER_FOLDS autocmd! autocmd BufWinLeave * mkview autocmd BufWinEnter * silent! loadview augroup END