SHARE
TWEET

Untitled

a guest May 19th, 2019 113 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. let mapleader =","
  2.  
  3. if ! filereadable(expand('~/.config/nvim/autoload/plug.vim'))
  4.     echo "Downloading junegunn/vim-plug to manage plugins..."
  5.     silent !mkdir -p ~/.config/nvim/autoload/
  6.     silent !curl "https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim" > ~/.config/nvim/autoload/plug.vim
  7. endif
  8.  
  9. call plug#begin('~/.config/nvim/plugged')
  10.  
  11. Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
  12. Plug 'vifm/vifm.vim'
  13. Plug 'PotatoesMaster/i3-vim-syntax'
  14. Plug 'alvan/vim-closetag', { 'for': 'html' }
  15. Plug 'christoomey/vim-sort-motion'
  16. Plug 'christoomey/vim-tmux-navigator'
  17. Plug 'dylanaraps/fff.vim'
  18. Plug 'edkolev/tmuxline.vim'
  19. Plug 'flazz/vim-colorschemes'
  20. Plug 'jiangmiao/auto-pairs'
  21. Plug 'junegunn/goyo.vim',
  22. Plug 'tpope/vim-commentary'
  23. Plug 'tpope/vim-repeat'
  24. Plug 'tpope/vim-surround'
  25. Plug 'vim-pandoc/vim-pandoc'
  26. Plug 'vim-pandoc/vim-pandoc-syntax'
  27. Plug 'vimwiki/vimwiki'
  28. Plug 'xolox/vim-lua-ftplugin'
  29. Plug 'xolox/vim-misc'
  30.  
  31. call plug#end()
  32.  
  33. set fcs=eob:\
  34. set bg=light
  35. set clipboard=unnamedplus
  36. set cursorline
  37. set expandtab
  38. set go=a
  39. set linebreak
  40. set mouse=a
  41. set nohlsearch
  42. set noru
  43. set noswapfile
  44. set shiftwidth=4
  45. set smarttab
  46. set softtabstop=4
  47. set tabstop=4
  48. colorscheme brogrammer
  49. let g:pandoc#keyboard#display_motions = 0
  50. let g:fff#split_direction = "nosplitbelow nosplitright"
  51. let g:fff#split = "20vnew"
  52.  
  53. noremap ,n <Esc>:F<CR>
  54.  
  55. noremap j h
  56. noremap k j
  57. noremap l k
  58. noremap ; l
  59.  
  60. noremap J H
  61. noremap K J
  62. noremap L K
  63. noremap : L
  64.  
  65. noremap h :
  66. noremap H ;
  67.  
  68. noremap gk gj
  69. noremap gl gk
  70.  
  71. " Some basics:
  72.    nnoremap c "_c
  73.     filetype plugin on
  74.     syntax on
  75.     set encoding=utf-8
  76.     set number relativenumber
  77.  
  78. " Enable autocompletion:
  79.    set wildmode=longest,list,full
  80.  
  81. " Disables automatic commenting on newline:
  82.     autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o
  83.  
  84. " Goyo plugin makes text more readable when writing prose:
  85.    noremap <leader>f <Esc>:Goyo 65%x65% \| set linebreak<CR>
  86.    autocmd FileType txt :Goyo 65%x65%
  87.  
  88. " Spell-check set to <leader>o, 'o' for 'orthography':
  89.     map <leader>o :setlocal spell! spelllang=en_us<CR>
  90.  
  91. " Splits open at the bottom and right, which is non-retarded, unlike vim defaults.
  92.    set splitbelow splitright
  93.  
  94. " Nerd tree
  95.     ""map <leader>n :NERDTreeToggle<CR>
  96.     ""autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
  97.  
  98. " vimling:
  99.    nm <leader>d :call ToggleDeadKeys()<CR>
  100.    imap <leader>d <esc>:call ToggleDeadKeys()<CR>a
  101.    nm <leader>i :call ToggleIPA()<CR>
  102.    imap <leader>i <esc>:call ToggleIPA()<CR>a
  103.    nm <leader>q :call ToggleProse()<CR>
  104.  
  105. " Check file in shellcheck:
  106.     map <leader>s :!clear && shellcheck %<CR>
  107.  
  108. " Open my bibliography file in split
  109.    map <leader>b :vsp<space>$BIB<CR>
  110.    map <leader>r :vsp<space>$REFER<CR>
  111.  
  112. " Replace all is aliased to S.
  113.     nnoremap S :%s//g<Left><Left>
  114.  
  115. " Compile document, be it groff/LaTeX/markdown/etc.
  116.    map <leader>c :w! \| !compiler <c-r>%<CR>
  117.  
  118. " Open corresponding .pdf/.html or preview
  119.     map <leader>p :!opout <c-r>%<CR><CR>
  120.  
  121. " Runs a script that cleans out tex build files whenever I close out of a .tex file.
  122.    autocmd VimLeave *.tex !texclear %
  123.  
  124. " Ensure files are read as what I want:
  125.     let g:vimwiki_ext2syntax = {'.Rmd': 'markdown', '.rmd': 'markdown','.md': 'markdown', '.markdown': 'markdown', '.mdown': 'markdown'}
  126.     let g:vimwiki_list = [{'path': '~/vimwiki', 'syntax': 'markdown', 'ext': '.md'}]
  127.     autocmd BufRead,BufNewFile /tmp/calcurse*,~/.calcurse/notes/* set filetype=markdown
  128.     autocmd BufRead,BufNewFile *.ms,*.me,*.mom,*.man set filetype=groff
  129.     autocmd BufRead,BufNewFile *.tex set filetype=tex
  130.  
  131. " Copy selected text to system clipboard (requires gvim/nvim/vim-x11 installed):
  132.    vnoremap <C-c> "+y
  133.     map <C-p> "+P
  134.  
  135. " Enable Goyo by default for mutt writting
  136.     " Goyo's width will be the line limit in mutt.
  137.    autocmd BufRead,BufNewFile /tmp/neomutt* let g:goyo_width=80
  138.    autocmd BufRead,BufNewFile /tmp/neomutt* :Goyo \| set bg=light
  139.  
  140. " Automatically deletes all trailing whitespace on save.
  141.    " autocmd BufWritePre * %s/\s\+$//e
  142.  
  143. " When shortcut files are updated, renew bash and vifm configs with new material:
  144.     autocmd BufWritePost ~/.config/bmdirs,~/.config/bmfiles !shortcuts
  145.  
  146. " Run xrdb whenever Xdefaults or Xresources are updated.
  147.    autocmd BufWritePost *Xresources,*Xdefaults !xrdb %
  148.  
  149. " Navigating with guides
  150.     inoremap <leader><leader> <Esc>/<++><Enter>"_c4l
  151.    vnoremap <leader><leader> <Esc>/<++><Enter>"_c4l
  152.     map <leader><leader> <Esc>/<++><Enter>"_c4l
  153.  
  154. """.wiki
  155.     autocmd FileType wiki nnoremap k gj
  156.     autocmd FileType wiki nnoremap l gk
  157.     autocmd FileType wiki vnoremap k gj
  158.     autocmd FileType wiki vnoremap l gk
  159.     autocmd FileType wiki inoremap ,hh <ESC>I#<Space>
  160.     autocmd FileType wiki inoremap ,hd <ESC>o#<Space>
  161.     autocmd FileType wiki inoremap ,hu <ESC>O#<Space>
  162.     autocmd Filetype wiki inoremap ,u __<++><Esc>F_i
  163.  
  164. """LATEX
  165.    " Word count:
  166.     autocmd FileType tex map <leader>w :w !detex \| wc -w<CR>
  167.     " Code snippets
  168.    autocmd FileType tex inoremap ,fr \begin{frame}<Enter>\frametitle{}<Enter><Enter><++><Enter><Enter>\end{frame}<Enter><Enter><++><Esc>6kf}i
  169.    autocmd FileType tex inoremap ,fi \begin{fitch}<Enter><Enter>\end{fitch}<Enter><Enter><++><Esc>3kA
  170.    autocmd FileType tex inoremap ,exe \begin{exe}<Enter>\ex<Space><Enter>\end{exe}<Enter><Enter><++><Esc>3kA
  171.    autocmd FileType tex inoremap ,em \emph{}<++><Esc>T{i
  172.    autocmd FileType tex inoremap ,bf \textbf{}<++><Esc>T{i
  173.    autocmd FileType tex vnoremap , <ESC>`<i\{<ESC>`>2la}<ESC>?\\{<Enter>a
  174.    autocmd FileType tex inoremap ,it \textit{}<++><Esc>T{i
  175.    autocmd FileType tex inoremap ,ct \textcite{}<++><Esc>T{i
  176.    autocmd FileType tex inoremap ,cp \parencite{}<++><Esc>T{i
  177.    autocmd FileType tex inoremap ,glos {\gll<Space><++><Space>\\<Enter><++><Space>\\<Enter>\trans{``<++>''}}<Esc>2k2bcw
  178.    autocmd FileType tex inoremap ,x \begin{xlist}<Enter>\ex<Space><Enter>\end{xlist}<Esc>kA<Space>
  179.    autocmd FileType tex inoremap ,ol \begin{enumerate}<Enter><Enter>\end{enumerate}<Enter><Enter><++><Esc>3kA\item<Space>
  180.    autocmd FileType tex inoremap ,ul \begin{itemize}<Enter><Enter>\end{itemize}<Enter><Enter><++><Esc>3kA\item<Space>
  181.    autocmd FileType tex inoremap ,li <Enter>\item<Space>
  182.    autocmd FileType tex inoremap ,ref \ref{}<Space><++><Esc>T{i
  183.    autocmd FileType tex inoremap ,tab \begin{tabular}<Enter><++><Enter>\end{tabular}<Enter><Enter><++><Esc>4kA{}<Esc>i
  184.    autocmd FileType tex inoremap ,ot \begin{tableau}<Enter>\inp{<++>}<Tab>\const{<++>}<Tab><++><Enter><++><Enter>\end{tableau}<Enter><Enter><++><Esc>5kA{}<Esc>i
  185.    autocmd FileType tex inoremap ,can \cand{}<Tab><++><Esc>T{i
  186.    autocmd FileType tex inoremap ,con \const{}<Tab><++><Esc>T{i
  187.    autocmd FileType tex inoremap ,v \vio{}<Tab><++><Esc>T{i
  188.    autocmd FileType tex inoremap ,a \href{}{<++>}<Space><++><Esc>2T{i
  189.    autocmd FileType tex inoremap ,sc \textsc{}<Space><++><Esc>T{i
  190.    autocmd FileType tex inoremap ,chap \chapter{}<Enter><Enter><++><Esc>2kf}i
  191.    autocmd FileType tex inoremap ,sec \section{}<Enter><Enter><++><Esc>2kf}i
  192.    autocmd FileType tex inoremap ,ssec \subsection{}<Enter><Enter><++><Esc>2kf}i
  193.    autocmd FileType tex inoremap ,sssec \subsubsection{}<Enter><Enter><++><Esc>2kf}i
  194.    autocmd FileType tex inoremap ,st <Esc>F{i*<Esc>f}i
  195.    autocmd FileType tex inoremap ,beg \begin{DELRN}<Enter><++><Enter>\end{DELRN}<Enter><Enter><++><Esc>4k0fR:MultipleCursorsFind<Space>DELRN<Enter>c
  196.    autocmd FileType tex inoremap ,up <Esc>/usepackage<Enter>o\usepackage{}<Esc>i
  197.    autocmd FileType tex nnoremap ,up /usepackage<Enter>o\usepackage{}<Esc>i
  198.    autocmd FileType tex inoremap ,tt \texttt{}<Space><++><Esc>T{i
  199.    autocmd FileType tex inoremap ,bt {\blindtext}
  200.    autocmd FileType tex inoremap ,nu $\varnothing$
  201.    autocmd FileType tex inoremap ,col \begin{columns}[T]<Enter>\begin{column}{.5\textwidth}<Enter><Enter>\end{column}<Enter>\begin{column}{.5\textwidth}<Enter><++><Enter>\end{column}<Enter>\end{columns}<Esc>5kA
  202.    autocmd FileType tex inoremap ,rn (\ref{})<++><Esc>F}i
  203.  
  204. """HTML
  205.     autocmd FileType html inoremap ,b <b></b><Space><++><Esc>FbT>i
  206.     autocmd FileType html inoremap ,it <em></em><Space><++><Esc>FeT>i
  207.     autocmd FileType html inoremap ,1 <h1></h1><Enter><Enter><++><Esc>2kf<i
  208.     autocmd FileType html inoremap ,2 <h2></h2><Enter><Enter><++><Esc>2kf<i
  209.     autocmd FileType html inoremap ,3 <h3></h3><Enter><Enter><++><Esc>2kf<i
  210.     autocmd FileType html inoremap ,p <p></p><Enter><Enter><++><Esc>02kf>a
  211.     autocmd FileType html inoremap ,a <a<Space>href=""><++></a><Space><++><Esc>14hi
  212.     autocmd FileType html inoremap ,e <a<Space>target="_blank"<Space>href=""><++></a><Space><++><Esc>14hi
  213.     autocmd FileType html inoremap ,ul <ul><Enter><li></li><Enter></ul><Enter><Enter><++><Esc>03kf<i
  214.     autocmd FileType html inoremap ,li <Esc>o<li></li><Esc>F>a
  215.     autocmd FileType html inoremap ,ol <ol><Enter><li></li><Enter></ol><Enter><Enter><++><Esc>03kf<i
  216.     autocmd FileType html inoremap ,im <img src="" alt="<++>"><++><esc>Fcf"a
  217.    autocmd FileType html inoremap ,td <td></td><++><Esc>Fdcit
  218.    autocmd FileType html inoremap ,tr <tr></tr><Enter><++><Esc>kf<i
  219.    autocmd FileType html inoremap ,th <th></th><++><Esc>Fhcit
  220.    autocmd FileType html inoremap ,tab <table><Enter></table><Esc>O
  221.    autocmd FileType html inoremap ,gr <font color="green"></font><Esc>F>a
  222.    autocmd FileType html inoremap ,rd <font color="red"></font><Esc>F>a
  223.    autocmd FileType html inoremap ,yl <font color="yellow"></font><Esc>F>a
  224.    autocmd FileType html inoremap ,dt <dt></dt><Enter><dd><++></dd><Enter><++><esc>2kcit
  225.    autocmd FileType html inoremap ,dl <dl><Enter><Enter></dl><enter><enter><++><esc>3kcc
  226.    autocmd FileType html inoremap &<space> &amp;<space>
  227.    autocmd FileType html inoremap á &aacute;
  228.    autocmd FileType html inoremap é &eacute;
  229.    autocmd FileType html inoremap í &iacute;
  230.    autocmd FileType html inoremap ó &oacute;
  231.    autocmd FileType html inoremap ú &uacute;
  232.    autocmd FileType html inoremap ä &auml;
  233.    autocmd FileType html inoremap ë &euml;
  234.    autocmd FileType html inoremap ï &iuml;
  235.    autocmd FileType html inoremap ö &ouml;
  236.    autocmd FileType html inoremap ü &uuml;
  237.    autocmd FileType html inoremap ã &atilde;
  238.    autocmd FileType html inoremap ẽ &etilde;
  239.    autocmd FileType html inoremap ĩ &itilde;
  240.    autocmd FileType html inoremap õ &otilde;
  241.    autocmd FileType html inoremap ũ &utilde;
  242.    autocmd FileType html inoremap ñ &ntilde;
  243.    autocmd FileType html inoremap à &agrave;
  244.    autocmd FileType html inoremap è &egrave;
  245.    autocmd FileType html inoremap ì &igrave;
  246.    autocmd FileType html inoremap ò &ograve;
  247.    autocmd FileType html inoremap ù &ugrave;
  248.  
  249.  
  250. """.bib
  251.     autocmd FileType bib inoremap ,a @article{<Enter>author<Space>=<Space>{<++>},<Enter>year<Space>=<Space>{<++>},<Enter>title<Space>=<Space>{<++>},<Enter>journal<Space>=<Space>{<++>},<Enter>volume<Space>=<Space>{<++>},<Enter>pages<Space>=<Space>{<++>},<Enter>}<Enter><++><Esc>8kA,<Esc>i
  252.     autocmd FileType bib inoremap ,b @book{<Enter>author<Space>=<Space>{<++>},<Enter>year<Space>=<Space>{<++>},<Enter>title<Space>=<Space>{<++>},<Enter>publisher<Space>=<Space>{<++>},<Enter>}<Enter><++><Esc>6kA,<Esc>i
  253.     autocmd FileType bib inoremap ,c @incollection{<Enter>author<Space>=<Space>{<++>},<Enter>title<Space>=<Space>{<++>},<Enter>booktitle<Space>=<Space>{<++>},<Enter>editor<Space>=<Space>{<++>},<Enter>year<Space>=<Space>{<++>},<Enter>publisher<Space>=<Space>{<++>},<Enter>}<Enter><++><Esc>8kA,<Esc>i
  254.  
  255. "MARKDOWN
  256.    autocmd Filetype markdown,rmd nnoremap k gj
  257.    autocmd Filetype markdown,rmd nnoremap l gk
  258.    autocmd FileType markdown,rmd vnoremap k gj
  259.    autocmd FileType markdown,rmd vnoremap l gk
  260.    autocmd Filetype markdown,rmd map <leader>w yiWi[<esc>Ea](<esc>pa)
  261.    autocmd Filetype rmd map <F5> :!echo<space>"require(rmarkdown);<space>render('<C-r>%')"<space>\|<space>R<space>--vanilla<enter>
  262.    autocmd Filetype markdown,rmd inoremap ,n ---<Enter><Enter>
  263.    autocmd Filetype markdown,rmd inoremap ,b ****<++><Esc>F*hi
  264.    autocmd Filetype markdown,rmd inoremap ,s ~~~~<++><Esc>F~hi
  265.    autocmd Filetype markdown,rmd inoremap ,e **<++><Esc>F*i
  266.    autocmd Filetype markdown,rmd inoremap ,h ====<Space><++><Esc>F=hi
  267.    autocmd Filetype markdown,rmd inoremap ,i ![](<++>)<++><Esc>F[a
  268.    autocmd Filetype markdown,rmd inoremap ,a [](<++>)<++><Esc>F[a
  269.    autocmd Filetype markdown,rmd inoremap ,1 #<Space><Enter><++><Esc>kA
  270.    autocmd FileType markdown,rmd inoremap ,u1 <ESC>O#<Space>
  271.    autocmd FileType markdown,rmd inoremap ,d1 <ESC>o#<Space>
  272.    autocmd Filetype markdown,rmd inoremap ,2 ##<Space><Enter><++><Esc>kA
  273.    autocmd FileType markdown,rmd inoremap ,u2 <ESC>O##<Space>
  274.    autocmd FileType markdown,rmd inoremap ,d2 <ESC>o##<Space>
  275.    autocmd Filetype markdown,rmd inoremap ,3 ###<Space><Enter><++><Esc>kA
  276.    autocmd FileType markdown,rmd inoremap ,u3 <ESC>O###<Space>
  277.    autocmd FileType markdown,rmd inoremap ,d3 <ESC>o###<Space>
  278.    autocmd Filetype markdown,rmd inoremap ,l --------<Enter>
  279.    autocmd Filetype markdown,rmd inoremap ,m ```<CR>```<Esc><up>A
  280.    autocmd Filetype rmd inoremap ,r ```{r}<CR>```<CR><CR><esc>2kO
  281.    autocmd Filetype rmd inoremap ,p ```{python}<CR>```<CR><CR><esc>2kO
  282.    autocmd Filetype rmd inoremap ,c ```<cr>```<cr><cr><esc>2kO
  283. """.xml
  284.     autocmd FileType xml inoremap ,e <item><Enter><title><++></title><Enter><guid<space>isPermaLink="false"><++></guid><Enter><pubDate><Esc>:put<Space>=strftime('%a, %d %b %Y %H:%M:%S %z')<Enter>kJA</pubDate><Enter><link><++></link><Enter><description><![CDATA[<++>]]></description><Enter></item><Esc>?<title><enter>cit
  285.     autocmd FileType xml inoremap ,a <a href="<++>"><++></a><++><Esc>F"ci"
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top