" vim: set fdm=marker : " " Base {{{1 set nocompatible if has("nvim") if !exists('$TMUX') let $NVIM_TUI_ENABLE_TRUE_COLOR=1 endif let $NVIM_TUI_ENABLE_CURSOR_SHAPE=1 set shell=fish elseif $SHELL=="/usr/bin/fish" set shell=sh endif let $PATH=$HOME."/bin/:" .$HOME. "/.cabal/bin/:". $HOME. "/.gem/ruby/1.9.1/bin/:" .$PATH let $GOPATH=$HOME."/devel/go" set history=1000 set backupdir-=. set backupdir+=~/.backup set undofile set undodir=~/.vim/undo set suffixes+=*.pdf " Plugins: {{{1 if exists(':Plug') != 2 call plug#begin() endif " Filetypes: {{{2 " Essential: {{{3 Plug 'git@github.com:vim-pandoc/vim-pandoc.git' Plug 'git@github.com:vim-pandoc/vim-pandoc-after.git' Plug 'git@github.com:vim-pandoc/vim-pandoc-syntax.git' Plug 'git@github.com:fmoralesc/vim-bibliographer.git' Plug 'dag/vim-fish' Plug 'klen/python-mode', {'on': 'python'} " Extra: {{{3 Plug 'vim-latex/vim-latex' Plug 'vimoutliner/vimoutliner' "Plug 'vim-scripts/yaml.vim' "Plug 'tkztmk/vim-vala' "Plug 'plasticboy/vim-markdown' "Plug 'pangloss/vim-javascript', {'for': 'javascript'} "Plug 'jceb/vim-orgmode' " Devel: {{{3 "Plug 'git@github.com:fmoralesc/vim-beyul.git' Plug 'git@github.com:fmoralesc/vim-tutor-mode.git' "Plug 'git@github.com:vim-pandoc/vim-criticmarkup.git' Plug '~/.vim/plugged/vim-commonmark' " Utilities: {{{2 " Essential {{{3 Plug 'haya14busa/incsearch.vim' Plug 'haya14busa/incsearch-fuzzy.vim' Plug 'tpope/vim-flagship' Plug 'chrisbra/NrrwRgn' Plug 'ctrlpvim/ctrlp.vim' Plug 'fisadev/vim-ctrlp-cmdpalette' Plug 'git@github.com:fmoralesc/vim-extended-autochdir.git' Plug 'git@github.com:fmoralesc/vim-pad.git' Plug 'justinmk/vim-gtfo' Plug 'kana/vim-smartword' Plug 'ludovicchabant/vim-gutentags' Plug 'ntpeters/vim-better-whitespace' Plug 'scrooloose/nerdcommenter' Plug 'tpope/vim-eunuch' Plug 'tpope/vim-fugitive' Plug 'tpope/vim-repeat' Plug 'tpope/vim-unimpaired' Plug 'tpope/vim-vinegar' if has('nvim') Plug 'Shougo/deoplete.nvim' let g:deoplete#enable_at_startup = 1 elseif has('python') Plug 'Valloric/YouCompleteMe', {'do': './install.sh'} elseif has('python3') Plug 'davidhalter/jedi-vim' let g:jedi#auto_vim_configuration = 0 let g:jedi#show_call_signatures = 0 else Plug 'ajh17/VimCompletesMe' endif " Devel: {{{3 "Plug '~/.vim/bundle/vim-preproc' Plug 'git@github.com:fmoralesc/plan9-for-vimspace.git' Plug '~/.vim/plugged/nvim-oxberry' " Should probably use more: {{{3 Plug 'justinmk/vim-sneak' Plug 'simnalamburt/vim-mundo' Plug 'junegunn/vim-easy-align' " others: {{{3 Plug 'benekastah/neomake' "Plug 'luochen1990/rainbow' "let g:rainbow_active = 1 "Plug 'aserebryakov/filestyle' "Plug 'nathanaelkane/vim-indent-guides' "Plug 'tpope/vim-git' "Plug 'dahu/vim-fanfingtastic' "Plug 'dhruvasagar/vim-table-mode' "Plug 'embear/vim-localvimrc' "Plug 'junegunn/goyo.vim', {'on': 'Goyo'} "Plug 'junegunn/limelight.vim' "Plug 'kana/vim-textobj-user' "Plug 'mattn/gist-vim' "Plug 'mattn/webapi-vim' "Plug 'terryma/vim-multiple-cursors' "Plug 'junegunn/vim-pseudocl' "Plug 'junegunn/vim-oblique' " might use some time: {{{4 "Plug 'gregsexton/gitv' " for vim-orgmode: {{{5 "Plug 'vim-scripts/utl.vim' "Plug 'tpope/vim-speeddating' "Plug 'zixiaojindao/calendar.vim' " Add maktaba and codefmt to the runtimepath. " (The latter must be installed before it can be used.) "Plug 'google/vim-maktaba' "Plug 'google/vim-codefmtlib' "Plug 'google/vim-codefmt' "Plug 'dhruvasagar/vim-dotoo' "if !has('nvim') "Plug 'dahu/vimple' "Plug 'dahu/Marksman' "endif "Plug 'MarcWeber/vim-addon-mw-utils' "Plug 'Shougo/neocomplete.vim' "Plug 'Shougo/neomru.vim' "Plug 'Shougo/vimproc' "Plug 'Shougo/unite.vim' "Plug 'Shougo/vimshell.vim' "Plug 'VOoM', {'on': 'Voom'} "Plug 'bling/vim-airline' "Plug 'dahu/LearnVim' "Plug 'fmoralesc/vim-autogit' "Plug 'garbas/vim-snipmate' "Plug 'git@github.com:fmoralesc/vim-help-grimoire.git' "Plug 'godlygeek/tabular' "Plug 'honza/vim-snippets' "Plug 'majutsushi/tagbar' "Plug 'mhinz/vim-startify' "Plug 'restore_view.vim' "Plug 'rking/ag.vim' "Plug 'scrooloose/syntastic' "Plug 'tomtom/tlib_vim' "Plug 'wellle/targets.vim' " Colorschemes: {{{2 Plug 'sjl/badwolf' Plug 'morhetz/gruvbox' Plug 'tomasr/molokai' Plug 'git@github.com:fmoralesc/molokayo.git' Plug 'git@github.com:plan9-for-vimspace/acme-colors.git' Plug '~/.vim/plugged/vim-colors-leshy' "}}}2 call plug#end() " Options: {{{2 " CtrlP: {{{3 let g:ctrlp_clear_cache_on_exit = 0 let g:ctrlp_follow_symlinks = 2 let g:ctrlp_mruf_max = 1000 "let g:ctrlp_match_func = {'match': 'matcher#cmatch'} nnoremap :silent! :CtrlPMRUFiles nnoremap :silent :CtrlP nnoremap :silent :CtrlPLine nnoremap :silent! :CtrlPCmdPalette " vim-sneak: {{{3 let g:sneak#streak = 1 " vim-pad: {{{3 let g:pad#dir = "/home/felipe/documents/Notas" let g:pad#default_format = "pandoc" let g:pad#window_height = 8 let g:pad#search_backend = "ag" " vim-pandoc: {{{3 let g:pandoc#formatting#mode = "hA" let g:pandoc#formatting#smart_autoformat_on_cursormoved = 1 let g:pandoc#folding#level = 2 "let g:pandoc#folding#mode = "relative" let g:pandoc#after#modules#enabled = ["nrrwrgn", "tablemode", "vimcompletesme"] let g:pandoc#completion#bib#mode = 'citeproc' let g:pandoc#syntax#newlines = 0 " NrrRgn: {{{3 noremap nn :NR " python-mode: {{{3 let g:pymode_lint_checkers = ['pyflakes'] " Goyo: {{{3 autocmd User GoyoEnter Limelight autocmd User GoyoLeave Limelight! " incsearch: {{{3 map / (incsearch-forward) map ? (incsearch-backward) map g/ (incsearch-stay) map z/ (incsearch-fuzzy-/) map z? (incsearch-fuzzy-?) map zg/ (incsearch-fuzzy-stay) " dotoo: {{{3 let g:dotoo_todo_keyword_faces = [ \ ['TODO', [':foreground red', ':weight bold']], \ ['NEXT', [':foreground lightblue', ':weight bold']], \ ['DONE', [':foreground blue', ':weight bold']], \ ['WAITING', [':foreground yellow', ':weight bold']], \ ['HOLD', [':foreground red', ':weight bold']], \ ['CANCELLED', [':foreground red', ':weight bold']], \ ['MEETING', [':foreground green', ':weight bold']], \ ['PHONE', [':foreground blue', ':weight bold']] \ ] "}}}1 " UI: {{{1 " Theme: {{{2 if has("gui_running") set guifont=Fantasque\ Sans\ Mono\ 9 endif if !has("nvim") && $COLORTERM != 'drop-down-terminal' au VimEnter * set co=130 lines=40 endif set background=dark if !exists('g:colors_name') let g:molokayo#focus_variant = 1 " let g:molokayo#high_contrast#ultra = 1 colorscheme molokayo endif "}}}2 " Mouse: {{{2 set mouse=a " Bell: {{{2 set visualbell t_vb= " Elements: {{{2 set guiheadroom=0 " No toolbars or scrollbars set guioptions-=T set guioptions-=r set guioptions-=L " No menu set guioptions-=m " Folding {{{2 function! NeatFoldText() " let line = ' ' . substitute(getline(v:foldstart), '^\s*"\?\s*\|\s*"\?\s*{{' . '{\d*\s*', '', 'g') . ' ' let lines_count = v:foldend - v:foldstart + 1 let lines_count_text = '/' . printf("%10s", lines_count . ' lines') . ' /' let foldchar = matchstr(&fillchars, 'fold:\zs.') let foldtextstart = strpart('+' . repeat(foldchar, v:foldlevel*2) . line, 0, (winwidth(0)*2)/3) let foldtextend = lines_count_text . repeat(foldchar, 8) let foldtextlength = strlen(substitute(foldtextstart . foldtextend, '.', 'x', 'g')) + &foldcolumn return foldtextstart . repeat(foldchar, winwidth(0)-foldtextlength) . foldtextend endfunction set foldtext=NeatFoldText() " }}}2 " Tabline: {{{2 set showtabline=2 set guioptions-=e let g:tabprefix = '' " Statusline: {{{2 " function! StatusDir() if &buftype != "nofile" let d = expand("%:p:~:h") if d != fnamemodify(getcwd(), ":~") return expand("%:p:.:h").'/' else return '' endif else return '' endif endfunction function! OtherBuffers() let buffers_txt = "" redir => buffers_txt silent ls redir END let lines = [] for line in split(buffers_txt, "\n") let bufnr = split(line)[0] if bufnr != bufnr("%") call add(lines, split(line)[0]) endif endfor return lines endfunction function! StatusOtherBuffers() return join(map(OtherBuffers(), '"·".v:val'), ' ') endfunction function! PWD() return fnamemodify(getcwd(), ":~") endfunction set laststatus=2 set statusline=%#SLDelim#@:%#SLSpecial#%{PWD()} set statusline+=%#SLDelim#:%#SLNumber#%n%#SLDelim#: "buffer number set statusline+=%#SLDirectory#%{expand('%:h')!=''?StatusDir():''} "file path, if buffer is a file set statusline+=%#SLIdentifier#%{expand('%:h')!=''?expand('%:t'):'[unnamed]'}%#Boolean#%m%r "buffer name and modifiers set statusline+=%#SLDelim#%{fugitive#head()!=''?'@':''}%#SLVCS#%{fugitive#head()} " disable the retarded vim-fugitive flag au VimEnter * au! fugitive_statusline set statusline+=\ %#SLCharacter#%{StatusOtherBuffers()} "list of other buffers set statusline+=\ %=\%#SLConstant#%{&fenc}%#SLDelim#:%#SLType#%{&ft}%#SlDelim#:%#SLFunction#%{&fo}%#SLDelim#:%#SLSpellBad#%{&spell?&spl:''} set statusline+=%#SLNumber#\ %l,%c set wrapscan set wildmenu set wildmode=full " Scroll {{{2 set scrolloff=1 noremap H 'H' . eval('&scrolloff') . '' noremap L 'L' . eval('&scrolloff') . 'j' " }}}1 " Completion: {{{1 set completeopt=menuone set complete-=i set complete+=s,kspell " Formatting: {{{1 set bs=indent,eol,start " Indent: {{{1 set softtabstop=4 set shiftwidth=4 "set expandtab set smarttab " Search: {{{1 set incsearch set ignorecase set smartcase set hlsearch " Misc: {{{1 set shortmess+=I "no startup message set autoread set keymodel=startsel,stopsel set viewoptions-=options,folds set nrformats-=octal " Commands: {{{1 " command! ToggleMenu \ if strridx(&guioptions,"m") == -1 | \ set guioptions+=m | \ else | \ set guioptions-=m | \ endif command! SynName echo synIDattr(synID(line("."), col("."), 1), "name") command! SynStack echo map(synstack(line('.'), col('.')), 'synIDattr(v:val, "name")') command! SynTrans echo synIDattr(synIDtrans(synID(line('.'), col('.'), 1)), "name") command! FileTree leftabove 30vsplit . | map " vim -b : edit binary using xxd-format! augroup Binary au! au BufReadPre *.bin let &bin=1 au BufReadPost *.bin if &bin | %!xxd au BufReadPost *.bin set ft=xxd | endif au BufWritePre *.bin if &bin | %!xxd -r au BufWritePre *.bin endif au BufWritePost *.bin if &bin | %!xxd au BufWritePost *.bin set nomod | endif augroup END " Mappings: {{{1 " let g:mapleader=" " let g:maplocalleader="," " Plugins: {{{2 " fanfingtastic: {{{3 "map f fanfingtastic_f "map F fanfingtastic_F "map t fanfingtastic_t "map T fanfingtastic_T "map ; fanfingtastic_; "map , fanfingtastic_, " smartword-movements {{{3 map w (smartword-w) map b (smartword-b) map e (smartword-e) map ge (smartword-ge) " change current dir {{{2 noremap cd :cd %:h noremap ld :lcd %:h " movement {{{2 noremap gk noremap gj noremap j 5j noremap k 5k " buffer mappings {{{2 noremap d :bdelete noremap w :bwipe noremap ! :bwipe! " reformat a paragraph {{{2 nmap q gqip " spelling {{{2 "" Suggest spellings inoremap is nnoremap eis "" Goto next misspelling nnoremap ]se inoremap ]se