Advertisement
Guest User

Untitled

a guest
Sep 27th, 2016
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.00 KB | None | 0 0
  1. " Some stuff taken from: https://github.com/zaiste/vimified/blob/master/vimrc
  2.  
  3. " Vundle {{{
  4. set rtp+=~/.vim/bundle/vundle/
  5. call vundle#rc()
  6. " }}}
  7.  
  8. " Bundles {{{
  9. Bundle 'gmarik/vundle'
  10.  
  11. Bundle 'vim-scripts/bufexplorer.zip'
  12. Bundle 'scrooloose/nerdtree'
  13. Bundle 'scrooloose/nerdcommenter'
  14. Bundle 'plasticboy/vim-markdown'
  15. Bundle 'drmikehenry/vim-fixkey'
  16.  
  17. Bundle 'kien/ctrlp.vim'
  18. Bundle 'lastpos.vim'
  19. Bundle 'ZoomWin'
  20.  
  21. Bundle 'easymotion/vim-easymotion'
  22.  
  23. Plugin 'derekwyatt/vim-scala'
  24.  
  25. " Clojure
  26. Bundle 'guns/vim-sexp'
  27. Bundle 'guns/vim-clojure-static'
  28. Bundle 'tpope/vim-fireplace'
  29. nnoremap <Leader>el :Eval<CR>
  30. nnoremap <Leader>ef :%Eval<CR>
  31.  
  32. " Styling
  33. Bundle 'kien/rainbow_parentheses.vim'
  34. let g:rbpt_colorpairs = [
  35. \ ['brown', 'RoyalBlue3'],
  36. \ ['red', 'RoyalBlue3'],
  37. \ ['yellow', 'SeaGreen3'],
  38. \ ['red', 'firebrick3'],
  39. \ ['green', 'SeaGreen3'],
  40. \ ]
  41.  
  42. Bundle 'jnurmine/Zenburn'
  43. colorscheme zenburn
  44. let g:zenburn_force_dark_Background = 1
  45. command Light colorscheme shine
  46. command Dark colorscheme zenburn
  47. " TODO: evaluate matchit, ctrlp
  48. " }}}
  49.  
  50. " needed for syntax recognition
  51. syntax on
  52. filetype on
  53. filetype plugin indent on
  54.  
  55. " Matches {{{
  56.  
  57. " Highlight VCS conflict markers
  58. match ErrorMsg '^\(<\|=\|>\)\{7\}\([^=].\+\)\?$'
  59.  
  60. " }}}
  61.  
  62. " Mappings {{{
  63.  
  64. let mapleader = "\\"
  65. let maplocalleader = "'"
  66. let g:EasyMotion_leader_key = ";"
  67.  
  68. " Yank to clipboard/paste from clipboard via xclip
  69. vnoremap <F6> :!pbcopy<CR>
  70. nnoremap <F7> :-1r !pbpaste<CR>
  71.  
  72. map Y y$
  73. map <tab> %
  74.  
  75. inoremap jj <Esc>
  76. inoremap kk <Esc>
  77.  
  78. noremap TT :tabnew<CR>
  79.  
  80. " clear highlight after search
  81. noremap <silent><Leader>/ :nohls<CR>
  82.  
  83. " wrap/nowrap line toggle
  84. nnoremap <silent> <leader>w :set wrap! wrap?<cr>
  85. nnoremap <silent> <leader>q :NERDTreeToggle<cr>
  86.  
  87. " Standard split navigation
  88. nnoremap <c-l> <c-w>l
  89. nnoremap <c-h> <c-w>h
  90. nnoremap <c-j> <c-w>j
  91. nnoremap <c-k> <c-w>k
  92. vnoremap <c-l> <c-w>l
  93. vnoremap <c-h> <c-w>h
  94. vnoremap <c-j> <c-w>j
  95. vnoremap <c-k> <c-w>k
  96.  
  97. " Splits ,v and ,h to open new splits (vertical and horizontal)
  98. nnoremap <leader>v <C-w>v<C-w>l
  99. nnoremap <leader>s <C-w>s<C-w>j
  100.  
  101. " Paragraph formatting
  102. nnoremap Q gqap
  103. vnoremap Q gq
  104.  
  105. " Source current line
  106. vnoremap <leader>L y:execute @@<cr>
  107. " Source visual selection
  108. nnoremap <leader>L ^vg_y:execute @@<cr>
  109.  
  110. " Quick editing {{{
  111.  
  112. nnoremap <leader>ev :call EditConfig("$MYVIMRC")<cr>
  113. nnoremap <leader>eg :call EditConfig("~/.gitconfig")<cr>
  114.  
  115. " }}}
  116.  
  117. " }}}
  118.  
  119. " Settings {{{
  120.  
  121. set autoread " read file automatically on change if not edited
  122. set encoding=utf-8
  123. set title " title of the window set to titlestring
  124.  
  125. set nocompatible " we won't be using vi
  126. set showcmd " show the command currently typed in
  127. set number " show line numbers
  128. set splitright " When splitting vertically, split to the right
  129. set splitbelow " When splitting horizontally, split below
  130. set history=1000 " default is 20
  131.  
  132. set scrolloff=3 " scroll 3 lines in advance of the top/bottom of the window
  133. set backspace=2 " make backspace work like most other apps
  134. set visualbell
  135.  
  136. " show hidden characters and linewraps
  137. set list
  138. set listchars=tab:▸\ ,extends:❯,precedes:❮
  139. set showbreak=↪
  140.  
  141. " _ status line {{{
  142.  
  143. set laststatus=2 " display status line for every window
  144.  
  145. " _ }}}
  146.  
  147. " _ backups {{{
  148.  
  149. set undodir=~/.vim/tmp/undo/
  150. set backupdir=~/.vim/tmp/backup/
  151. set directory=~/.vim/tmp/swap/
  152. set backup " make backups of edited files
  153. set noswapfile " do not use swap files for buffers
  154.  
  155. " _ }}}
  156.  
  157. " _ indentation {{{
  158.  
  159. set expandtab " spaces instead of tabs
  160. set smarttab " <Tab> in front of a line inserts blanks according to the :shiftwidth
  161.  
  162. set shiftwidth=2 " number of spaces to be used during autoindent
  163. set softtabstop=2 " expand tab to 4 characters
  164.  
  165. " _ }}}
  166.  
  167. " _ Searching, Substituting {{{
  168.  
  169. set incsearch " Show search matches as you type
  170. set ignorecase " Ignore case when searching
  171. set smartcase " Override 'ignorecase' when needed
  172. set hlsearch " Highlight search results
  173. set showmatch " Show matching bracket
  174.  
  175. " _ }}}
  176.  
  177. " _ Menus, Completion {{{
  178.  
  179. set completeopt=longest,menu,menuone
  180. " | | |
  181. " | | +-- Show popup even with one match
  182. " | +------- Use popup menu with completions
  183. " +--------------- Insert longest completion match
  184.  
  185. set wildmenu " Enable wildmenu for completion
  186. set wildmode=longest:full,list:full
  187. " | |
  188. " | +-- List matches, complete first match
  189. " +--------------- Complete longest prefix, use wildmenu
  190. set wildignore=.svn,CVS,.git,.hg,*.o,*.a,*.class,*.mo,*.la,*.so,*.obj,*.swp,*.jpg,*.png,*.xpm,*.gif,.DS_Store,*.aux,*.out,*.toc
  191.  
  192. " _ }}}
  193.  
  194. " Folding {{{
  195.  
  196. set foldlevelstart=0
  197.  
  198. " Enter to toggle folds.
  199. nnoremap <Enter> za
  200. vnoremap <Enter> za
  201.  
  202. " }}}
  203.  
  204. " Auto commands {{{
  205.  
  206. " Trailing whitespace {{{
  207. " Only shown when not in insert mode.
  208. augroup trailing
  209. au!
  210. au InsertEnter * :set listchars-=trail:⌴
  211. au InsertLeave * :set listchars+=trail:⌴
  212. augroup END
  213.  
  214. " Remove trailing whitespace
  215. autocmd FileType xml,clojure,java,sql autocmd BufWritePre <buffer> :%s/\s\+$//e
  216.  
  217. augroup clojure
  218. au!
  219. au VimEnter * RainbowParenthesesToggle
  220. au Syntax clojure RainbowParenthesesLoadSquare
  221. au Syntax clojure RainbowParenthesesLoadRound
  222. augroup END
  223.  
  224. " }}}
  225.  
  226. " }}}
  227.  
  228. "" Edit vim config files (if they exist)
  229. function! EditConfig(config)
  230. if exists(a:config)
  231. execute 'tabedit '.a:config
  232. endif
  233. endfunction
  234.  
  235. " }}}
  236.  
  237. " Line moving mappings Alt + (j/k)
  238. nnoremap <A-j> :m .+1<CR>==
  239. nnoremap <A-k> :m .-2<CR>==
  240. inoremap <A-j> <Esc>:m .+1<CR>==gi
  241. inoremap <A-k> <Esc>:m .-2<CR>==gi
  242. vnoremap <A-j> :m '>+1<CR>gv=gv
  243. vnoremap <A-k> :m '<-2<CR>gv=gv
  244.  
  245. " Custom
  246. vnoremap <C-c> "+y
  247.  
  248. " Reset syntax according to extension ':setf {ext}'
  249. function! ResetSyntax()
  250. let ext = expand("%:e")
  251. execute ':setf' ext
  252. endfunction
  253.  
  254. nnoremap <C-l> :call ResetSyntax()<CR>
  255.  
  256. cmap w!! %!sudo tee %
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement