Advertisement
Guest User

Untitled

a guest
Sep 2nd, 2015
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.01 KB | None | 0 0
  1. " Base {{{1
  2. "
  3. if has("nvim")
  4. if !exists('$TMUX')
  5. let $NVIM_TUI_ENABLE_TRUE_COLOR=1
  6. endif
  7. let $NVIM_TUI_ENABLE_CURSOR_SHAPE=1
  8. set shell=fish
  9. endif
  10.  
  11. let $PATH=$HOME."/bin/:" .$HOME. "/.cabal/bin/:". $HOME. "/.gem/ruby/1.9.1/bin/:" .$PATH
  12.  
  13. set backupdir-=.
  14. set backupdir+=~/.backup
  15. set undofile
  16. set undodir=~/.vim/undo
  17.  
  18. set suffixes+=*.pdf
  19.  
  20. " Plugins: {{{1
  21. " Filetypes: {{{2
  22. plug vim-pandoc/vim-pandoc
  23. plug vim-pandoc/vim-pandoc-after
  24. plug vim-pandoc/vim-pandoc-syntax
  25. plug vim-bibliographer
  26. plug dag/vim-fish
  27. plug klen/python-mode
  28. plug fatih/vim-go
  29. plug vimoutliner/vimoutliner
  30. plug vim-latex/vim-latex
  31.  
  32. " Utilities: {{{2
  33. plug tpope/vim-flagship
  34. plug chrisbra/NrrwRgn
  35. plug ctrlpvim/ctrlp.vim
  36. plug fisadev/vim-ctrlp-cmdpalette
  37. plug fmoralesc/vim-extended-autochdir
  38. plug fmoralesc/vim-pad
  39. plug justinmk/vim-gtfo
  40. plug kana/vim-smartword
  41. plug ludovicchabant/vim-gutentags
  42. plug ntpeters/vim-better-whitespace
  43. plug scrooloose/nerdcommenter
  44. plug tpope/vim-eunuch
  45. plug tpope/vim-fugitive
  46. plug tpope/vim-repeat
  47. plug tpope/vim-unimpaired
  48. plug tpope/vim-vinegar
  49. plug Shougo/deoplete.nvim
  50. plug unblevable/quick-scope
  51. " Only show quick-scope highlights after f/F/t/T is pressed
  52. function! Quick_scope_selective(movement)
  53. let needs_disabling = 0
  54. if !g:qs_enable
  55. QuickScopeToggle
  56. redraw
  57. let needs_disabling = 1
  58. endif
  59.  
  60. "let letter = nr2char(getchar())
  61.  
  62. if needs_disabling
  63. QuickScopeToggle
  64. endif
  65.  
  66. "return a:movement . letter
  67. return a:movement
  68. endfunction
  69.  
  70. let g:qs_enable = 0
  71.  
  72. for i in [ 'f', 'F', 't', 'T' ]
  73. execute 'noremap <expr> <silent>' . i . " Quick_scope_selective('". i . "')"
  74. endfor
  75. plug justinmk/vim-sneak
  76. plug simnalamburt/vim-mundo
  77. plug junegunn/vim-easy-align
  78. plug benekastah/neomake
  79.  
  80. " Colorschemes: {{{2
  81. plug tomasr/molokai
  82. plug molokayo
  83. "}}}2
  84. " Options: {{{2
  85. " CtrlP: {{{3
  86. let g:ctrlp_clear_cache_on_exit = 0
  87. let g:ctrlp_follow_symlinks = 2
  88. let g:ctrlp_mruf_max = 1000
  89. "let g:ctrlp_match_func = {'match': 'matcher#cmatch'}
  90. if !has('nvim')
  91. nnoremap <C-f1> :silent! :<C-u>CtrlPMRUFiles<CR>
  92. nnoremap <C-ñ> :silent :<C-u>CtrlPLine<cr>
  93. else
  94. nnoremap <F25> :silent! :<C-u>CtrlPMRUFiles<cr>
  95. endif
  96. nnoremap <C-p> :silent :<C-u>CtrlP<CR>
  97. nnoremap <C-c> :silent! :<C-u>CtrlPCmdPalette<cr>
  98.  
  99. " vim-sneak: {{{3
  100. let g:sneak#streak = 1
  101.  
  102. " vim-pad: {{{3
  103. let g:pad#dir = "/home/felipe/documents/Notas"
  104. let g:pad#default_format = "pandoc"
  105. let g:pad#window_height = 8
  106. let g:pad#search_backend = "ag"
  107. noremap <F13> :Pad ls<cr>
  108.  
  109. " vim-pandoc: {{{3
  110. let g:pandoc#formatting#mode = "hA"
  111. let g:pandoc#formatting#smart_autoformat_on_cursormoved = 1
  112. let g:pandoc#folding#level = 2
  113. "let g:pandoc#folding#mode = "relative"
  114. let g:pandoc#after#modules#enabled = ["nrrwrgn", "tablemode", "vimcompletesme"]
  115. let g:pandoc#completion#bib#mode = 'citeproc'
  116. let g:pandoc#syntax#newlines = 0
  117.  
  118. " NrrRgn: {{{3
  119. noremap <leader>nn :NR<CR>
  120. " python-mode: {{{3
  121. let g:pymode_lint_checkers = ['pyflakes']
  122. "}}}1
  123. " UI: {{{1
  124. " Theme: {{{2
  125.  
  126. filetype plugin indent on
  127. syntax on
  128. set co=130 lines=40
  129. if !exists('g:colors_name')
  130. let g:molokayo#focus_variant = 1
  131. colorscheme molokayo
  132. endif
  133. set title
  134. "}}}2
  135. " Folding {{{2
  136. function! NeatFoldText() "
  137. let line = ' ' . substitute(getline(v:foldstart), '^\s*"\?\s*\|\s*"\?\s*{{' . '{\d*\s*', '', 'g') . ' '
  138. let lines_count = v:foldend - v:foldstart + 1
  139. let lines_count_text = '/' . printf("%10s", lines_count . ' lines') . ' /'
  140. let foldchar = matchstr(&fillchars, 'fold:\zs.')
  141. let foldtextstart = strpart('+' . repeat(foldchar, v:foldlevel*2) . line, 0, (winwidth(0)*2)/3)
  142. let foldtextend = lines_count_text . repeat(foldchar, 8)
  143. let foldtextlength = strlen(substitute(foldtextstart . foldtextend, '.', 'x', 'g')) + &foldcolumn
  144. return foldtextstart . repeat(foldchar, winwidth(0)-foldtextlength) . foldtextend
  145. endfunction
  146. set foldtext=NeatFoldText()
  147. " }}}2
  148. " Tabline: {{{2
  149. set showtabline=2
  150. set guioptions-=e
  151. let g:tabprefix = ''
  152. " Statusline: {{{2
  153. "
  154. function! StatusDir()
  155. if &buftype != "nofile"
  156. let d = expand("%:p:~:h")
  157. if d != fnamemodify(getcwd(), ":~")
  158. return expand("%:p:.:h").'/'
  159. else
  160. return ''
  161. endif
  162. else
  163. return ''
  164. endif
  165. endfunction
  166.  
  167. function! OtherBuffers()
  168. let buffers_txt = ""
  169. redir => buffers_txt
  170. silent ls
  171. redir END
  172. let lines = []
  173. for line in split(buffers_txt, "\n")
  174. let bufnr = split(line)[0]
  175. if bufnr != bufnr("%")
  176. call add(lines, split(line)[0])
  177. endif
  178. endfor
  179. return lines
  180. endfunction
  181.  
  182. function! StatusOtherBuffers()
  183. return join(map(OtherBuffers(), '"·".v:val'), ' ')
  184. endfunction
  185.  
  186. function! PWD()
  187. return fnamemodify(getcwd(), ":~")
  188. endfunction
  189.  
  190. set laststatus=2
  191. set statusline=%#SLDelim#@:%#SLSpecial#%{PWD()}
  192. set statusline+=%#SLDelim#:%#SLNumber#%n%#SLDelim#: "buffer number
  193. set statusline+=%#SLDirectory#%{expand('%:h')!=''?StatusDir():''} "file path, if buffer is a file
  194. set statusline+=%#SLIdentifier#%{expand('%:h')!=''?expand('%:t'):'[unnamed]'}%#Boolean#%m%r "buffer name and modifiers
  195. set statusline+=%#SLDelim#%{fugitive#head()!=''?'@':''}%#SLVCS#%{fugitive#head()}
  196. " disable the retarded vim-fugitive flag
  197. au VimEnter * au! fugitive_statusline
  198. set statusline+=\ %#SLCharacter#%{StatusOtherBuffers()} "list of other buffers
  199. set statusline+=\ %=\%#SLConstant#%{&fenc}%#SLDelim#:%#SLType#%{&ft}%#SlDelim#:%#SLFunction#%{&fo}%#SLDelim#:%#SLSpellBad#%{&spell?&spl:''}
  200. set statusline+=%#SLNumber#\ %l,%c
  201. set wrapscan
  202. set wildmenu
  203. set wildmode=full
  204.  
  205. " Scroll {{{2
  206. set scrolloff=1
  207. noremap <expr> H 'H' . eval('&scrolloff') . '<C-u>'
  208. noremap <expr> L 'L' . eval('&scrolloff') . 'j'
  209.  
  210. " }}}1
  211. " Completion: {{{1
  212. set completeopt=menuone
  213. set complete+=s,kspell
  214.  
  215. " Indent: {{{1
  216. set softtabstop=4
  217. set shiftwidth=4
  218.  
  219. " Search: {{{1
  220. set ignorecase
  221. set smartcase
  222.  
  223. " Misc: {{{1
  224. set shortmess+=I "no startup message
  225. set keymodel=startsel,stopsel
  226.  
  227. " Commands: {{{1
  228. "
  229. command! ToggleMenu
  230. \ if strridx(&guioptions,"m") == -1 |
  231. \ set guioptions+=m |
  232. \ else |
  233. \ set guioptions-=m |
  234. \ endif
  235. command! SynName echo synIDattr(synID(line("."), col("."), 1), "name")
  236. command! SynStack echo map(synstack(line('.'), col('.')), 'synIDattr(v:val, "name")')
  237. command! SynTrans echo synIDattr(synIDtrans(synID(line('.'), col('.'), 1)), "name")
  238. command! FileTree leftabove 30vsplit . | map <buffer> <CR> <nop>
  239.  
  240. " Mappings: {{{1
  241. "
  242. let g:mapleader=" "
  243. let g:maplocalleader=","
  244.  
  245. " Plugins: {{{2
  246. " smartword-movements {{{3
  247. map <leader>w <Plug>(smartword-w)
  248. map <leader>b <Plug>(smartword-b)
  249. map <leader>e <Plug>(smartword-e)
  250. map <leader>ge <Plug>(smartword-ge)
  251. " change current dir {{{2
  252. noremap <leader>cd :cd %:h<CR>
  253. noremap <leader>ld :lcd %:h<CR>
  254.  
  255. " movement {{{2
  256. noremap <up> gk
  257. noremap <down> gj
  258. noremap <leader>j 5j
  259. noremap <leader>k 5k
  260.  
  261. " buffer mappings {{{2
  262. noremap <C-b>d :bdelete<CR>
  263. noremap <C-b>w :bwipe<CR>
  264. noremap <C-b>! :bwipe!<cr>
  265.  
  266. " reformat a paragraph {{{2
  267. nmap <leader>q gqip
  268.  
  269. " spelling {{{2
  270. "" Suggest spellings
  271. inoremap <C-s> <esc>i<C-X>s
  272. nnoremap <C-s> e<esc>i<C-x>s
  273. "" Goto next misspelling
  274. nnoremap <C-z> <esc>]se
  275. inoremap <C-z> <esc>]se
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement