mosaid

my vimrc file

Mar 27th, 2019
294
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VIM 22.83 KB | None | 0 0
  1. "
  2. " vimrc
  3. "
  4. " ================ plugin manager   {{{
  5. set nocompatible
  6. filetype off
  7. execute pathogen#infect()
  8. call pathogen#helptags()
  9. syntax on
  10. filetype plugin indent on
  11.  
  12. "}}}
  13. " ================ General Config   {{{
  14.  
  15. set backspace=indent,eol,start  "Allow backspace in insert mode
  16. set showcmd                     "Show incomplete cmds down the bottom
  17. set showmode                    "Show current mode down the bottom
  18. set gcr=a:blinkon0              "Disable cursor blink
  19. set visualbell                  "No sounds
  20. set autoread                    "Reload files changed outside vim
  21. set hidden
  22. set cursorline
  23. set modeline
  24. set mouse=n
  25. set encoding=utf-8
  26. set isfname+=32
  27. set showmatch                   "highlight matching [{{{()}}}]
  28. set lazyredraw
  29. set tw=80
  30.  
  31.  
  32. set t_Co=256
  33. "color wombat256mod
  34.  
  35. set title titlestring=
  36. set completeopt-=preview
  37.  
  38. set splitbelow splitright
  39.  
  40.  
  41. "command history undo backup
  42. set history=1000
  43. set undofile     " hello world
  44. set undodir=~/.vim/undo
  45. set undolevels=1000
  46. set undoreload=10000
  47. set backupdir=~/.vim/backup
  48. set directory=~/.vim/backup
  49. set viminfo='100000
  50.  
  51. " Scrolling
  52. set scrolloff=8         "Start scrolling when we're 8 lines away from margins
  53. set sidescrolloff=0
  54. set sidescroll=0
  55.  
  56.  
  57. " Folds
  58. set foldenable          " enable folding
  59. set foldlevelstart=0    " open most folds by default
  60. set foldnestmax=10      " 10 nested fold max
  61. set foldmethod=marker   " fold based on marker
  62. " toggle folding
  63. nnoremap <space> za
  64. " unfold all
  65. nnoremap <F7> zR
  66. " fold all
  67. nnoremap <F8> :foldc!<CR>
  68.  
  69. " Search
  70. set incsearch       " Find the next match as we type the search
  71. set hlsearch        " Highlight searches by default
  72. set ignorecase      " Ignore case when searching...
  73. set smartcase       " ...unless we type a capital
  74.  
  75. " relative numbers
  76. :set number relativenumber
  77.  
  78. :augroup numbertoggle
  79. :  autocmd!
  80. :  autocmd BufEnter,FocusGained,InsertLeave * set relativenumber
  81. :  autocmd BufLeave,FocusLost,InsertEnter   * set norelativenumber
  82. :augroup END
  83.  
  84.  
  85. "}}}
  86. " ================ leader   {{{
  87.  
  88. let mapleader=";"
  89. noremap <leader><leader> <C-^>
  90. noremap <leader>cc :<ESC>gg"+yG<ESC>
  91. noremap <leader>y yiW
  92.  
  93. " }}}
  94. " ================ arabic/english   {{{
  95.  
  96. " Switch to English - mapping
  97. nnoremap <Leader>z :<C-U>call EngType()<CR>
  98. " Switch to Arabic - mapping
  99. nnoremap <Leader>a :<C-U>call AraType()<CR>
  100.  
  101. " Switch to English - function
  102. function! EngType()
  103.   " To switch back from Arabic
  104.   set norightleft
  105. endfunction
  106.  
  107. " Switch to Arabic - function
  108. function! AraType()
  109.   set rightleft
  110.   set arabicshape
  111.   set arabic
  112. endfunction
  113.  
  114. " }}}
  115. " ================ Indentation   {{{
  116.  
  117. set cindent
  118. set autoindent
  119. set smartindent
  120. set smarttab
  121. set shiftwidth=4
  122. set softtabstop=4
  123. set tabstop=4
  124. set expandtab
  125. set shiftround
  126.  
  127. " Auto indent pasted text
  128. nnoremap p p=`]<C-o>
  129. nnoremap P P=`]<C-o>
  130.  
  131. filetype plugin on
  132. filetype indent on
  133.  
  134. " Display tabs and trailing spaces visually
  135. set list listchars=tab:\ \ ,trail:·
  136.  
  137. set nowrap       "Don't wrap lines
  138.  
  139. " }}}
  140. " ================ Completion   {{{
  141.  
  142. set wildmode=list:longest
  143. set wildmenu                "enable ctrl-n and ctrl-p to scroll thru matches
  144. set wildignore=*.o,*.obj,*~ "stuff to ignore when tab completing
  145. set wildignore+=*vim/backups*
  146. set wildignore+=*sass-cache*
  147. set wildignore+=*DS_Store*
  148. set wildignore+=vendor/rails/**
  149. set wildignore+=vendor/cache/**
  150. set wildignore+=*.gem
  151. set wildignore+=log/**
  152. set wildignore+=tmp/**
  153. set wildignore+=*.png,*.jpg,*.gif
  154.  
  155. " }}}
  156. " ================ highlighting and cursor   {{{
  157.  
  158.  
  159. :hi CursorLine      ctermbg=7          ctermfg=black     term=bold cterm=bold
  160. :hi CursorColumn    ctermbg=darkred    ctermfg=white    term=bold cterm=bold
  161. :hi Normal          ctermbg=black      ctermfg=none     term=bold cterm=bold
  162. :hi Visual          ctermbg=lightred   ctermfg=black    term=bold cterm=bold
  163. :hi Folded          ctermbg=black      ctermfg=red      term=bold cterm=bold
  164. :hi FoldColumn      ctermbg=green      ctermfg=yellow   term=bold cterm=bold
  165. :hi Search          ctermbg=yellow     ctermfg=black    term=bold cterm=bold
  166.  
  167. ":hi MyGroup cterm=bold
  168. ":match MyGroup /./
  169.  
  170. "make block cursor
  171. let &t_ti.="\e[1 q"
  172. let &t_SI.="\e[5 q"
  173. let &t_EI.="\e[1 q"
  174. let &t_te.="\e[0 q"
  175.  
  176. " }}}
  177. " ================ differnt settings   {{{
  178.  
  179. " open file externally
  180. nnoremap <leader>o :silent !xdg-open <cfile>&<CR>
  181.  
  182. "leader n highlight current word and search it
  183. :nnoremap <leader>n :let @/='\<<C-R>=expand("<cword>")<CR>\>'<CR>:set hls<CR>
  184.  
  185. " set current directory to the directory of the current file
  186. autocmd BufEnter * if expand("%:p:h") !~ '^/tmp' | silent! lcd %:p:h | endif
  187.  
  188. " Quick write session with F2
  189. map <F2> :mksession! ~/.vim/vim_session <cr>
  190.  
  191. " And load session with F3
  192. map <F3> :source ~/.vim/vim_session <cr>
  193.  
  194. " Automatically deletes all trailing whitespace on save.
  195. autocmd BufWritePre * %s/\s\+$//e
  196. " remember last position
  197. if has("autocmd")
  198.     au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
  199. endif
  200.  
  201. " }}}
  202. " ================ mouvements and buffers    {{{
  203.  
  204. "f5 to show buffers
  205. :nnoremap <F5> :buffers<CR>:buffer<Space>
  206. nmap <F6> :TagbarToggle<CR>
  207.  
  208. "window mouvements
  209. nnoremap <down>     <C-W><C-J>
  210. nnoremap <up>       <C-W><C-K>
  211. nnoremap <right>    <C-W><C-L>
  212. nnoremap <left>     <C-W><C-H>
  213.  
  214. " ================ moving around
  215. nmap <silent> <A-Up>    :wincmd k<CR>
  216. nmap <silent> <A-Down>  :wincmd j<CR>
  217. nmap <silent> <A-Left>  :wincmd h<CR>
  218. nmap <silent> <A-Right> :wincmd l<CR>
  219.  
  220. " ================ moving blocks of code
  221. vnoremap < <gv
  222. vnoremap > >gv
  223.  
  224. " cycle through buffers
  225. :nnoremap <Tab> :bnext<CR>
  226. :nnoremap <S-Tab> :bprevious<CR>
  227.  
  228. " this function is a great way to open old files
  229. function! Output()
  230.     enew | 0put =v:oldfiles| nnoremap <buffer> <CR> :e <C-r>=getline('.')<CR><CR>|normal gg<CR>
  231.     setlocal buftype=nofile bufhidden=wipe noswapfile nowrap
  232.     "setlocal buftype=nofile bufhidden=wipe nobuflisted noswapfile nowrap
  233. endfunction
  234.  
  235. :command! Browse call Output()
  236. :command! Mm     call Output()
  237. :command! MM     call Output()
  238.  
  239. " ????
  240. "command! -nargs=1 -complete=help H :enew | :set buftype=help | :h <args>
  241.  
  242. " ????
  243. "if has("autocmd")
  244. "    au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
  245. "endif
  246.  
  247. " }}}
  248.  
  249. " ================ Ranger   {{{
  250.  
  251. "let g:ranger_map_keys = 0
  252.  
  253. " add this line if you use NERDTree
  254. let g:NERDTreeHijackNetrw = 0
  255.  
  256. " open ranger when vim open a directory
  257. let g:ranger_replace_netrw = 1
  258.  
  259.  
  260. " }}}
  261. " ================ nerd tree   {{{
  262.  
  263. let NERDTreeIgnore = ['__pycache__', '\.pyc$', '\.o$', '\.so$',
  264. \ '\.a$', '\.swp',  '*\.swp', '\.swo', '\.swn', '\.swh',
  265. \ '\.swm', '\.swl', '\.swk', '\.sw*$',  '[a-zA-Z]*egg[a-zA-Z]*',
  266. \ '.DS_Store']
  267.  
  268. let NERDTreeShowHidden=1
  269. let g:NERDTreeWinPos="left"
  270. let g:NERDTreeDirArrows=1
  271. map <C-t> :NERDTreeToggle %<CR>
  272.  
  273. " }}}
  274. " ================ YouCompleteMe   {{{
  275.  
  276. let g:ycm_global_ycm_extra_conf = '~/.vim/bundle/YouCompleteMe/.ycm_extra_conf.py'
  277. let g:ycm_add_preview_to_completeopt = 0
  278. "let g:ycm_autoclose_preview_window_after_insertion = 1
  279. "let g:ycm_autoclose_preview_window_after_completion = 1
  280. let g:ycm_collect_identifiers_from_tags_files = 1
  281. "set tags+=~/.vim/tags/testtags
  282.  
  283. let g:ycm_key_list_select_completion = ['<C-j>', '<Down>']
  284. let g:ycm_key_list_previous_completion = ['<C-k>', '<Up>']
  285. let g:ycm_key_list_accept_completion = ['<C-y>']
  286.  
  287. " Additional YouCompleteMe config.
  288. let g:ycm_complete_in_comments = 1
  289. let g:ycm_collect_identifiers_from_comments_and_strings = 1
  290. let g:ycm_seed_identifiers_with_syntax = 1
  291.  
  292. let g:ycm_server_python_interpreter='python3'
  293. map <leader>g :YcmCompleter GoToDefinitionElseDeclaration<CR>
  294.  
  295.  
  296. " Disable unhelpful semantic completions.
  297. "let g:ycm_filetype_specific_completion_to_disable = {
  298. "            \   'c': 1,
  299. "            \   'gitcommit': 1,
  300. "            \   'haskell': 1,
  301. "            \   'javascript': 1,
  302. "            \   'ruby': 1
  303. "            \ }
  304. "
  305. let g:ycm_semantic_triggers = {
  306.             \   'haskell': [
  307.             \     '.',
  308.             \     '(',
  309.             \     ',',
  310.             \     ', '
  311.             \   ]
  312.             \ }
  313.  
  314. " Same as default, but with "markdown" and "text" removed.
  315. let g:ycm_filetype_blacklist = {
  316.             \   'notes': 1,
  317.             \   'unite': 1,
  318.             \   'tagbar': 1,
  319.             \   'pandoc': 1,
  320.             \   'qf': 1,
  321.             \   'vimwiki': 1,
  322.             \   'infolog': 1,
  323.             \   'mail': 1
  324.             \ }
  325.  
  326.  
  327. " }}}
  328. " ================ dragvisuals   {{{
  329.  
  330. runtime plugin/dragvisuals.vim
  331.  
  332. vmap  <expr>  <LEFT>   DVB_Drag('left')
  333. vmap  <expr>  <RIGHT>  DVB_Drag('right')
  334. vmap  <expr>  <DOWN>   DVB_Drag('down')
  335. vmap  <expr>  <UP>     DVB_Drag('up')
  336. vmap  <expr>  D        DVB_Duplicate()
  337.  
  338. " Remove any introduced trailing whitespace after moving...
  339. let g:DVB_TrimWS = 1
  340.  
  341. vmap <expr>  ++  VMATH_YankAndAnalyse()
  342. nmap         ++  vip++
  343.  
  344. " }}}
  345. " ================ HardMode   {{{
  346.  
  347. "autocmd VimEnter,BufNewFile,BufReadPost * silent! call HardMode()
  348. nnoremap <leader>h <Esc>:call EasyMode()<CR>
  349. nnoremap <leader>H <Esc>:call HardMode()<CR>
  350.  
  351. " }}}
  352. " ================ CommandT   {{{
  353.  
  354. let g:CommandTMaxFiles=2000000
  355.  
  356. " }}}
  357. " ================ fzf   {{{
  358.  
  359. " This is the default extra key bindings
  360. let g:fzf_action = {
  361.   \ 'ctrl-t': 'tab split',
  362.   \ 'ctrl-x': 'split',
  363.   \ 'ctrl-v': 'vsplit' }
  364.  
  365. " Default fzf layout
  366. " - down / up / left / right
  367. let g:fzf_layout = { 'down': '~40%' }
  368.  
  369. " Customize fzf colors to match your color scheme
  370. let g:fzf_colors =
  371. \ { 'fg':      ['fg', 'Normal'],
  372.   \ 'bg':      ['bg', 'Normal'],
  373.   \ 'hl':      ['fg', 'Comment'],
  374.   \ 'fg+':     ['fg', 'CursorLine', 'CursorColumn', 'Normal'],
  375.   \ 'bg+':     ['bg', 'CursorLine', 'CursorColumn'],
  376.   \ 'hl+':     ['fg', 'Statement'],
  377.   \ 'info':    ['fg', 'PreProc'],
  378.   \ 'border':  ['fg', 'Ignore'],
  379.   \ 'prompt':  ['fg', 'Conditional'],
  380.   \ 'pointer': ['fg', 'Exception'],
  381.   \ 'marker':  ['fg', 'Keyword'],
  382.   \ 'spinner': ['fg', 'Label'],
  383.   \ 'header':  ['fg', 'Comment'] }
  384.  
  385. " Enable per-command history.
  386. " CTRL-N and CTRL-P will be automatically bound to next-history and
  387. " previous-history instead of down and up. If you don't like the change,
  388. " explicitly bind the keys to down and up in your $FZF_DEFAULT_OPTS.
  389. let g:fzf_history_dir = '~/.local/share/fzf-history'
  390.  
  391. " local commands
  392.  
  393. " [Buffers] Jump to the existing window if possible
  394. let g:fzf_buffers_jump = 1
  395.  
  396. " [[B]Commits] Customize the options used by 'git log':
  397. let g:fzf_commits_log_options = '--graph --color=always --format="%C(auto)%h%d %s %C(black)%C(bold)%cr"'
  398.  
  399. " [Tags] Command to generate tags file
  400. let g:fzf_tags_command = 'ctags -R'
  401.  
  402. " [Commands] --expect expression for directly executing the command
  403. let g:fzf_commands_expect = 'alt-enter,ctrl-x'
  404.  
  405. " Mapping selecting mappings
  406. nmap <leader><tab> <plug>(fzf-maps-n)
  407. xmap <leader><tab> <plug>(fzf-maps-x)
  408. omap <leader><tab> <plug>(fzf-maps-o)
  409.  
  410. " Insert mode completion
  411. imap <c-x><c-k> <plug>(fzf-complete-word)
  412. imap <c-x><c-f> <plug>(fzf-complete-path)
  413. imap <c-x><c-j> <plug>(fzf-complete-file-ag)
  414. imap <c-x><c-l> <plug>(fzf-complete-line)
  415.  
  416. " Search and switch buffers
  417. nmap <leader>b :Buffers<cr>
  418. " Find files by name under the current directory
  419. nmap <leader>f :Files<cr>
  420. " Find files by name under the home directory
  421. nmap <leader>h :Files ~/<cr>
  422. " Search content in the current file
  423. nmap <leader>l :BLines<cr>
  424.  
  425. " Advanced customization using autoload functions
  426. inoremap <expr> <c-x><c-k> fzf#vim#complete#word({{{'left': '15%'}}})
  427.  
  428. "Custom statusline
  429.  
  430. function! s:fzf_statusline()
  431.   " Override statusline as you like
  432.   highlight fzf1 ctermfg=161 ctermbg=251
  433.   highlight fzf2 ctermfg=23 ctermbg=251
  434.   highlight fzf3 ctermfg=237 ctermbg=251
  435.   setlocal statusline=%#fzf1#\ >\ %#fzf2#fz%#fzf3#f
  436. endfunction
  437.  
  438. autocmd! User FzfStatusLine call <SID>fzf_statusline()
  439.  
  440. " }}}
  441. " ================ ultisnips   {{{
  442.  
  443.     " YouCompleteMe and UltiSnips compatibility.
  444.     let g:UltiSnipsExpandTrigger = '<Tab>'
  445.     let g:UltiSnipsJumpForwardTrigger = '<Tab>'
  446.     let g:UltiSnipsJumpBackwardTrigger = '<S-Tab>'
  447.  
  448.     " Prevent UltiSnips from removing our carefully-crafted mappings.
  449.     let g:UltiSnipsMappingsToIgnore = ['autocomplete']
  450.  
  451.     "" Additional UltiSnips config.
  452.     "let g:UltiSnipsSnippetsDir = '~/.vim/ultisnips'
  453.     "let g:UltiSnipsSnippetDirectories = ['ultisnips']
  454. " }}}
  455. " ================ vim-latex-preview   {{{
  456.     let g:livepreview_previewer = 'okular'
  457.     let g:livepreview_engine = 'xelatex'
  458.     let g:livepreview_cursorhold_recompile = 0
  459. " }}}
  460. "  ================ vim prettier {{{
  461. " max line length that prettier will wrap on
  462. " Prettier default: 80
  463. let g:prettier#config#print_width = 120
  464.  
  465. " number of spaces per indentation level
  466. " Prettier default: 2
  467. let g:prettier#config#tab_width = 4
  468.  
  469. " use tabs over spaces
  470. " Prettier default: false
  471. let g:prettier#config#use_tabs = 'true'
  472.  
  473. " print semicolons
  474. " Prettier default: true
  475. let g:prettier#config#semi = 'true'
  476.  
  477. " single quotes over double quotes
  478. " Prettier default: false
  479. let g:prettier#config#single_quote = 'true'
  480.  
  481. " print spaces between brackets
  482. " Prettier default: true
  483. let g:prettier#config#bracket_spacing = 'false'
  484.  
  485. " put > on the last line instead of new line
  486. " Prettier default: false
  487. let g:prettier#config#jsx_bracket_same_line = 'true'
  488.  
  489. " avoid|always
  490. " Prettier default: avoid
  491. let g:prettier#config#arrow_parens = 'always'
  492.  
  493. " none|es5|all
  494. " Prettier default: none
  495. let g:prettier#config#trailing_comma = 'all'
  496.  
  497. " flow|babylon|typescript|css|less|scss|json|graphql|markdown
  498. " Prettier default: babylon
  499. let g:prettier#config#parser = 'flow'
  500.  
  501. " cli-override|file-override|prefer-file
  502. let g:prettier#config#config_precedence = 'prefer-file'
  503.  
  504. " always|never|preserve
  505. let g:prettier#config#prose_wrap = 'preserve'
  506.  
  507. " css|strict|ignore
  508. let g:prettier#config#html_whitespace_sensitivity = 'css'
  509.  
  510. " when running at every change you may want to disable quickfix
  511. let g:prettier#quickfix_enabled = 0
  512.  
  513. let g:prettier#autoformat = 0
  514. autocmd BufWritePre *.js,*.jsx,*.mjs,*.ts,*.tsx,*.css,*.less,*.scss,*.json,*.graphql,*.md,*.vue,*.yaml,*.html PrettierAsync
  515.  
  516. "  }}}
  517.  
  518. " ================ my snippets   {{{
  519.      "inoremap <leader><leader> <esc>/<++><Enter>"_c4l
  520.      "vnoremap <leader><leader> <esc>/<++><Enter>"_c4l
  521.  
  522.     " ===== php   {{{
  523.         autocmd FileType php setlocal foldmethod=syntax
  524.         autocmd FileType php inoremap ;bb <ESC>:0r ~/.vim/mysnippets/php/b1<CR>
  525.     " }}}
  526.     " ===== HTML   {{{
  527.     "autocmd FileType html setlocal foldmethod=syntax
  528.     autocmd FileType html inoremap ;bb <ESC>:0r ~/.vim/mysnippets/php/b1<CR>
  529.     autocmd FileType html inoremap ;b <b></b><Space><++><Esc>FbT>i
  530.     autocmd FileType html inoremap ;it <em></em><Space><++><Esc>FeT>i
  531.     autocmd FileType html inoremap ;1 <h1></h1><Enter><Enter><++><Esc>2kf<i
  532.     autocmd FileType html inoremap ;2 <h2></h2><Enter><Enter><++><Esc>2kf<i
  533.     autocmd FileType html inoremap ;3 <h3></h3><Enter><Enter><++><Esc>2kf<i
  534.     autocmd FileType html inoremap ;p <p></p><Enter><Enter><++><Esc>02kf>a
  535.     autocmd FileType html inoremap ;a <a<Space>href=""><++></a><Space><++><Esc>14hi
  536.     autocmd FileType html inoremap ;e <a<Space>target="_blank"<Space>href=""><++></a><Space><++><Esc>14hi
  537.     autocmd FileType html inoremap ;ul <ul><Enter><li></li><Enter></ul><Enter><Enter><++><Esc>03kf<i
  538.     autocmd FileType html inoremap ;li <Esc>o<li></li><Esc>F>a
  539.     autocmd FileType html inoremap ;ol <ol><Enter><li></li><Enter></ol><Enter><Enter><++><Esc>03kf<i
  540.     autocmd FileType html inoremap ;im <img src="" alt="<++>"><++><esc>Fcf"a
  541.     autocmd FileType html inoremap ;td <td></td><++><Esc>Fdcit
  542.     autocmd FileType html inoremap ;tr <tr></tr><Enter><++><Esc>kf<i
  543.     autocmd FileType html inoremap ;th <th></th><++><Esc>Fhcit
  544.     autocmd FileType html inoremap ;tab <table><Enter></table><Esc>O
  545.     autocmd FileType html inoremap ;gr <font color="green"></font><Esc>F>a
  546.     autocmd FileType html inoremap ;rd <font color="red"></font><Esc>F>a
  547.     autocmd FileType html inoremap ;yl <font color="yellow"></font><Esc>F>a
  548.     autocmd FileType html inoremap ;dt <dt></dt><Enter><dd><++></dd><Enter><++><esc>2kcit
  549.     autocmd FileType html inoremap ;dl <dl><Enter><Enter></dl><enter><enter><++><esc>3kcc
  550.     autocmd FileType html inoremap &<space> &amp;<space>
  551.     autocmd FileType html inoremap á &aacute;
  552.     autocmd FileType html inoremap é &eacute;
  553.     autocmd FileType html inoremap í &iacute;
  554.     autocmd FileType html inoremap ó &oacute;
  555.     autocmd FileType html inoremap ú &uacute;
  556.     autocmd FileType html inoremap ä &auml;
  557.     autocmd FileType html inoremap ë &euml;
  558.     autocmd FileType html inoremap ï &iuml;
  559.     autocmd FileType html inoremap ö &ouml;
  560.     autocmd FileType html inoremap ü &uuml;
  561.     autocmd FileType html inoremap ã &atilde;
  562.     autocmd FileType html inoremap ẽ &etilde;
  563.     autocmd FileType html inoremap ĩ &itilde;
  564.     autocmd FileType html inoremap õ &otilde;
  565.     autocmd FileType html inoremap ũ &utilde;
  566.     autocmd FileType html inoremap ñ &ntilde;
  567.     autocmd FileType html inoremap à &agrave;
  568.     autocmd FileType html inoremap è &egrave;
  569.     autocmd FileType html inoremap ì &igrave;
  570.     autocmd FileType html inoremap ò &ograve;
  571.     autocmd FileType html inoremap ù &ugrave;
  572.  
  573.     " }}}
  574.     "  ===== python   {{{
  575.  
  576.     autocmd FileType python setlocal foldmethod=indent
  577.     autocmd FileType python setlocal foldnestmax=1
  578.     autocmd FileType python setlocal colorcolumn=0
  579.     "autocmd FileType python setlocal completeopt-=preview
  580.     autocmd FileType python nnoremap <LocalLeader>= :0,$!yapf<CR>
  581.     autocmd FileType python inoremap ;ma <ESC>:r ~/.vim/mysnippets/python/main<CR>
  582.     autocmd FileType python inoremap ;sh <ESC>:0r ~/.vim/mysnippets/python/shabang<CR>
  583.  
  584.     " ================ python-mode
  585.     " cancel it
  586.     " let g:pymode_rope_completion = 0
  587.     let g:pymode_lint = 0
  588.     " ================ jedi
  589.  
  590.     let g:jedi#goto_command = "<leader>d"
  591.     let g:jedi#goto_assignments_command = "<leader>g"
  592.     let g:jedi#goto_definitions_command = "enew"
  593.     let g:jedi#documentation_command = "K"
  594.     let g:jedi#usages_command = "<leader>n"
  595.     let g:jedi#completions_command = "<C-Space>"
  596.     let g:jedi#rename_command = "<leader>r"
  597.  
  598.  
  599.     "  }}}
  600.     "  ===== latex   {{{
  601.  
  602.     set grepprg=grep\ -nH\ $*
  603.     let g:tex_flavor = "latex"
  604.     set runtimepath+=~/.vim,$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after,~/.vim/after
  605.     let g:Tex_DefaultTargetFormat = 'pdf'
  606.     let g:Tex_CompileRule_pdf = 'latexmk -pdf -pv -g'
  607.     let g:Tex_UseMakefile=1
  608.     let g:Tex_ViewRule_pdf='zathura'
  609.     let g:Tex_Menus=0
  610.     let g:Tex_FoldedCommands='ctable'
  611.  
  612.     autocmd FileType tex map <leader>c  :LLPStartPreview<CR>
  613.  
  614.     "function CompileLatexPDF()
  615.     "    !xelatex %
  616.     "endfunction
  617.     "
  618.     "function OpenLatexPDF()
  619.     "    !okular '%:r'.'pdf' &
  620.     "endfunction
  621.     "
  622.     "" Open corresponding .pdf
  623.     "  map <leader>p  :call OpenLatexPDF()<CR><CR>
  624.     "  :command! OpenLatexPDF call OpenLatexPDF()<CR><CR><CR>
  625.     "
  626.     "" Compile document
  627.     "   "map <leader>c  :call Tex_RunLaTeX()<CR>
  628.     "  ":command! CompileTex call Tex_RunLaTeX()
  629.     "  map <leader>c  :call CompileLatexPDF()<CR>
  630.     "  :command! CompileTex call CompileLatexPDF()
  631.     "
  632.  
  633.     " Word count:
  634.     autocmd FileType tex map <F3> :w !detex \| wc -w<CR>
  635.     autocmd FileType tex inoremap <F3> <Esc>:w !detex \| wc -w<CR>
  636.     " Compile document using xelatex:
  637.     autocmd FileType tex inoremap <F5> <Esc>:!xelatex<space><c-r>%<Enter>a
  638.     autocmd FileType tex nnoremap <F5> :!xelatex<space><c-r>%<Enter>
  639.     " Code snippets
  640.     autocmd FileType tex inoremap ;na <ESC>:r ~/.vim/mysnippets/latex/new<CR>
  641.     autocmd FileType tex inoremap ;nf <ESC>:r ~/.vim/mysnippets/latex/newf<CR>
  642.     autocmd FileType tex inoremap ;if <ESC>:r ~/.vim/mysnippets/latex/newif<CR>
  643.     " Code snippets
  644.     autocmd FileType tex inoremap ;fr \begin{frame}<Enter>\frametitle{}<Enter><Enter><++><Enter><Enter>\end{frame}<Enter><Enter><++><Esc>6kf}i
  645.     autocmd FileType tex inoremap ;fi \begin{fitch}<Enter><Enter>\end{fitch}<Enter><Enter><++><Esc>3kA
  646.     autocmd FileType tex inoremap ;exe \begin{exe}<Enter>\ex<Space><Enter>\end{exe}<Enter><Enter><++><Esc>3kA
  647.     autocmd FileType tex inoremap ;em \emph{}<++><Esc>T{i
  648.     autocmd FileType tex inoremap ;bf \textbf{}<++><Esc>T{i
  649.     autocmd FileType tex vnoremap ; <ESC>`<i\{<ESC>`>2la}<ESC>?\\{<Enter>a
  650.     autocmd FileType tex inoremap ;it \textit{}<++><Esc>T{i
  651.     autocmd FileType tex inoremap ;ct \textcite{}<++><Esc>T{i
  652.     autocmd FileType tex inoremap ;cp \parencite{}<++><Esc>T{i
  653.     autocmd FileType tex inoremap ;glos {\gll<Space><++><Space>\\<Enter><++><Space>\\<Enter>\trans{``<++>''}}<Esc>2k2bcw
  654.     autocmd FileType tex inoremap ;x \begin{xlist}<Enter>\ex<Space><Enter>\end{xlist}<Esc>kA<Space>
  655.     autocmd FileType tex inoremap ;ol \begin{enumerate}<Enter><Enter>\end{enumerate}<Enter><Enter><++><Esc>3kA\item<Space>
  656.     autocmd FileType tex inoremap ;ul \begin{itemize}<Enter><Enter>\end{itemize}<Enter><Enter><++><Esc>3kA\item<Space>
  657.     autocmd FileType tex inoremap ;li <Enter>\item<Space>
  658.     autocmd FileType tex inoremap ;ref \ref{}<Space><++><Esc>T{i
  659.     autocmd FileType tex inoremap ;tab \begin{tabular}<Enter><++><Enter>\end{tabular}<Enter><Enter><++><Esc>4kA{}<Esc>i
  660.     autocmd FileType tex inoremap ;ot \begin{tableau}<Enter>\inp{<++>}<Tab>\const{<++>}<Tab><++><Enter><++><Enter>\end{tableau}<Enter><Enter><++><Esc>5kA{}<Esc>i
  661.     autocmd FileType tex inoremap ;can \cand{}<Tab><++><Esc>T{i
  662.     autocmd FileType tex inoremap ;con \const{}<Tab><++><Esc>T{i
  663.     autocmd FileType tex inoremap ;v \vio{}<Tab><++><Esc>T{i
  664.     autocmd FileType tex inoremap ;a \href{}{<++>}<Space><++><Esc>2T{i
  665.     autocmd FileType tex inoremap ;sc \textsc{}<Space><++><Esc>T{i
  666.     autocmd FileType tex inoremap ;chap \chapter{}<Enter><Enter><++><Esc>2kf}i
  667.     autocmd FileType tex inoremap ;sec \section{}<Enter><Enter><++><Esc>2kf}i
  668.     autocmd FileType tex inoremap ;ssec \subsection{}<Enter><Enter><++><Esc>2kf}i
  669.     autocmd FileType tex inoremap ;sssec \subsubsection{}<Enter><Enter><++><Esc>2kf}i
  670.     autocmd FileType tex inoremap ;st <Esc>F{i*<Esc>f}i
  671.     autocmd FileType tex inoremap ;beg \begin{DELRN}<Enter><++><Enter>\end{DELRN}<Enter><Enter><++><Esc>4k0fR:MultipleCursorsFind<Space>DELRN<Enter>c
  672.     autocmd FileType tex inoremap ;up <Esc>/usepackage<Enter>o\usepackage{}<Esc>i
  673.     autocmd FileType tex nnoremap ;up /usepackage<Enter>o\usepackage{}<Esc>i
  674.     autocmd FileType tex inoremap ;tt \texttt{}<Space><++><Esc>T{i
  675.     autocmd FileType tex inoremap ;bt {\blindtext}
  676.     autocmd FileType tex inoremap ;nu $\varnothing$
  677.     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
  678.     autocmd FileType tex inoremap ;rn (\ref{})<++><Esc>F}i
  679.  
  680.     "  }}}
  681.  
  682.  
  683. " }}}
Add Comment
Please, Sign In to add comment