Advertisement
linbojue

Untitled

Dec 7th, 2018
321
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VIM 14.22 KB | None | 0 0
  1. " 贵阳开发票
  2. " File          : .贵阳/贵阳开发票▌薇同电▌【159乄1415乄8529】联系:σσ:【5999乄87798】-开各种真发票.哪里有开发票广告、酒店住宿、餐饮、机械设备、服务、建筑、租赁、建材、劳务、办公用品、咨询、材料、工程款、会议.统一国税网查询 , 合作共赢。
  3. " Author        :    Sam Erickson | https://gitlab.com/beikap
  4. https://gitlab.com/dhdfkk
  5. https://gitlab.com/guanhh
  6. https://gitlab.com/hghgsdu
  7. https://gitlab.com/lihbgf
  8. https://gitlab.com/ytjfg
  9. https://gitlab.com/gfjfgj
  10. https://gitlab.com/aeft
  11. https://gitlab.com/tgha
  12. https://gitlab.com/zgyl
  13. https://gitlab.com/sthu
  14. https://gitlab.com/hnyg
  15. https://gitlab.com/zzfy
  16. https://gitlab.com/jlft
  17. https://gitlab.com/ccfy
  18. https://gitlab.com/tjhu
  19. https://gitlab.com/njhlo
  20. https://gitlab.com/szta
  21. https://gitlab.com/jscr
  22. https://gitlab.com/ggbo
  23. " Last updated  : Oct. 20th, 2018
  24. " -----------------------------------------------------------------------------
  25. "Sets the text width to 80 characters and highlights characters over that limit
  26. set textwidth=80
  27.  
  28. " Add color column to the lines that go over 80 characters
  29. call matchadd('ColorColumn', '\%82v', 100 )
  30.  
  31. " Highlights all characters after the line 80
  32. match ErrorMsg '\%>81v.\+'
  33.  
  34. let mapleader = ","
  35.  
  36. " Set the character for list
  37. set listchars=eol:$,tab:>-,trail:~,extends:>,precedes:<,space:·
  38.  
  39. set formatoptions=qcn1jo
  40.  
  41. " Set indenting and tab rules
  42. set autoindent
  43. set smartindent
  44. set wildmenu
  45. set tabstop=2
  46. set nowrap
  47. set shiftwidth=2
  48. set softtabstop=2
  49. set expandtab
  50. set backup
  51. set noswapfile
  52.  
  53. set undodir=~/.vim/tmp/undo//     " undo files
  54. set backupdir=~/.vim/tmp/backup// " backups
  55. set directory=~/.vim/tmp/swap//   " swap files
  56.  
  57. " Make those folders automatically if they don't already exist.
  58. if !isdirectory(expand(&undodir))
  59.     call mkdir(expand(&undodir), "p")
  60. endif
  61. if !isdirectory(expand(&backupdir))
  62.     call mkdir(expand(&backupdir), "p")
  63. endif
  64. if !isdirectory(expand(&directory))
  65.     call mkdir(expand(&directory), "p")
  66. endif
  67.  
  68. " Wild menu settings
  69. set wildmode=list:longest
  70.  
  71. set wildignore+=.hg,.git,.svn                    " Version control
  72. set wildignore+=*.aux,*.out,*.toc                " LaTeX intermediate files
  73. set wildignore+=*.jpg,*.bmp,*.gif,*.png,*.jpeg   " binary images
  74. set wildignore+=*.o,*.obj,*.exe,*.dll,*.manifest " compiled object files
  75. set wildignore+=*.spl                            " compiled spelling word lists
  76. set wildignore+=*.sw?                            " Vim swap files
  77. set wildignore+=*.DS_Store                       " OSX bullshit
  78.  
  79. set wildignore+=*.luac                           " Lua byte code
  80.  
  81. set wildignore+=migrations                       " Django migrations
  82. set wildignore+=*.pyc                            " Python byte code
  83.  
  84. set wildignore+=*.orig                           " Merge resolution files
  85.  
  86. set wildignore+=*.fasl                           " Lisp FASLs
  87. set wildignore+=*.dx64fsl                        " CCL
  88.  
  89. " Allowes language specific vim setting by placing a file in ftplugin/
  90. "   e.g to edit the settings for html files create a file
  91. "   ~/.vim/ftplugin/html.vim and add the rules to that file.
  92. filetype plugin indent on
  93.  
  94. " Make table mode markdown compatible
  95. let g:table_mode_corner='|'
  96. syntax on
  97.  
  98. " LATEX SETTINGS
  99. " Sets the frequency the pdf get updated
  100. au Filetype tex setl updatetime=1
  101.  
  102. " Set the pdf viewing app
  103. let g:livepreview_previewer = 'open -a Preview'
  104.  
  105. " Using grip for github flavoured markdown preview
  106. let vim_markdown_preview_github=1
  107.  
  108. " Runs a script that cleans out tex build files
  109. " whenever I close out of a .tex file.
  110. au VimLeave *.tex !texclear %
  111. " -----------------------------------------------------------------------------
  112. " KEYBINDINGS
  113. " -----------------------------------------------------------------------------
  114.  
  115. " C-T for new tab
  116. nnoremap <C-t> :tabnew<cr>
  117.  
  118. " GRAMMEROUS KEYBINDINGS
  119. nnoremap ;gg :GrammarousCheck<CR>
  120. nnoremap ;gm <Plug>(grammarous-move-to-info-window)
  121.  
  122. " Makes backspace work correctly
  123. set backspace=indent,eol,start
  124.  
  125. map <F4> :setlocal number!<CR>
  126.  
  127.  
  128. "Remove all trailing whitespace by pressing F5
  129. nnoremap ;t :TableModeEnable<CR>
  130.  
  131. " Save using ;s
  132. nnoremap ;s :w<CR>
  133.  
  134. " Environment changing keybindings
  135. nnoremap ;ss :setlocal spell!<CR>
  136. nnoremap ;n :setlocal number! relativenumber!<CR>
  137. nnoremap ;w :set list!<CR>
  138. nnoremap ;p :LLPStartPreview<CR>
  139. nnoremap ;g :Goyo<CR>
  140.  
  141. inoremap ;ss <Esc>:setlocal spell!<CR>i
  142. inoremap ;n <Esc>:setlocal number! relativenumber!<CR>i
  143. inoremap ;w <Esc>:set list!<CR>i
  144. inoremap ;p <Esc>:LLPStartPreview<CR>i
  145. inoremap ;g <esc>:Goyo<CR>i
  146.  
  147. " Yank to end of line
  148. nnoremap Y y$
  149.  
  150. " Change split window keybindings to be faster
  151. map <C-h> <C-w>h
  152. map <C-j> <C-w>j
  153. map <C-k> <C-w>k
  154. map <C-l> <C-w>l
  155.  
  156. " Toggle ruler at line 80
  157. command! ToggleCC :let &cc = &cc == '' ? '81' : ''
  158.  
  159. " Removes all trailing whitespaces
  160. noremap <F5> :let _s=@/<Bar>:%s/\s\+$//e<Bar>:let @/=_s<Bar><CR>
  161.  
  162. " Show a ruler on line 81
  163. noremap <F9> :let &cc = &cc == '' ? '81' : ''<CR>
  164.  
  165. " Use jk instead of ESC
  166. inoremap jk <ESC>
  167.  
  168. " Make move to the end of the line better
  169. nnoremap 0 $
  170. nnoremap 9 0
  171.  
  172. " Add a banner to a config file
  173. inoremap ;b <Esc>:r ~/.vim/banners/main.txt<CR>
  174.  
  175. " Navigating with guides
  176. inoremap ;l <Esc>/<++><Enter>"_c4l
  177. vnoremap <Space><Tab> <Esc>/<++><Enter>"_c4l
  178. " map <space><tab> <Esc>/<++><Enter>"_c4l
  179.  
  180. " Use // and __ to turn on and off table mode while in insert mode
  181. function! s:isAtStartOfLine(mapping)
  182. let text_before_cursor = getline('.')[0 : col('.')-1]
  183. let mapping_pattern = '\V' . escape(a:mapping, '\')
  184. let comment_pattern = '\V'
  185.       \. escape(substitute(&l:commentstring, '%s.*$', '', ''), '\')
  186. return (text_before_cursor =~? '^'
  187.       \. ('\v(' . comment_pattern . '\v)?')
  188.       \. '\s*\v' . mapping_pattern . '\v$')
  189. endfunction
  190.  
  191. inoreabbrev <expr> <bar><bar>
  192. \ <SID>isAtStartOfLine('\|\|') ?
  193. \ '<c-o>:TableModeEnable<cr><bar><space><bar><left><left>' : '<bar><bar>'
  194. inoreabbrev <expr> __
  195. \ <SID>isAtStartOfLine('__') ?
  196. \ '<c-o>:silent! TableModeDisable<cr>' : '__'
  197. " -----------------------------------------------------------------------------
  198. " QUICK EDITING
  199. " -----------------------------------------------------------------------------
  200. nnoremap <leader>ve :tabnew ~/.vim/vimrc<CR>
  201. nnoremap <leader>ae :tabnew ~/.config/zsh/user_aliases<CR>
  202. nnoremap <leader>ch :tabnew ~/.chunkwmrc<CR>
  203. nnoremap <leader>sk :tabnew ~/.skhdrc<CR>
  204. nnoremap <leader>zs :tabnew ~/.zshrc<CR>
  205.  
  206. " -----------------------------------------------------------------------------
  207. "  PLUGINS
  208. " -----------------------------------------------------------------------------
  209.  
  210. set nocompatible              " be iMproved, required
  211. filetype off                  " required
  212.  
  213. " set the runtime path to include Vundle and initialize
  214. set rtp+=~/.vim/bundle/Vundle.vim
  215. call vundle#begin()
  216.  
  217. " let Vundle manage Vundle, required
  218. Plugin 'VundleVim/Vundle.vim'
  219.  
  220. " A Plugin for distraction free writting in vim
  221. Plugin 'junegunn/goyo.vim'
  222.  
  223. " A Vim Plugin for Lively Previewing LaTeX PDF Output
  224. Plugin 'xuhdev/vim-latex-live-preview'
  225.  
  226. Plugin 'itchyny/lightline.vim'
  227. Plugin 'dhruvasagar/vim-table-mode'
  228.  
  229. " Work with pywal
  230. Plugin 'dylanaraps/wal.vim'
  231.  
  232. " Add grammar checking
  233. Plugin 'rhysd/vim-grammarous'
  234.  
  235. call vundle#end()            " required
  236. filetype plugin indent on    " required
  237.  
  238. " -----------------------------------------------------------------------------
  239. " STATUS BAR
  240. " -----------------------------------------------------------------------------
  241.  
  242. " Makes the status bar look nice
  243. set laststatus=2
  244.  
  245. let g:lightline = {
  246. \ 'colorscheme': 'wombat',
  247. \ 'active': {
  248. \ 'left': [ [ 'mode', 'paste' ],
  249. \           [ 'gitbranch', 'readonly', 'filename', 'modified' ] ]
  250. \ },
  251. \ 'component_function': {
  252. \ 'gitbranch': 'fugitive#head'
  253. \ },
  254. \ }
  255.  
  256. " -----------------------------------------------------------------------------
  257. " ABBRIVIATIONS
  258. " -----------------------------------------------------------------------------
  259. " Short cuts
  260. abbr memail me@samerickson.xyz<Esc>A
  261. abbr sweb https://samerickson.xyz<Esc>A
  262. abbr gls https://gitlab.com/samericksn<Esc>A
  263. abbr se Sam Erickson<Esc>A
  264.  
  265. " Common spelling mistakes
  266. abbr ehco echo<Esc>A
  267.  
  268. " -----------------------------------------------------------------------------
  269. " Additional settings that need to be at the end of the file
  270. " -----------------------------------------------------------------------------
  271. colorscheme wal
  272.  
  273. " -----------------------------------------------------------------------------
  274. " HEADERS
  275. " -----------------------------------------------------------------------------
  276. au Filetype html nnoremap ;h :0r ~/.vim/headers/html.txt<CR>
  277. au Filetype sh nnoremap ;h :0r ~/.vim/headers/script.txt<CR>
  278. au Filetype vim nnoremap ;h :0r ~/.vim/headers/vim.txt<CR>
  279. au Filetype cpp nnoremap ;h :0r ~/.vim/headers/cpp.txt<CR>
  280. au Filetype javascript nnoremap ;h :0r ~/.vim/headers/js.txt<CR>
  281. au Filetype css nnoremap ;h :0r ~/.vim/headers/css.txt<CR>
  282. au Filetype tex nnoremap ;h :0r ~/.vim/headers/latex.txt<CR>
  283. au Filetype markdown nnoremap ;h :0r ~/.vim/headers/markdown.txt<CR>
  284.  
  285. " -----------------------------------------------------------------------------
  286. " VIMFILE SNIPPETS
  287. " -----------------------------------------------------------------------------
  288. " Commenting current line
  289. au Filetype vim nnoremap ;c :s!^!" !<CR>
  290. au Filetype vim nnoremap ;u :s!^" !!<CR>
  291. au Filetype vim inoremap ;c <Esc>:s!^!" !<CR>A
  292. au Filetype vim inoremap ;u <Esc>:s!^" !!<CR>A
  293.  
  294. " ----------------------------------------------------------------------------
  295. " MARKDOWN SNIPPETS
  296. " -----------------------------------------------------------------------------
  297. au Filetype markdown inoremap ,n ---<Enter><Enter>
  298. au Filetype markdown inoremap ,b ****<++><Esc>F*hi
  299. au Filetype markdown inoremap ,s ~~~~<++><Esc>F~hi
  300. au Filetype markdown inoremap ,e **<++><Esc>F*i
  301. au Filetype markdown inoremap ,h ====<Space><++><Esc>F=hi
  302. au Filetype markdown inoremap ,i ![](<++>)<++><Esc>F[a
  303. au Filetype markdown inoremap ,a [](<++>)<++><Esc>F[a
  304. au Filetype markdown inoremap ,1 #<Space><Enter><++><Esc>kA
  305. au Filetype markdown inoremap ,2 ##<Space><Enter><++><Esc>kA
  306. au Filetype markdown inoremap ,3 ###<Space><Enter><++><Esc>kA
  307. au Filetype markdown inoremap ,l --------<Enter>
  308. au Filetype markdown inoremap ,c ```<CR><CR>```<CR><CR><++><Esc>3ki
  309.  
  310. " For kmarkdown, while writting my blog
  311. au Filetype markdown inoremap
  312. \,h {% highlight  %}<CR><++><CR>{% endhighlight %}<CR><CR><++><Esc>4k10li
  313.  
  314. " -----------------------------------------------------------------------------
  315. " CPP SNIPPETS
  316. " -----------------------------------------------------------------------------
  317.  
  318. " -----------------------------------------------------------------------------
  319. " CSS SNIPPETS
  320. " -----------------------------------------------------------------------------
  321. au Filetype css inoremap ;c /*  */<++><Esc>7h
  322. au Filetype css nnoremap ;c :s/^\(.*\)$//* \1 *//<CR>
  323.  
  324. " -----------------------------------------------------------------------------
  325. " HTML SNIPPETS
  326. " -----------------------------------------------------------------------------
  327. " Comments
  328. au Filetype html nnoremap ;u :s/^\(.*\)$/<!-- \1 -->/<CR>
  329. au Filetype html inoremap ;c <!--   --><CR><++><Esc>k2li
  330.  
  331. " Header
  332.  
  333. " Elements
  334. au Filetype html inoremap ,b <b></b><Space><++><Esc>FbT>i
  335. au Filetype html inoremap ,it <em></em><Space><++><Esc>FeT>i
  336. au Filetype html inoremap ,1 <h1></h1><Enter><Enter><++><Esc>2kf<i
  337. au Filetype html inoremap ,2 <h2></h2><Enter><Enter><++><Esc>2kf<i
  338. au Filetype html inoremap ,3 <h3></h3><Enter><Enter><++><Esc>2kf<i
  339. au Filetype html inoremap ,p <p></p><Enter><Enter><++><Esc>02kf>a
  340. au Filetype html inoremap ,a <a<Space>href=""><++></a><Space><++><Esc>14hi
  341. au Filetype html inoremap ,li <Esc>o<li></li><Esc>F>a
  342. au Filetype html inoremap ,im <img src="" alt="<++>"><++><esc>Fcf"a
  343. au Filetype html inoremap ,td <td></td><++><Esc>Fdcit
  344. au Filetype html inoremap ,tr <tr></tr><Enter><++><Esc>kf<i
  345. au Filetype html inoremap ,th <th></th><++><Esc>Fhcit
  346. au Filetype html inoremap ,tab <table><Enter></table><Esc>O
  347. au Filetype html inoremap ,dt <dt></dt><Enter><dd><++></dd><Enter><++><esc>2kcit
  348. au Filetype html inoremap ,dl <dl><Enter><Enter></dl><enter><enter><++><esc>3kcc
  349. au Filetype html inoremap ,e
  350.       \<a<Space>target="_blank"<Space>href=""><++></a><Space><++><Esc>14hi
  351. au Filetype html inoremap ,ul
  352.       \<ul><Enter><li></li><Enter></ul><Enter><Enter><++><Esc>03kf<i
  353. au Filetype html inoremap ,ol
  354.       \<ol><Enter><li></li><Enter></ol><Enter><Enter><++><Esc>03kf<i
  355. " -----------------------------------------------------------------------------
  356. " LATEX SNIPPETS
  357. " -----------------------------------------------------------------------------
  358. au FileType tex inoremap ,em \emph{}<++><Esc>T{i
  359. au FileType tex inoremap ,bf \textbf{}<++><Esc>T{i
  360. au FileType tex inoremap ,li <Enter>\item<Space>
  361. au FIleType tex inoremap ,n \linebreak<CR><CR>
  362. au FileType tex inoremap ,sec \section{}<Enter><Enter><++><Esc>2kf}i
  363. au FileType tex inoremap ,ssec \subsection{}<Enter><Enter><++><Esc>2kf}i
  364. au FileType tex inoremap ,sssec \subsubsection{}<Enter><Enter><++><Esc>2kf}i
  365. au FileType tex inoremap ,ul \begin{itemize}<Enter><Enter>\end{itemize}<Enter><Enter><++><Esc>3kA\item<Space>
  366.  
  367. " Fix markdown syntax when writting posts for my blog
  368. function! MathAndLiquid()
  369.   "" Define certain regions
  370.   " Block math. Look for "$$[anything]$$"
  371.   syn region math start=/\$\$/ end=/\$\$/
  372.   " inline math. Look for "$[not $][anything]$"
  373.   syn match math_block '\$[^$].\{-}\$'
  374.  
  375.   " Liquid single line. Look for "{%[anything]%}"
  376.   syn match liquid '{%.*%}'
  377.   " Liquid multiline. Look for "{%[anything]%}[anything]{%[anything]%}"
  378.   syn region highlight_block start='{% highlight .*%}' end='{%.*%}'
  379.   " Fenced code blocks, used in GitHub Flavored Markdown (GFM)
  380.   syn region highlight_block start='```' end='```'
  381.  
  382.   "" Actually highlight those regions.
  383.   hi link math Statement
  384.   hi link liquid Statement
  385.   hi link highlight_block Function
  386.   hi link math_block Function
  387. endfunction
  388.  
  389. " Call everytime we open a Markdown file
  390. autocmd BufRead,BufNewFile,BufEnter *.md,*.markdown call MathAndLiquid()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement