Advertisement
Guest User

Untitled

a guest
Apr 27th, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 18.66 KB | None | 0 0
  1. set nocompatible
  2. filetype off
  3. if !empty($GOROOT)
  4. set rtp+=$GOROOT/misc/vim
  5. endif
  6. set rtp+=~/.vim/bundle/vundle
  7. set rtp+=~/.fzf
  8. call vundle#rc()
  9.  
  10.  
  11. " Bundle config
  12.  
  13. Bundle 'gmarik/vundle'
  14.  
  15. " General
  16. Bundle 'L9'
  17. Bundle 'tpope/vim-fugitive'
  18. Bundle 'tpope/vim-surround'
  19. Bundle 'tpope/vim-dispatch'
  20. Bundle 'tpope/vim-vinegar'
  21. Bundle 'tpope/vim-commentary'
  22. Bundle 'godlygeek/tabular'
  23. Bundle 'tell-k/vim-autopep8'
  24. Bundle 'junegunn/goyo.vim'
  25. Bundle 'vim-scripts/tlib'
  26. Bundle 'bling/vim-airline'
  27. Bundle 'gregsexton/MatchTag'
  28. Bundle 'godlygeek/csapprox'
  29. Bundle 'vim-scripts/closetag.vim'
  30. Bundle 'mattn/webapi-vim'
  31. Bundle 'mattn/emmet-vim'
  32. Bundle 'Lokaltog/vim-easymotion'
  33. Bundle 'mileszs/ack.vim'
  34. Bundle "honza/vim-snippets"
  35. Bundle 'MattesGroeger/vim-bookmarks'
  36. Bundle 'kien/ctrlp.vim'
  37. Bundle 'airblade/vim-gitgutter'
  38. Bundle 'sjl/gundo.vim'
  39. Bundle 'ervandew/supertab'
  40. Bundle 'scrooloose/syntastic'
  41. Bundle 'majutsushi/tagbar'
  42. Bundle 'vim-scripts/Auto-Pairs'
  43. Bundle 'jlanzarotta/bufexplorer'
  44. Bundle 'terryma/vim-multiple-cursors'
  45. Bundle 'garbas/vim-snipmate'
  46. Bundle 'mhinz/vim-startify'
  47. Bundle 'MarcWeber/vim-addon-mw-utils'
  48.  
  49. " Language specific
  50. Bundle 'plasticboy/vim-markdown'
  51. Bundle 'elzr/vim-json'
  52. " Bundle 'davidhalter/jedi-vim'
  53. Bundle 'maksimr/vim-jsbeautify'
  54. Bundle 'kchmck/vim-coffee-script'
  55. Bundle 'othree/html5.vim'
  56. Bundle "nono/vim-handlebars"
  57. Bundle "pangloss/vim-javascript"
  58. Bundle 'Blackrush/vim-gocode'
  59. Bundle "fatih/vim-go'"
  60. Bundle 'groenewege/vim-less'
  61. Bundle 'raichoo/haskell-vim'
  62. Bundle 'elixir-lang/vim-elixir'
  63. Bundle "b4winckler/vim-objc"
  64. Bundle 'Rip-Rip/clang_complete'
  65. Bundle 'eraserhd/vim-ios.git'
  66. Bundle 'heavenshell/vim-jsdoc'
  67.  
  68. filetype plugin indent on
  69.  
  70. syntax on " Enable syntax highlighting
  71. set hidden " Hides the buffers instead of closing them
  72. set wrap linebreak nolist " Soft wrap text that's longer than the line width
  73. set incsearch " Enables fuzzy searching
  74. set tabstop=4 " Set tab size to 4 spaces
  75. set expandtab " Insert spaces instead of tabs
  76. set shiftround " Indent to nearest tabstop
  77. set numberwidth=4 " Width of line number field
  78. set autochdir " Autoupdate current dir
  79. set backup " Automatic backup
  80. set shiftwidth=4 " Default number of spaces used for indentation
  81. set number " Turn on numbers
  82. set cursorline " Show cursor line
  83. set fileencoding=utf-8 " Define default encoding for the files
  84. set encoding=utf-8 " Define default encoding for the files
  85. set noerrorbells " Disable annoying system bells
  86. set novisualbell " Disable blinking visualbells aswell
  87. set relativenumber " Show relative numbering on the left side, requires vim 7.4+
  88. set nofoldenable " Don't fold on start
  89. set noswapfile " Disable swap files for your files
  90. set showmatch " Set show matching parenthesis
  91. set ignorecase " Ignore case when searching
  92. set go+=a " Visual selection automatically copied to clipboard
  93. set lines=200 " Number of lines to be used by gui vim
  94. set columns=140 " Number of columns used by gui vim
  95. set nolist " List disables linebreak
  96. set title " Change the terminal's title
  97. set textwidth=0 " Unset text width variable
  98. set wrapmargin=0 " Unset wrap margin variable
  99. set virtualedit=onemore " Allow for cursor beyond last character
  100. set laststatus=2 " Always show the statusline
  101. set viminfo^=% " Remember buffer info after exit
  102. set shortmess+=I " Disable short message shown at the start
  103. set spelllang=en_us " Set default dictionary for spell checking
  104. set synmaxcol=512 " max colored lines in line
  105. set autoread " Reload the file when it has been chaged outside of vim
  106. set directory=~/.vim/temp/ " Define default directory for temporary files
  107. set backupdir=~/.vim/bkp/ " Define default directory for backup files
  108. setl scrollbind " If there are two windows with scroll bind
  109. " option enabled, scroll them simultaneously
  110. set undofile " enable persistent undo
  111. set undodir=~/.vim/undo " Undo dir
  112. set undolevels=1000 " How many undos
  113. set undoreload=10000 " number of lines to save for undo
  114. source $VIMRUNTIME/ftplugin/man.vim " turn on man pages in vim
  115. set guioptions= " reset gui options in vim
  116. set wildignore=*.swp,*.bak,*.pyc,*.class " List of files ignored by Vim
  117. set shell=/bin/zsh
  118. let g:netrw_liststyle=3
  119.  
  120. " ---------GUI OPTIONS------------
  121. " --------------------------------
  122. set t_AB=^[[48;5;%dm
  123. set t_AF=^[[38;5;%dm
  124. set t_Co=256
  125. set background=dark
  126. if has("gui_running")
  127. colorscheme codeschool
  128. set guifont=Monaco:h11
  129. else
  130. set term=xterm-256color
  131. set guifont=Monaco:h12
  132. colorscheme jellybeans
  133. endif
  134. " Solarized theme options
  135. " -----------------------
  136. let g:solarized_visibility = "high"
  137. let g:solarized_contrast = "high"
  138. " -----------------------
  139.  
  140. " Disable Background Color Erase (BCE) so that color scheme work properly when Vim is used inside tmux and GNU screen.
  141. set t_ut=
  142. " Return to last edit position when opening files (You want this!)
  143. autocmd BufReadPost *
  144. \ if line("'\"") > 0 && line("'\"") <= line("$") |
  145. \ exe "normal! g`\"" |
  146. \ endif
  147.  
  148. let g:screen_size_restore_pos = 1
  149. let g:screen_size_by_vim_instance = 0
  150.  
  151. " ===== Statusline options =======
  152. set statusline=
  153. set statusline+=%<\
  154. set statusline+=%2*[%n%H%M%R%W]%*\
  155. set statusline+=%1*%y%*%*\
  156. set statusline+=%{fugitive#statusline()}
  157. set statusline+=%=%10((%l,%c)%)\
  158. set statusline+=%P
  159. " ================================
  160.  
  161. au WinEnter * :set winfixheight
  162. au WinEnter * :wincmd =
  163.  
  164.  
  165. if has("multi_byte")
  166. if &termencoding == ""
  167. let &termencoding = &encoding
  168. endif
  169. set encoding=utf-8
  170. setglobal fileencoding=utf-8 bomb
  171. set fileencodings=ucs-bom,utf-8,latin1
  172. endif
  173.  
  174. " =============== FILETYPE CONFIG =======================
  175.  
  176. autocmd FileType javascript noremap <buffer> <leader>b :call JsBeautify()<cr>
  177. autocmd FileType html noremap <buffer> <leader>b :call HtmlBeautify()<cr>
  178. autocmd FileType css noremap <buffer> <leader>b :call CSSBeautify()<cr>
  179. autocmd FileType html,htmldjango,jinjahtml,eruby,mako let b:closetag_html_style=1
  180. autocmd FileType html,xhtml,xml,htmldjango,jinjahtml,eruby,mako source ~/.vim/bundle/closetag.vim/plugin/closetag.vim
  181. autocmd Filetype php set keywordprg=pman
  182. autocmd filetype crontab setlocal nobackup nowritebackup
  183. autocmd FileType javascript
  184. \ :setl omnifunc=jscomplete#CompleteJS
  185.  
  186. augroup code_specific
  187. au!
  188. au BufRead,BufNewFile /etc/nginx/*,/usr/local/nginx/conf/*,/usr/local/nginx/sites-available if &ft == " | setfiletype nginx | endif "
  189. au BufRead,BufNewFile *.php set colorcolumn=80 softtabstop=4
  190. au BufRead,BufNewFile jquery.*.js set ft=javascript syntax=jquery
  191. au BufRead,BufNewFile *.markdown set ft=mkd syntax=mkd spell
  192. au BufRead,BufNewFile *.m set colorcolumn=80 syntax=objc ft=objc
  193. au BufRead,BufNewFile *.h set colorcolumn=80 syntax=objc ft=objc
  194. au BufRead,BufNewFile *.md set ft=markdown syntax=markdown spell
  195. au BufRead,BufNewFile *.txt set ft=markdown syntax=markdown spell
  196. au BufRead,BufNewFile *.html set ft=html
  197. au BufRead,BufNewFile *.styl set ft=stylus syntax=stylus shiftwidth=2 tabstop=2
  198. au BufRead,BufNewFile *.coffee set shiftwidth=2 tabstop=2
  199. au BufRead,BufNewFile *.js set shiftwidth=2 tabstop=2
  200. augroup END
  201. autocmd FileType php let b:surround_45= "<?php \r ?>"
  202. autocmd QuickFixCmdPost * nested cwindow | redraw!
  203. " autocmd BufWritePost,FileWritePost *.coffee silent !coffee -c <afile>
  204. autocmd BufWritePost,FileWritePost *.styl silent !stylus <afile> > /dev/null
  205.  
  206.  
  207. " Tagbar config
  208. let g:tagbar_type_css = {
  209. \ 'ctagstype' : 'css',
  210. \ 'kinds' : [
  211. \ 'c:classes',
  212. \ 's:selectors',
  213. \ 'i:identities',
  214. \ 't:tags',
  215. \ 'm:media'
  216. \ ]
  217. \ }
  218. let g:tagbar_type_go = {
  219. \ 'ctagstype' : 'go',
  220. \ 'kinds' : [
  221. \ 'p:package',
  222. \ 'i:imports:1',
  223. \ 'c:constants',
  224. \ 'v:variables',
  225. \ 't:types',
  226. \ 'n:interfaces',
  227. \ 'w:fields',
  228. \ 'e:embedded',
  229. \ 'm:methods',
  230. \ 'r:constructor',
  231. \ 'f:functions'
  232. \ ],
  233. \ 'sro' : '.',
  234. \ 'kind2scope' : {
  235. \ 't' : 'ctype',
  236. \ 'n' : 'ntype'
  237. \ },
  238. \ 'scope2kind' : {
  239. \ 'ctype' : 't',
  240. \ 'ntype' : 'n'
  241. \ },
  242. \ 'ctagsbin' : 'gotags',
  243. \ 'ctagsargs' : '-sort -silent'
  244. \ }
  245.  
  246. let g:tagbar_autofocus = 1
  247.  
  248. let g:AutoPairs = {'(':')', '[':']', '{':'}',"'":"'",'"':'"'}
  249.  
  250. let g:jsdoc_allow_input_prompt = 1
  251. let g:jsdoc_input_description = 1
  252.  
  253. let g:syntastic_enable_signs=1
  254. let g:syntastic_auto_loc_list=1
  255. let g:syntastic_php_checkers=['phpcs']
  256. let g:syntastic_css_checkers=['']
  257. let g:syntastic_javascript_checkers=['jshint']
  258. let g:syntastic_python_checkers = ['flake8']
  259. let g:syntastic_python_flake8_args='--ignore=E501,E225,E226,E265'
  260. let g:syntastic_mode_map = { 'mode': 'passive'}
  261.  
  262. let g:goyo_width=95
  263. let g:goyo_height=95
  264. let g:goyo_margin_top = 2
  265. let g:goyo_margin_bottom = 2
  266.  
  267. let g:used_javascript_libs = 'underscore,jquery,angularjs'
  268.  
  269. let g:default_background_type = "dark"
  270. let g:phpqa_php_cmd='php'
  271. let g:phpqa_messdetector_autorun = 0
  272. let g:phpqa_codesniffer_autorun = 0
  273. let g:phpqa_codecoverage_autorun = 1
  274. " Don't prompt on Vim close if we want to save the session.
  275. let g:session_autosave=0
  276. " Don't auto-load saved sessions on Vim start.
  277. let g:session_autoload=0
  278. " Automatically resize vertical splits.
  279.  
  280. "--------PLUGIN OPTIONS--------------
  281. let g:pad#dir = '~/.gists/files/notes'
  282. let g:pad#default_format = "markdown"
  283. let g:pad#default_file_extension = ".md"
  284. let g:pad#open_in_split = 0
  285.  
  286.  
  287. let g:user_zen_expandabbr_key = '<c-e>'
  288. let g:use_zen_complete_tag = 1
  289. let g:Powerline_symbols = 'fancy'
  290. let g:bufExplorerFindActive = 1 " Go to active window.
  291.  
  292. " Startify
  293. let g:startify_bookmarks = [
  294. \'~/.gists/files/blog',
  295. \'~/.gists/files/scripts',
  296. \ ]
  297.  
  298. let g:user_emmet_expandabbr_key = '<C-e>'
  299.  
  300. " -------- NERDTree --------
  301. let NERDTreeIgnore = ['\.pyc', '\~$', '\.swo$', '\.swp$', '\.git', '\.hg', '\.svn', '\.bzr']
  302. let NERDTreeDirArrows = 1
  303. let g:NERDTreeWinPos = "right"
  304. let g:notes_directories = ["~/.notes"]
  305.  
  306.  
  307. " --------------- SNIPMATE -----------------
  308. let g:snipMate = {}
  309. let g:snipMate.scope_aliases = {}
  310. let g:snipMate.scope_aliases['less'] = 'css'
  311. let g:snipMate.scope_aliases['scss'] = 'css'
  312. let g:snipMate.scope_aliases['styl'] = 'less'
  313. let g:snipMate.scope_aliases['php'] = 'php,html'
  314. let g:snipMate.scope_aliases['html'] = 'html'
  315. let g:snipMate.scope_aliases['javascript'] = 'javascript,javascript-jquery'
  316.  
  317. let g:colorscheme_switcher_exclude = ['koehler', 'morning', 'murphy', 'pablo', 'peachpuff', 'ron', 'shine', 'torte', 'zellner', 'blue', 'darkblue', 'default', 'delek', 'desert', 'elflord', 'evening', 'rubyblue']
  318.  
  319.  
  320. let g:ctrlp_working_path_mode = 'ra'
  321. let g:ctrlp_custom_ignore = '\v[\/](node_modules|target|output|bower_components|dist)|(\.(swp|hg|ico|git|svn))$'
  322. let g:ctrlp_match_window_bottom = 0
  323. let g:ctrlp_match_window_reversed = 0
  324. let g:ctrlp_dotfiles = 0
  325. let g:ctrlp_switch_buffer = 0
  326. let g:ctrlp_root_markers = ['.ctrlp']
  327. let g:used_javascript_libs = 'angularjs,underscore'
  328. let g:gist_clip_command = 'xclip -selection clipboard'
  329. let g:tern_map_keys=1
  330. let g:tern_show_argument_hints="on_hold"
  331. let g:ycm_min_num_of_chars_for_completion = 99
  332.  
  333. let g:coffee_compile_on_save=0
  334.  
  335. if !exists('g:airline_symbols')
  336. let g:airline_symbols = {}
  337. endif
  338. if !exists('g:airline_symbols')
  339. let g:airline_symbols = {}
  340. endif
  341.  
  342. " unicode symbols
  343. let g:airline_left_sep = ''
  344. let g:airline_left_sep = ''
  345. let g:airline_right_sep = ''
  346. let g:airline_right_sep = ''
  347. let g:airline_symbols.linenr = ''
  348. let g:airline_symbols.linenr = ''
  349. let g:airline_symbols.linenr = ''
  350. let g:airline_symbols.branch = ''
  351. let g:airline_symbols.paste = ''
  352. let g:airline_symbols.paste = ''
  353. let g:airline_symbols.paste = ''
  354. let g:airline_symbols.whitespace = ''
  355.  
  356.  
  357. " Disable auto completion, always <c-x> <c-o> to complete
  358. let g:clang_complete_auto = 0
  359. let g:clang_use_library = 1
  360. let g:clang_periodic_quickfix = 0
  361. let g:clang_close_preview = 1
  362.  
  363. " For Objective-C, this needs to be active, otherwise multi-parameter methods won't be completed correctly
  364. let g:clang_snippets = 1
  365.  
  366. " This might change depending on your installation
  367. let g:clang_exec = '/usr/local/bin/clang'
  368. let g:clang_library_path = '/usr/local/lib/libclang.dylib'
  369.  
  370. " Show sidebar signs.
  371. " let g:syntastic_enable_signs=1
  372. "
  373. " " Read the clang complete file
  374. " let g:syntastic_objc_config_file = '.clang_complete'
  375. "
  376. "" Status line configuration
  377. set statusline+=%#warningmsg# " Add Error ruler.
  378. set statusline+=%{SyntasticStatuslineFlag()}
  379. set statusline+=%*
  380. nnoremap <silent> ` :Errors<CR>
  381.  
  382. " Tell it to use clang instead of gcc
  383. " let g:syntastic_objc_checker = 'clang'
  384. " "
  385.  
  386.  
  387. "============== KEY BINDINGS ================
  388. "============================================
  389.  
  390.  
  391. let mapleader = "§"
  392. nmap <Space> <leader>
  393.  
  394. "
  395. "-------------Plugin Bindings----------------
  396. map <leader>b :call JsBeautify()<cr>
  397. map <F1> :Goyo<CR>
  398. map <silent> <F5> :BufExplorer<CR>
  399. map <F2> :TagbarToggle<CR>
  400. map <F3> :GundoToggle<CR>
  401. map <F4> :SyntasticToggleMode<CR>
  402. nnoremap <silent> <leader>se :call <SID>StripTrailingWhitespaces()<CR>
  403. "tabularise
  404. map <Leader>a= :Tabularize /=<CR>
  405. map <Leader>a: :Tabularize /:<CR>
  406. map <Leader>a:: :Tabularize /:\zs<CR>
  407. map <Leader>a, :Tabularize /,<CR>
  408. map <Leader>a+ :Tabularize /+<CR>
  409. map <Leader>a- :Tabularize /-<CR>
  410. map <Leader>a> :Tabularize /=>/<CR>
  411. map <Leader>a" :Tabularize /"<CR>
  412. nnoremap <leader>p :CtrlP<CR>
  413. nmap <Space><Space> <Plug>(easymotion-sn)
  414. nnoremap <leader>qq :w! % <CR>
  415. nnoremap <leader>qw :wa <CR>
  416. nnoremap <leader>g :vimgrep
  417. nnoremap <leader>c :copen<CR>
  418. nnoremap <leader>C :cclose<CR>
  419. nnoremap <leader>l <C-w>l
  420. nnoremap <leader>h <C-w>h
  421. nnoremap <leader>j <C-w>j
  422. nnoremap <leader>k <C-w>k
  423. nnoremap <leader><cr> :%s/\<<C-r><C-w>\>/
  424. " Toggle paste mode on and off
  425. map <leader>pp :setlocal paste!<cr>
  426. map <leader>po :setlocal nopaste!<cr>
  427. map <leader>rc :e! $MYVIMRC<cr>
  428. map <leader>rC :so $MYVIMRC<CR>
  429. map <leader>m :CtrlPMRUFiles<CR>
  430. map <leader>py :silent w\|!python %<CR>
  431. map <leader>2 :norm A;<CR> :startinsert<CR>
  432. map <leader>3 :norm A,<CR> :startinsert<CR>
  433. map <leader><Backspace> <C-^>
  434. map <leader>- <Esc>:e<Space>
  435. map <leader>= <Esc>:vsp<Space>
  436. nmap <leader>dw :g/^$/d<CR>
  437. inoremap <leader>, <><Left>
  438. inoremap <leader>. //<left>
  439. inoremap ]] {{ }}<Esc><left><left>:startinsert<CR>
  440. inoremap ]]] {% %}<Esc><left><left>:startinsert<CR>
  441. "remove empty lines
  442. nnoremap <silent> <leader>de :g/^$/d<CR>
  443. " Toggle spell checking on and off with `,s`
  444. nmap <silent> <leader>s :set spell!<CR>
  445.  
  446. inoremap jj <c-o>o
  447. inoremap kk <c-o>O
  448. nnoremap ; :
  449. inoremap xx <c-o>x
  450. inoremap qq {}<Left>
  451. inoremap qq<CR> {<CR>}<Esc>O
  452. nnoremap j gj
  453. nnoremap k gk
  454. inoremap <C-j> <Esc>/[)}"'\]>]<CR>a
  455. vnoremap _( <Esc>`>a)<Esc>`<i(<Esc>
  456. inoremap { {<CR><BS>}<Esc>ko
  457. inoremap jk ()<C-o><Left>
  458. inoremap jk<CR> (<CR>)<Esc>O
  459. inoremap kj <Esc>/[)}"'\]>]<CR>a
  460. inoremap §[ <c-o>A,
  461. inoremap §] <c-o>A;
  462. inoremap <m-w> www
  463. map <Del> <Esc>:w<CR>
  464. nnoremap R :!./%
  465. "bookmarks
  466. map tn :tabnew<cr>
  467. map to :tabonly<cr>
  468. map tc :tabclose<cr>
  469. nmap <Backspace> gt
  470. " Opens a new tab with the current buffer's path
  471. " Super useful when editing files in the same directory
  472. map te :tabedit <c-r>=expand("%:p:h")<CR><CR>
  473. "window resizing
  474. map <c-J> :resize -5<cr>
  475. map <c-K> :resize +5<cr>
  476. map <c-L> :vertical resize -5<cr>
  477. map <c-H> :vertical resize +5<cr>
  478. " Move a line of text using ALT+[jk] or Comamnd+[jk] on mac
  479. nmap <M-j> mz:m+<cr>`z
  480. nmap <M-k> mz:m-2<cr>`z
  481. vmap <M-j> :m'>+<cr>`<my`>mzgv`yo`z
  482. vmap <M-k> :m'<-2<cr>`>my`<mzgv`yo`z
  483. nmap . .`[]
  484. imap `1 <c-o>l
  485. nmap > >>
  486. nmap < <<
  487. nmap <leader>vs :vsplit<CR>
  488. " disable arrow keys
  489. map <up> <nop>
  490. map <down> <nop>
  491. map <left> <nop>
  492. map <right> <nop>
  493. imap <up> <nop>
  494. imap <down> <nop>
  495. imap <left> <nop>
  496. imap <right> <nop>
  497. inoremap (<CR> (<CR>)<Esc>O
  498. imap <m-'> '<del>
  499. imap <m-"> "<del>
  500. inoremap ,, <><Left>
  501. nnoremap <silent> Q ZZ
  502. imap §2 <Esc>:norm A;<CR> :startinsert<CR>
  503. imap §3 <Esc>:norm A,<CR> :startinsert<CR>
  504. inoremap [<Space> <c-o>
  505. inoremap II <Esc>I
  506. inoremap AA <Esc>A
  507. inoremap QQ <c-o>o
  508. inoremap OO <Esc>O
  509. inoremap CC <Esc>ciw
  510. inoremap SS <Esc>S
  511. inoremap DD <Esc>ddi
  512. inoremap UU <Esc>u
  513. inoremap PP <Esc>pi
  514. inoremap ZZ <Esc>zzi
  515. inoremap LL <Esc>g~iwea
  516. inoremap LO <Esc>m`b~Ea
  517. inoremap §cc <Esc><leader>cc
  518. inoremap §<Space> <c-o>b$<Esc>e<Space>i
  519. inoremap §- __<c-o>b__<Esc>e<Space>i
  520. onoremap p i(i
  521. onoremap b /return<CR>
  522. onoremap in( :<c-u>normal! f(vi(<cr>
  523. onoremap il( :<c-u>normal! F)vi(<CR>
  524. nnoremap <A-j> :m+<CR>==
  525. nnoremap <A-k> :m-2<CR>==
  526. nnoremap <A-h> <<
  527. nnoremap <A-l> >>
  528. inoremap <A-j> <Esc>:m+<CR>==gi
  529. inoremap <A-k> <Esc>:m-2<CR>==gi
  530. inoremap <A-h> <Esc><<`]a
  531. inoremap <A-l> <Esc>>>`]a
  532. vnoremap <A-j> :m'>+<CR>gv=gv
  533. vnoremap <A-k> :m-2<CR>gv=gv
  534. vnoremap <A-h> <gv
  535. vnoremap <A-l> >gv
  536. nmap X ci"
  537. map <m-X> ci'
  538. map <S-del> :silent w\|!python %<CR>
  539. nnoremap <S-CR> :C
  540. " reselect last paste
  541. nnoremap <expr> gp '`[' . strpart(getregtype(), 0, 1) . '`]'
  542.  
  543. map ł <C-w>l
  544. map Ż <C-w>k
  545. map ∆ <C-w>j
  546. map ķ <C-w>h
  547.  
  548. "=============Functions=================
  549.  
  550.  
  551. "remove trailing spaces
  552. function! <SID>StripTrailingWhitespaces()
  553. " Preparation: save last search, and cursor position.
  554. let _s=@/
  555. let l = line(".")
  556. let c = col(".")
  557. " Do the business:
  558. %s/\s\+$//e
  559. " Clean up: restore previous search history, and cursor position
  560. let @/=_s
  561. call cursor(l, c)
  562. endfunction
  563.  
  564. " Insert google starter kit html template into html file
  565. function! HtmlTemplate()
  566. ~/.vim/templates/html.template
  567. r~/.vim/templates/html.template
  568. endfunction
  569.  
  570. function! BlogTemplate()
  571. ~/.vim/templates/blog.template
  572. r~/.vim/templates/blog.template
  573. endfunction
  574.  
  575. func! WordProcessorMode()
  576. setlocal formatoptions=1
  577. setlocal noexpandtab
  578. map j gj
  579. map k gk
  580. setlocal spell spelllang=en_us
  581. set thesaurus+=/Users/sbrown/.vim/thesaurus/mthesaur.txt
  582. set complete+=s
  583. set formatprg=par
  584. setlocal wrap
  585. setlocal linebreak
  586. endfu
  587. com! WP call WordProcessorMode()
  588. map <leader>wp call WordProcessorMode()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement