Created
February 21, 2016 10:04
-
-
Save fmoralesc/fdd6a18ebc64d06ab971 to your computer and use it in GitHub Desktop.
.config/nvim/init.vim
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" vim: set fdm=marker : | |
" | |
" Base {{{1 | |
" | |
if !exists('$TMUX') | |
let $NVIM_TUI_ENABLE_TRUE_COLOR=1 | |
endif | |
let $NVIM_TUI_ENABLE_CURSOR_SHAPE=1 | |
set shell=fish | |
let $SSH_AUTH_SOCK=$XDG_RUNTIME_DIR."/ssh-agent.socket" | |
let $PATH=$HOME."/bin/:" .$HOME. "/.cabal/bin/:". $HOME. "/.gem/ruby/1.9.1/bin/:" .$PATH | |
let $GOPATH=$HOME."/devel/go" | |
set suffixes+=*.pdf | |
" Plugins: {{{1 | |
call plug#begin('~/.config/nvim/bundle') | |
" Filetypes: {{{2 | |
" Essential: {{{3 | |
Plug '[email protected]:vim-pandoc/vim-pandoc.git' | |
Plug '[email protected]:vim-pandoc/vim-pandoc-after.git' | |
Plug '[email protected]:vim-pandoc/vim-pandoc-syntax.git' | |
Plug '[email protected]:fmoralesc/vim-bibliographer.git' | |
Plug 'dag/vim-fish' | |
Plug 'klen/python-mode' | |
" Extra: {{{3 | |
Plug 'vim-latex/vim-latex' | |
Plug 'vimoutliner/vimoutliner' | |
"Plug 'vim-scripts/yaml.vim' | |
"Plug 'fatih/vim-go' | |
"Plug 'tkztmk/vim-vala' | |
"Plug 'plasticboy/vim-markdown' | |
"Plug 'pangloss/vim-javascript', {'for': 'javascript'} | |
"Plug 'jceb/vim-orgmode' | |
" Devel: {{{3 | |
"Plug '[email protected]:fmoralesc/vim-beyul.git' | |
"Plug '[email protected]:fmoralesc/vim-tutor-mode.git' | |
"Plug '[email protected]:vim-pandoc/vim-criticmarkup.git' | |
"Plug '~/.vim/plugged/vim-commonmark' | |
" Utilities: {{{2 | |
" Essential {{{3 | |
Plug '[email protected]:fmoralesc/worldslice.git' | |
Plug 'tpope/vim-flagship' | |
Plug 'tpope/vim-fugitive' | |
Plug 'chrisbra/NrrwRgn' | |
Plug 'junegunn/fzf', { 'do': 'yes \| ./install' } | |
Plug 'junegunn/fzf.vim' | |
Plug '[email protected]:fmoralesc/vim-extended-autochdir.git' | |
"Plug '[email protected]:fmoralesc/vim-pad.git' | |
Plug 'justinmk/vim-gtfo' | |
Plug 'ludovicchabant/vim-gutentags' | |
Plug 'ntpeters/vim-better-whitespace' | |
Plug 'scrooloose/nerdcommenter' | |
Plug 'tpope/vim-eunuch' | |
Plug 'tpope/vim-repeat' | |
Plug 'tpope/vim-unimpaired' | |
Plug 'tpope/vim-vinegar' | |
Plug 'Shougo/deoplete.nvim' | |
" others: {{{3 | |
"Plug 'dahu/vim-fanfingtastic' | |
"Plug 'benekastah/neomake' | |
"Plug 'kana/vim-smartword' | |
"Plug '~/.config/nvim/bundle/nvimfs' | |
"Plug 'justinmk/vim-sneak' | |
"Plug 'simnalamburt/vim-mundo' | |
"Plug 'junegunn/vim-easy-align' | |
"Plug 'vim-scripts/TableTab.vim' | |
"Plug 'SirVer/ultisnips' | |
"Plug 'honza/vim-snippets' | |
"Plug 'tpope/vim-git' | |
"Plug 'haya14busa/incsearch.vim' | |
"Plug 'haya14busa/incsearch-fuzzy.vim' | |
"map / <Plug>(incsearch-forward) | |
"map ? <Plug>(incsearch-backward) | |
"map g/ <Plug>(incsearch-stay) | |
"Plug 'dhruvasagar/vim-table-mode' | |
"Plug 'embear/vim-localvimrc' | |
"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 'VOoM', {'on': 'Voom'} | |
"Plug 'fmoralesc/vim-autogit' | |
"Plug 'garbas/vim-snipmate' | |
"Plug '[email protected]:fmoralesc/vim-help-grimoire.git' | |
"Plug 'godlygeek/tabular' | |
"Plug 'majutsushi/tagbar' | |
"Plug 'restore_view.vim' | |
"Plug 'tomtom/tlib_vim' | |
"Plug 'wellle/targets.vim' | |
" Colorschemes: {{{2 | |
"Plug 'sjl/badwolf' | |
"Plug 'morhetz/gruvbox' | |
"Plug 'tomasr/molokai' | |
"Plug '[email protected]:fmoralesc/molokayo.git' | |
Plug 'chriskempson/base16-vim' | |
"Plug '[email protected]:plan9-for-vimspace/acme-colors.git' | |
"}}}2 | |
call plug#end() | |
" Options: {{{2 | |
" fzf: {{{3 | |
if !has('nvim') | |
nnoremap <C-f1> :silent! :<C-u>History<CR> | |
nnoremap <C-ñ> :silent :<C-u>Lines<cr> | |
else | |
nnoremap <F25> :silent! :<C-u>History<cr> | |
nnoremap <F26> :silent! :<C-u>Lines<cr> | |
endif | |
nnoremap <C-p> :silent :<C-u>Files<CR> | |
let g:sneak#streak = 1 | |
" 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", "ultisnips"] | |
let g:pandoc#completion#bib#mode = 'citeproc' | |
let g:pandoc#syntax#newlines = 0 | |
" NrrRgn: {{{3 | |
noremap <leader>nn :NR<CR> | |
" python-mode: {{{3 | |
let g:pymode_lint_checkers = ['pyflakes'] | |
"map / <Plug>(incsearch-forward) | |
"map ? <Plug>(incsearch-backward) | |
"map g/ <Plug>(incsearch-stay) | |
"map z/ <Plug>(incsearch-fuzzy-/) | |
"map z? <Plug>(incsearch-fuzzy-?) | |
"map zg/ <Plug>(incsearch-fuzzy-stay) | |
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 $COLORTERM != "drop-down-terminal" | |
set co=130 lines=40 | |
endif | |
set background=dark | |
colorscheme base16-atelierforest | |
set title | |
"}}}2 | |
" Elements: {{{2 | |
" No toolbars or scrollbars | |
set guioptions-=T | |
set guioptions-=r | |
set guioptions-=L | |
" 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 | |
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 | |
let s:my_worldslice_config = [ | |
\ '+(@:)', ['%{PWD()}', 'Special'], | |
\ '+(:)', ['%n', 'Number'], | |
\ '+(:)', ["%{expand('%:h')!=''?StatusDir():''}", 'Directory'], | |
\ ["%{expand('%:h')!=''?expand('%:t'):'[unnamed]'}", 'Identifier'], | |
\ ['%m%r', 'Boolean'], | |
\ ["%{fugitive#head()!=''?'@':''}", 'Delimiter'], | |
\ ['%{fugitive#head()}', 'VCS'], | |
\ '\ ', ['%{StatusOtherBuffers()}', 'Character'], | |
\ '\ %=\', | |
\ ['%{&fenc}', 'Constant'], | |
\ '+(:)', ['%{&ft}', 'Type'], | |
\ '+(:)', ['%{&fo}', 'Function'], | |
\ '+(:)', ["%{&spell?&spl:''}", 'SpellBad'], | |
\ ['\ %l,%c', 'Number'] | |
\ ] | |
call worldslice#init(s:my_worldslice_config) | |
" Scroll {{{2 | |
set scrolloff=1 | |
noremap <expr> H 'H' . eval('&scrolloff') . '<C-u>' | |
noremap <expr> L 'L' . eval('&scrolloff') . 'j' | |
" }}}1 | |
" Completion: {{{1 | |
set completeopt=menuone | |
set complete+=s,kspell | |
" Indent: {{{1 | |
set softtabstop=4 | |
set shiftwidth=4 | |
" Search: {{{1 | |
set ignorecase | |
set smartcase | |
" Misc: {{{1 | |
set keymodel=startsel,stopsel | |
set viewoptions-=options,folds | |
" 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 <buffer> <CR> <nop> | |
" 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 <Plug>fanfingtastic_f | |
map F <Plug>fanfingtastic_F | |
map t <Plug>fanfingtastic_t | |
map T <Plug>fanfingtastic_T | |
map ; <Plug>fanfingtastic_; | |
map , <Plug>fanfingtastic_, | |
" smartword-movements {{{3 | |
map <leader>w <Plug>(smartword-w) | |
map <leader>b <Plug>(smartword-b) | |
map <leader>e <Plug>(smartword-e) | |
map <leader>ge <Plug>(smartword-ge) | |
" change current dir {{{2 | |
noremap <leader>cd :cd %:h<CR> | |
noremap <leader>ld :lcd %:h<CR> | |
" movement {{{2 | |
noremap <up> gk | |
noremap <down> gj | |
noremap <leader>j 5j | |
noremap <leader>k 5k | |
" buffer mappings {{{2 | |
noremap <C-b>d :bdelete<CR> | |
noremap <C-b>w :bwipe<CR> | |
noremap <C-b>! :bwipe!<cr> | |
" spelling {{{2 | |
"" Suggest spellings | |
inoremap <C-s> <C-X>s | |
nnoremap <C-s> e<esc>i<C-x>s | |
"" Goto next misspelling | |
nnoremap <C-z> ]se | |
inoremap <C-z> <esc>]se |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment