Advertisement
Dessyreqt

vimrc

Mar 27th, 2015
368
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VIM 7.35 KB | None | 0 0
  1. "Colors to get:
  2. "Vydark: http://www.vim.org/scripts/script.php?script_id=3309
  3.  
  4. "{{{ Custom Paths
  5.  
  6. let $dropbox="E:\\Dropbox"
  7. let $unilua="$dropbox\\TAS Stuff\\Uniracers\\Scripts"
  8. let $vimwiki="~\\vimwiki"
  9.  
  10. "}}}
  11.  
  12. "{{{ Auto Commands
  13.  
  14. " Automatically cd inot the directory that the file is in
  15. autocmd BufEnter * execute "chdir ".escape(expand("%:p:h"), ' ')
  16.  
  17. " Remove any trailing whitespace that is in the file
  18. autocmd BufRead,BufWrite * if ! &bin | silent! %s/\s\+$//ge | endif
  19.  
  20. " Restore cursor position to where it was before
  21. augroup JumpCursorOnEdit
  22.    au!
  23.    autocmd BufReadPost *
  24.             \ if expand("<afile>:p:h") !=? $TEMP |
  25.             \   if line("'\"") > 1 && line("'\"") <= line("$") |
  26.             \     let JumpCursorOnEdit_foo = line("'\"") |
  27.             \     let b:doopenfold = 1 |
  28.             \     if (foldlevel(JumpCursorOnEdit_foo) > foldlevel(JumpCursorOnEdit_foo - 1)) |
  29.             \        let JumpCursorOnEdit_foo = JumpCursorOnEdit_foo - 1 |
  30.             \        let b:doopenfold = 2 |
  31.             \     endif |
  32.             \     exe JumpCursorOnEdit_foo |
  33.             \   endif |
  34.             \ endif
  35.    " Need to postpone using "zv" until after reading the modelines.
  36.    autocmd BufWinEnter *
  37.             \ if exists("b:doopenfold") |
  38.             \   exe "normal zv" |
  39.             \   if(b:doopenfold > 1) |
  40.             \       exe  "+".1 |
  41.             \   endif |
  42.             \   unlet b:doopenfold |
  43.             \ endif
  44. augroup END
  45.  
  46. " Set word wrap for text files
  47. au BufRead,BufNewFile *.txt,*.tex,*.wiki set wrap linebreak nolist textwidth=0 wrapmargin=0
  48.  
  49. "}}}
  50.  
  51. "{{{ Plugin Management
  52.  
  53. " Necessary for lots of cool Vim things
  54. set nocompatible
  55.  
  56. " Vundle config
  57. filetype off
  58.  
  59. " set the runtime path to include Vundle and initialize
  60. set rtp+=~/vimfiles/bundle/Vundle.vim/
  61. let path='~/vimfiles/bundle'
  62. call vundle#begin(path)
  63. " alternatively, pass a path where Vundle should install plugins
  64. "call vundle#begin('~/some/path/here')
  65.  
  66. " let Vundle manage Vundle, required
  67. Plugin 'gmarik/Vundle.vim'
  68.  
  69. " Goto vimawesome.com to find the entries to put here
  70. Plugin 'yaroot/vissort'
  71. Plugin 'vimwiki'
  72. Plugin 'bling/vim-airline'
  73. Plugin 'scrooloose/nerdtree'
  74. Plugin 'taglist.vim'
  75. Plugin 'xolox/vim-session'
  76. Plugin 'xolox/vim-misc'
  77. Plugin 'scrooloose/syntastic'
  78. Plugin 'Townk/vim-autoclose'
  79. Plugin 'thinca/vim-singleton'
  80.  
  81. " use :PluginInstall to update plugins
  82.  
  83. " All of your Plugins must be added before the following line
  84. call vundle#end()            " required
  85. filetype plugin indent on    " required
  86. " To ignore plugin indent changes, instead use:
  87. "filetype plugin on
  88. "
  89. " Brief help
  90. " :PluginList       - lists configured plugins
  91. " :PluginInstall    - installs plugins; append `!` to update or just :PluginUpdate
  92. " :PluginSearch foo - searches for foo; append `!` to refresh local cache
  93. " :PluginClean      - confirms removal of unused plugins; append `!` to auto-approve removal
  94. "
  95. " see :h vundle for more details or wiki for FAQ
  96. " Put your non-Plugin stuff after this line
  97.  
  98. "}}}
  99.  
  100. "{{{ Misc Settings
  101.  
  102. " This shows what you are typing as a command.
  103. set showcmd
  104.  
  105. " Folding Stuffs
  106. set foldmethod=marker
  107.  
  108. " Needed for Syntax Highlighting and stuff
  109. filetype on
  110. filetype plugin on
  111. filetype plugin indent on
  112. syntax enable
  113. syntax on
  114. set grepprg=grep\ -nH\ $*
  115.  
  116. " Who doesn't like autoindent?
  117. set autoindent
  118.  
  119. " Spaces are better than a tab character
  120. set expandtab
  121. set smarttab
  122.  
  123. " 4-character tab
  124. set shiftwidth=4
  125. set softtabstop=4
  126. set tabstop=4
  127.  
  128. " Use english for spellchecking, but don't spellcheck by default
  129. if version >= 700
  130.     set spl=en spell
  131.     set nospell
  132. endif
  133.  
  134. " Cool tab completion stuff
  135. set wildmenu
  136. set wildmode=list:longest,full
  137. set wildignore=*.swp,*.bak
  138.  
  139. " Enable mouse support in console
  140. set mouse=a
  141.  
  142. " Make Backspace and Delete work like I expect them to
  143. set backspace=2
  144.  
  145. " Line numbers
  146. set number
  147.  
  148. " Make searching ignore case, unless I put an uppercase character in the search
  149. set ignorecase
  150. set smartcase
  151.  
  152. " Incremental search
  153. set incsearch
  154.  
  155. " Highlight search terms
  156. set hlsearch
  157.  
  158. " This allows buffers to be hidden if you've modified a buffer.
  159. set hidden
  160.  
  161. " Set off the other paren
  162. highlight MatchParen ctermbg=4
  163.  
  164. " Enable virtual space
  165. set virtualedit=all
  166.  
  167. " Set no wrapping
  168. set nowrap
  169.  
  170. " make sure the statusline shows
  171. set laststatus=2
  172.  
  173. " get rid of the default mode indicator
  174. set noshowmode
  175.  
  176. " no backup files
  177. set nobackup
  178. set noswapfile
  179.  
  180. " Enable the list of buffers
  181. let g:airline#extensions#tabline#enabled = 1
  182.  
  183. " Show just the filename
  184. let g:airline#extensions#tabline#fnamemod = ':t'
  185.  
  186. let g:session_autosave='yes'
  187. let g:session_autoload='yes'
  188.  
  189. call singleton#enable()
  190.  
  191. "}}}
  192.  
  193. "{{{ Look and Feel
  194.  
  195. " Favorite Color Scheme
  196. colo vydark
  197. " other good themes: breeze, darkeclipse, dusk, lucius, oceanblack,
  198. " paintbox, rainbow_neon, rootwater, slate2, sorcerer, watermark, wuye,
  199. " xoria256
  200.  
  201.  
  202. " Highlight the current line
  203. set cursorline
  204.  
  205. " GUI options
  206. if has("gui_running")
  207.     set encoding=utf-8
  208.  
  209.     " Set font to Consolas
  210.     " Download the Consolas for Powerline patch here: https://github.com/nicolalamacchia/powerline-consolas
  211.     set guifont=Consolas:h10:cANSI
  212.  
  213.     " Powerline font configuration
  214.     let g:airline_powerline_fonts = 1
  215.  
  216.     " Remove toolbar and menu
  217.     set go-=T
  218.     set go-=m
  219.  
  220.     " Add horizontal scroll bar
  221.     set go+=b
  222.  
  223.     " set startup size
  224.     set lines=50 columns=250
  225. endif
  226.  
  227. "}}}
  228.  
  229. "{{{ Mappings
  230.  
  231. " \ev - Edit vimrc
  232. nnoremap <silent> <Leader>ev :tabnew<CR>:e ~/_vimrc<CR>
  233.  
  234. " Space will toggle folds!
  235. nnoremap <space> za
  236.  
  237. " Next Tab
  238. nnoremap <silent> <C-Right> :tabnext<CR>
  239.  
  240. " Previous Tab
  241. nnoremap <silent> <C-Left> :tabprevious<CR>
  242.  
  243. " New Tab
  244. nnoremap <silent> <C-t> :tabnew<CR>
  245.  
  246. " Bind autocompletion to Ctrl+Space
  247. imap <c-space> <c-n>
  248.  
  249. " Use jj to exit insert mode
  250. imap jj <esc>
  251.  
  252. " Mappings to move lines up and down
  253. nnoremap <A-j> :m .+1<CR>==
  254. nnoremap <A-k> :m .-2<CR>==
  255. inoremap <A-j> <Esc>:m .+1<CR>==gi
  256. inoremap <A-k> <Esc>:m .-2<CR>==gi
  257. vnoremap <A-j> :m '>+1<CR>gv=gv
  258. vnoremap <A-k> :m '<-2<CR>gv=gv
  259.  
  260. " Open dialog
  261. nnoremap <C-o> :tabnew<CR>:browse confirm e<CR>
  262.  
  263. " Save dialog
  264. nnoremap <C-s> :browse confirm w<CR>
  265.  
  266. " move vertically by visual line
  267. nnoremap j gj
  268. nnoremap k gk
  269.  
  270. " copy, cut and paste shortcuts
  271. nnoremap <A-c> "+y
  272. nnoremap <A-x> "+x
  273. nnoremap <A-v> "+gP
  274.  
  275. " Open a new buffer
  276. nnoremap <leader>bn :enew<cr>
  277.  
  278. " close the current buffer and move to the previous one
  279. nnoremap <leader>bq :bp <bar> bd #<cr>
  280.  
  281. " show all open buffers and their status
  282. nnoremap <leader>bl :ls<cr>
  283.  
  284. " movement between buffers
  285. nnoremap <right> :bnext<cr>
  286. nnoremap <left> :bprevious<cr>
  287. nnoremap <up> :tabnext<cr>
  288. nnoremap <down> :tabprevious<cr>
  289.  
  290. " plugin command mapping
  291. nnoremap <leader>pi :PluginInstall<cr>
  292. nnoremap <leader>nt :NERDTree<cr>
  293.  
  294. " save some shift presses
  295. nnoremap ; :
  296.  
  297. "This unsets the "last search pattern" register by hitting return
  298. nnoremap <CR> :noh<CR><CR>
  299.  
  300. "Ctrl-Backspace to delete a word in insert mode
  301. inoremap <C-Backspace> <Esc>ldbi
  302.  
  303. "}}}
  304.  
  305. "{{{ Custom Commands
  306.  
  307. command Pushvimrc call system("copy " . expand("$homepath\\_vimrc") . " " . expand(expand("$dropbox\\_vimrc")))
  308. command Pullvimrc call system("copy " . expand(expand("$dropbox\\_vimrc")) . " " . expand("$homepath\\_vimrc"))
  309. command Wiki :e $vimwiki\index.wiki
  310.  
  311. "}}}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement