Advertisement
Guest User

Untitled

a guest
May 25th, 2017
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.98 KB | None | 0 0
  1. " Set up Vundle to manage plugins
  2. set nocompatible
  3. filetype off
  4.  
  5. " set the runtime path to include Vundle and initialize
  6. set rtp+=~/.vim/bundle/vundle/
  7. call vundle#rc()
  8.  
  9. " let Vundle manage Vundle, required
  10. Plugin 'gmarik/vundle'
  11.  
  12. " The following are examples of different formats supported.
  13. " Keep Plugin commands between here and filetype plugin indent on.
  14. " scripts on GitHub repos
  15. Plugin 'tpope/vim-fugitive'
  16. Plugin 'tpope/vim-repeat'
  17. Plugin 'tpope/vim-surround'
  18. Plugin 'tpope/vim-commentary'
  19. Plugin 'tpope/vim-haml'
  20. Plugin 'kchmck/vim-coffee-script'
  21. Plugin 'kien/ctrlp.vim'
  22. Plugin 'bling/vim-airline'
  23. Plugin 'altercation/vim-colors-solarized'
  24. Plugin 'jmcantrell/vim-virtualenv'
  25. Plugin 'davidoc/taskpaper.vim'
  26. Plugin 'gcmt/wildfire.vim'
  27. Plugin 'mattn/emmet-vim'
  28. Plugin 'vim-pandoc/vim-pandoc'
  29. Plugin 'vim-pandoc/vim-pandoc-syntax'
  30. Plugin 'vim-pandoc/vim-pandoc-after'
  31. Plugin 'christoomey/vim-tmux-navigator'
  32. Plugin 'rking/ag.vim'
  33. Plugin 'ervandew/supertab'
  34. Plugin 'Valloric/YouCompleteMe'
  35. Plugin 'SirVer/ultisnips'
  36. Plugin 'sjl/gundo.vim'
  37. Plugin 'edkolev/tmuxline.vim'
  38. Plugin 'edkolev/promptline.vim'
  39.  
  40. " Local plugins
  41.  
  42. filetype plugin indent on " required
  43.  
  44. " Brief help
  45. " :PluginList - list configured plugins
  46. " :PluginInstall(!) - install (update) plugins
  47. " :PluginSearch(!) foo - search (or refresh cache first) for foo
  48. " :PluginClean(!) - confirm (or auto-approve) removal of unused plugins
  49. "
  50. " see :h vundle for more details or wiki for FAQ
  51. " NOTE: comments after Plugin commands are not allowed.
  52. " Put your stuff after this line
  53.  
  54. " make YCM compatible with UltiSnips (using supertab)
  55. let g:ycm_key_list_select_completion = ['<C-n>', '<Down>']
  56. let g:ycm_key_list_previous_completion = ['<C-p>', '<Up>']
  57. let g:SuperTabDefaultCompletionType = '<C-n>'
  58.  
  59. " better key bindings for UltiSnipsExpandTrigger
  60. let g:UltiSnipsExpandTrigger = "<tab>"
  61. let g:UltiSnipsJumpForwardTrigger = "<tab>"
  62. let g:UltiSnipsJumpBackwardTrigger = "<s-tab>"
  63.  
  64. " this mapping Enter key to <C-y> to chose the current highlight item
  65. " and close the selection list, same as other IDEs.
  66. " CONFLICT with some plugins like tpope/Endwise
  67. inoremap <expr> <CR> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>"
  68.  
  69. " Pandoc integration with third party plugins
  70. let g:pandoc#after#modules#enabled = ["supertab", "ultisnips"]
  71. let g:pandoc_no_folding = 1
  72.  
  73. " Extends % switching between all kinds of matching object
  74. runtime macros/matchit.vim
  75.  
  76. " Basic stuff
  77. set noswapfile
  78. set nobackup
  79. set encoding=utf-8
  80. set hidden
  81. set autoread " Read changes immediately if file changed outside vim
  82. set clipboard=unnamed " Use OS X clipboard
  83. syntax on
  84.  
  85. " Theme
  86. set background=dark
  87. colorscheme solarized
  88.  
  89. " Airline config
  90. let g:airline_powerline_fonts = 1
  91. let g:airline#extensions#tabline#enabled = 1
  92. let g:airline#extensions#tabline#tab_nr_type = 1 " tab number
  93. let g:airline#extensions#tabline#fnamecollapse = 0
  94. let g:airline#extensions#virtualenv#enabled = 1
  95. let g:airline#extensions#tmuxline#enabled = 0
  96. let g:airline_inactive_collapse = 0
  97. let g:virtualenv_auto_activate = 1
  98. set laststatus=2
  99.  
  100. " Emmet config
  101. let g:user_emmet_install_global = 0
  102. autocmd FileType html,css EmmetInstall
  103. let g:user_emmet_leader_key='<C-Z>'
  104.  
  105. " Gundo config
  106. nnoremap <F5> :GundoToggle<CR>
  107. let g:gundo_preview_height = 20
  108. let g:gundo_preview_bottom = 1
  109. let g:gundo_close_on_revert = 1
  110.  
  111. """""""""""""""""""""
  112. " tmuxline config "
  113. """""""""""""""""""""
  114. let g:tmuxline_theme = 'airline_insert'
  115. let g:tmuxline_preset = {
  116. \ 'a': '#S',
  117. \ 'b': '#F',
  118. \ 'c': '#W',
  119. \ 'win': ['#I', '#W'],
  120. \ 'cwin': ['#I', '#W'],
  121. \ 'x': '%a',
  122. \ 'y': ['%b %d', '%R'],
  123. \ 'z': '#h'}
  124.  
  125. """""""""""""""""""""""
  126. " promptline config "
  127. """""""""""""""""""""""
  128. let g:promptline_theme = 'airline'
  129. let g:promptline_preset = {
  130. \'a': [ promptline#slices#python_virtualenv() ],
  131. \'b': [ promptline#slices#cwd({'dir_limit': 2}) ],
  132. \'c': [ promptline#slices#vcs_branch(), '$(git rev-parse --short HEAD 2>/dev/null)' ],
  133. \'x': [ promptline#slices#git_status() ],
  134. \'warn': [ promptline#slices#last_exit_code() ]}
  135.  
  136. " Text Formatting
  137. " ----------------------------------------------------------------------------
  138.  
  139. set autoindent " automatic indent new lines
  140. set smartindent " be smart about it
  141. set wrap " wrap lines
  142. set shiftwidth=4
  143. set tabstop=4
  144. set expandtab
  145. set softtabstop=4
  146. set smarttab
  147. set formatoptions+=n " support for numbered/bullet lists
  148. set virtualedit=block " allow virtual edit in visual block ..
  149. set linebreak
  150. set tw=500
  151.  
  152. " ----------------------------------------------------------------------------
  153. " Remapping
  154. " ---------------------------------------------------
  155.  
  156. " lead with ,
  157. let mapleader = " "
  158. let maplocalleader = ","
  159.  
  160. " Fast save
  161. nnoremap <Leader>w :w!<cr>
  162.  
  163. " reflow paragraph with Q in normal and visual mode
  164. nnoremap Q gqap
  165. vnoremap Q gq
  166.  
  167. " make Y consistent with C and D. See :help Y.
  168. nnoremap Y y$
  169.  
  170. " sane movement with wrap turned on
  171. nnoremap j gj
  172. nnoremap k gk
  173. vnoremap j gj
  174. vnoremap k gk
  175.  
  176.  
  177. " remap arrow keys
  178. nnoremap <left> :bprev<CR>
  179. nnoremap <right> :bnext<CR>
  180. nnoremap <up> :tabnext<CR>
  181. nnoremap <down> :tabprev<CR>
  182.  
  183. " Help mode remapping
  184. " Enter to jump to link, Delete to go back
  185. " q to quit help
  186. autocmd filetype help nnoremap <buffer><cr> <c-]>
  187. autocmd filetype help nnoremap <buffer><bs> <c-T>
  188. autocmd filetype help nnoremap <buffer>q :q<CR>
  189.  
  190. " ----------------------------------------------------------------------------
  191. " UI
  192. " ----------------------------------------------------------------------------
  193.  
  194. set ruler " show the cursor position all the time
  195. set noshowcmd " don't display incomplete commands
  196. set nolazyredraw " turn off lazy redraw
  197. set number relativenumber " relative line numbers
  198. set wildmenu " turn on wild menu
  199. set wildmode=list:longest,full
  200. set ch=2 " command line height
  201. set backspace=2 " allow backspacing over everything in insert mode
  202. set whichwrap+=<,>,h,l,[,] " backspace and cursor keys wrap to
  203. set shortmess=filtIoOA " shorten messages
  204. set report=0 " tell us about changes
  205. set nostartofline " don't jump to the start of line when scrolling
  206.  
  207.  
  208. " ----------------------------------------------------------------------------
  209. " Visual Cues
  210. " ----------------------------------------------------------------------------
  211.  
  212. set showmatch " brackets/braces that is
  213. set mat=5 " duration to show matching brace (1/10 sec)
  214. set incsearch " do incremental searching
  215. set laststatus=2 " always show the status line
  216. set ignorecase " ignore case when searching
  217. set hlsearch " don't highlight searches
  218. set visualbell
  219.  
  220. " Disable highlight when <leader><cr> is pressed
  221. map <silent> <leader><cr> :noh<cr>
  222.  
  223. " Toggle paste mode on and off
  224. map <leader>pp :setlocal paste!<cr>
  225.  
  226. " Open Marked.app with current file
  227. nnoremap <leader>m :!open -b com.brettterpstra.marked2 %<CR>
  228.  
  229. " Taskpaper settings
  230. "
  231. "let g:task_paper_styles={'today': 'ctermfg=Blue guifg=Blue'}
  232.  
  233. " ---------------------------------------------------------------------------
  234. " Strip all trailing whitespace in file
  235. " ---------------------------------------------------------------------------
  236.  
  237. " Delete trailing white space on save, useful for Python and CoffeeScript ;)
  238. func! DeleteTrailingWS()
  239. exe "normal mz"
  240. %s/\s\+$//ge
  241. exe "normal `z"
  242. endfunc
  243.  
  244. autocmd BufWrite *.py :call DeleteTrailingWS()
  245. autocmd BufWrite *.coffee :call DeleteTrailingWS()
  246.  
  247. " The Silver Searcher
  248. if executable('ag')
  249. " Use ag over grep
  250. set grepprg=ag\ --nogroup\ --nocolor
  251.  
  252. " Use ag in CtrlP for listing files. Lightning fast and respects .gitignore
  253. let g:ctrlp_user_command = 'ag %s -l --nocolor -g ""'
  254.  
  255. " ag is fast enough that CtrlP doesn't need to cache
  256. let g:ctrlp_use_caching = 0
  257. endif
  258.  
  259. " bind K to grep word under cursor
  260. nnoremap K :grep! "\b<C-R><C-W>\b"<CR>:cw<CR>
  261.  
  262. map <Leader>s :call DeleteTrailingWS()<CR>
  263.  
  264. " Special macros and abbreviations
  265. "
  266. " ISO date stamps
  267. iab <expr> dts strftime("%Y-%m-%d")
  268. cab <expr> dts strftime("%Y-%m-%d")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement