Advertisement
Guest User

Untitled

a guest
Mar 11th, 2017
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VIM 9.97 KB | None | 0 0
  1. "Vundle Plugins
  2.     set nocompatible
  3.     filetype off
  4.     set rtp+=~/.vim/bundle/Vundle.vim
  5.     call vundle#begin()
  6.  
  7.     source $VIMRUNTIME/vimrc_example.vim
  8.     source $VIMRUNTIME/mswin.vim
  9.     behave mswin
  10.  
  11.     " Vundle plugins
  12.     "Plugin 'ranger/ranger'
  13.     Plugin 'ctrlpvim/ctrlp.vim'
  14.     Plugin 'scrooloose/syntastic'
  15.     Plugin 'vim-scripts/Conque-Shell'
  16.     "Plugin 'vim-airline/vim-airline'
  17.     "Plugin 'vim-airline/vim-airline-themes'
  18.     Plugin 'tpope/vim-fugitive'
  19.     Plugin 'Valloric/YouCompleteMe.git'
  20.     Plugin 'tpope/vim-markdown'
  21.     Plugin 'tpope/vim-projectionist'
  22.     Plugin 'tpope/vim-ragtag'
  23.     Plugin 'tpope/vim-repeat'
  24.     Plugin 'tpope/vim-surround'
  25.     Plugin 'Shouguo/Unite.vim'
  26.     Plugin 'Shougo/vimfiler.vim'
  27.     Plugin 'scrooloose/nerdcommenter'
  28.     Plugin 'mtth/scratch.vim'
  29.     Plugin 'JamshedVesuna/vim-markdown-preview'
  30.     Plugin 'davidhalter/jedi-vim'
  31.     call vundle#end()            " required
  32.     filetype plugin indent on
  33.     filetype on
  34.  
  35.     let g:ackprg = 'ag --vimgrep'
  36.  
  37.  
  38.    
  39.  "Default customizations    
  40.     " GUI
  41.     set noruler
  42.     set laststatus=2
  43.     set nu
  44.     colorscheme molokai
  45.     set guifont=Consolas:h9:cANSI
  46.     set guioptions-=T  "toolbar
  47.     set guioptions-=r  "scrollbr
  48.     set listchars=tab:*>,eol:$,precedes:^ "custom whitespace display
  49.     set fillchars=stlnc:_,stl:\|
  50.  
  51. " Editor
  52.     " Editor
  53.     " Folding settings
  54.     set foldenable
  55.     set foldmethod=indent
  56.     set foldlevelstart=2
  57.  
  58.     " http://stevelosh.com/blog/2010/09/coming-home-to-vim/#why-i-came-back-to-vim
  59.     set encoding=utf-8
  60.     set scrolloff=3
  61.     set autoindent
  62.     set showmode
  63.     set showcmd
  64.     set hidden
  65.     set wildmenu
  66.     set wildmode=list:longest
  67.     set cursorline
  68.     set ttyfast
  69.     set ruler
  70.     set backspace=indent,eol,start
  71.     set laststatus=2
  72.     set relativenumber
  73.     set undofile
  74.  
  75.     " Tabs
  76.     set tabstop=4
  77.     set shiftwidth=4
  78.     set softtabstop=4
  79.     set expandtab
  80.  
  81.     " line wrapping
  82.     set nowrap
  83.     set textwidth=0
  84.     set wrapmargin=0
  85.  
  86.         " Search settings
  87.     set ignorecase
  88.     set smartcase
  89.     set gdefault
  90.     set incsearch
  91.     set showmatch
  92.     set hlsearch
  93.  
  94.     " File backup
  95.     " backup file location remapping
  96.     if !isdirectory("$TEMP")
  97.         call mkdir("$TEMP")
  98.     endif
  99.  
  100.     set backup
  101.     set backupdir=$TEMP
  102.     set backupskip=g$TEMP
  103.     set directory=$TEMP
  104.     set writebackup
  105.     set undodir=$TEMP
  106.  
  107.  
  108.  
  109.         " Custom functions
  110.  
  111.                 " Used for file size
  112.         "set statusline=......%{FileSize()}.....
  113.                 let g:word_count=""
  114.         function! WordCount()
  115.             return g:word_count
  116.         endfunction
  117.  
  118.         function! UpdateWordCount()
  119.             let lnum = 1
  120.             let n = 0
  121.             while lnum <= line('$')
  122.                 let n = n + len(split(getline(lnum)))
  123.                 let lnum = lnum + 1
  124.             endwhile
  125.             let g:word_count = n
  126.         endfunction
  127.  
  128.         " Update the count when cursor is idle in command or insert mode.
  129.         " Update when idle for 1000 msec (default is 4000 msec).
  130.         set updatetime=1000
  131.         augroup WordCounter
  132.             au! CursorHold,CursorHoldI * call UpdateWordCount()
  133.         augroup END
  134.  
  135.         function! LineWordCount()
  136.            return len(split(getline(".")))
  137.         endfunction
  138.  
  139.         function! RemainLineWordCount()
  140.            return len(split(strprt(getline("."),col(".")-1)))
  141.         endfunction  
  142.  
  143.         function! FileSize()
  144.             let bytes = getfsize(expand("%:p"))
  145.             if bytes <= 0
  146.                 return ""
  147.             endif
  148.             if bytes > 1048576
  149.                 let x = bytes / 1048576.0
  150.                 return printf("%.4s",x) . " MB"
  151.             endif
  152.  
  153.             if bytes > 1024
  154.                 let x = bytes / 1024.0
  155.                 return printf("%.3s",x) . " KB"
  156.             endif
  157.            
  158.             return bytes
  159.         endfunction
  160.  
  161.         "Region for out-of-the-box customizatins
  162.  
  163.  
  164.         " Dim inactive windows using 'colorcolumn' setting
  165.         " This tends to slow down redrawing, but is very useful.
  166.         " Based on https://groups.google.com/d/msg/vim_use/IJU-Vk-QLJE/xz4hjPjCRBUJ
  167.         " XXX: this will only work with lines containing text (i.e. not '~')
  168.         " from
  169.         if exists('+colorcolumn')
  170.           function! s:DimInactiveWindows()
  171.             for i in range(1, tabpagewinnr(tabpagenr(), '$'))
  172.               let l:range = ""
  173.               if i != winnr()
  174.                 if &wrap
  175.                  " HACK: when wrapping lines is enabled, we use the maximum number
  176.                  " of columns getting highlighted. This might get calculated by
  177.                  " looking for the longest visible line and using a multiple of
  178.                  " winwidth().
  179.                  let l:width=256 " max
  180.                 else
  181.                  let l:width=winwidth(i)
  182.                 endif
  183.                 let l:range = join(range(1, l:width), ',')
  184.               endif
  185.               call setwinvar(i, '&colorcolumn', l:range)
  186.             endfor
  187.           endfunction
  188.           augroup DimInactiveWindows
  189.             au!
  190.             au WinEnter * call s:DimInactiveWindows()
  191.             au WinEnter * set cursorline
  192.             au WinLeave * set nocursorline
  193.           augroup END
  194.         endif
  195.  
  196.         augroup BgHighlight
  197.             autocmd WinLeave * set number
  198.             autocmd WinEnter * set number
  199.         augroup END
  200.  
  201.         " Auto functions
  202.         " automatically reloads any saved .vimrc changes
  203.         augroup myvimrc
  204.             au!
  205.             au BufWritePost .vimrc,_vimrc,vimrc,.gvimrc,_gvimrc,gvimrc so $MYVIMRC
  206.         augroup END
  207.  
  208.         function! NumberToggle()
  209.             if(&relativenumber == 1)
  210.                 set rnu!
  211.             else
  212.                 set rnu
  213.             endif
  214.         endfunc
  215.  
  216.         function! Wnht()
  217.             return winheight(winnr())
  218.         endfunction
  219.  
  220.         function! Wnwt()
  221.             return winwidth(winnr())
  222.         endfunction
  223.  
  224.         function! Menu()
  225.             if (match(&guioptions,'m') != 0 )
  226.                 set guioptions+=m
  227.             else
  228.                 set guioptions-=m
  229.             endif
  230.         endfunction
  231.        
  232.         function! NrBufs()
  233.             let i = bufnr('$')
  234.             let j = 0
  235.             while i >= 1
  236.                 if buflisted(i)
  237.                     let j+=1
  238.                 endif
  239.                 let i-=1
  240.             endwhile
  241.             return j
  242.         endfunction        
  243.  
  244.  
  245. "  http://stevelosh.com/blog/2010/09/coming-home-to-vim/#why-i-came-back-to-vim
  246.  
  247. nnoremap H : set cursorcolumn!<CR>
  248. nnoremap <C-n> :call NumberToggle()<CR>
  249. nnoremap / /\v
  250. vnoremap / /\v
  251. nnoremap <leader><space> :noh<cr>
  252. nnoremap <tab> %
  253. vnoremap <tab> %
  254.  
  255.  
  256. nnoremap <up> <nop>
  257. nnoremap <down> <nop>
  258. nnoremap <left> <nop>
  259. nnoremap <right> <nop>
  260. inoremap <up> <nop>
  261. inoremap <down> <nop>
  262. inoremap <left> <nop>
  263. inoremap <right> <nop>
  264. nnoremap j gj
  265. nnoremap k gk
  266.  
  267. inoremap <F1> <ESC>
  268. nnoremap <F1> <ESC>
  269. vnoremap <F1> <ESC>
  270. nnoremap ; :
  271.  
  272. nnoremap <leader>a :Ack
  273. nnoremap <Leader>M : call Menu()<CR>
  274.  
  275.  
  276.     " StatusLine
  277.     hi User1 guibg=#2F4F4F guifg=green
  278.     hi User2 guibg=#708090 guifg=yellow
  279.     hi User3 guibg=white   guifg=teal
  280.     hi User4 guibg=white   guifg=red
  281.     hi User5 guibg=black   guifg=red
  282.     hi User6 guibg=#2F4F4F guifg=yellow
  283.     hi User7 guibg=#708090 guifg=red
  284.     hi User8 guibg=#708090 guifg=blue
  285.     hi User9 guibg=#708090 guifg=orange
  286.     set statusline=""
  287.     set statusline+=%5*%{winnr()}\ \%m%2*
  288.     set statusline+=[%{toupper(&fileformat)}\|              " file format
  289.     set statusline+=\.%{strlen(&ft)?toupper(&ft):'none'}\|  " filetype
  290.     set statusline+=%{strlen(&fenc)?toupper(&fenc):toupper(&enc)}\]%1*\  " encoding
  291.     set statusline+=\C\:\(%c\|%{strwidth(getline('.'))})\
  292.     set statusline+=\R\:\(%l\|%L\)\  
  293.     set statusline+=\WC\:\(%{LineWordCount()}\|%{WordCount()})
  294.     set statusline+=\ \ B:\(%n\,\?\)\ \
  295.     set statusline+=\(H\|W\)\ %{Wnht()}\ \%{Wnwt()}\ \ \ \ \ \ \ \ \ \ \ \%9*
  296.     set statusline+=%{synIDattr(synID(line('.'),col('.'),1),'name')}\%1*  " highlight
  297.     set statusline+=%=      "left/right separator
  298.     set statusline+=%1*
  299.     set statusline+=\\\\%{hostname()}\ \|\
  300.     set statusline+=%F\ \|\         "Full file path
  301.     set statusline+=%{strftime('%m-%d-%y',getftime(expand('%')))}
  302.     set statusline+=%6*\T%{strftime('%H:%M:%S',getftime(expand('%')))}%8*
  303.     set statusline+=\ \ %{FileSize()}\ \
  304.     set statusline+=\ %P    "percent through fil
  305.  
  306.     set title titlestring=""
  307.     set title titlestring+=\Window\ %{winnr()}\ \|
  308.     set title titlestring+=\|\ Buffer\ \(%n\|%{NrBufs()}\)\]\
  309.     set title titlestring+=\(H\|W\)\ \(%{Wnht()}\ \%{Wnwt()}\)\  
  310.     set title titlestring+=\(r\|R\:\ %l\|%L}\)\  
  311.     set title titlestring=\_\_%{getpid()}\_\_
  312.     set title titlestring+=\\\\%{hostname()}\ \|\
  313.     set title titlestring+=\ \(%{strpart(expand(\"%:p:h\"),stridx(expand(\"%:p:h\"),\"/\",strlen(expand(\"%:p:h\"))-12))}\)
  314.     set title titlestring+=%{expand(\"%:t:r\")}\
  315.     set title titlestring+=%{strftime('%m-%d-%y',getftime(expand('%')))}
  316.     set title titlestring+=\T%{strftime('%H:%M:%S',getftime(expand('%')))}%8*
  317.     set title titlestring+=\ %m\
  318.     set title titlestring+=%Y\
  319.  
  320.  
  321.  
  322. let $LINUX_BASH = 'C:\Windows\SysWOW64\bash.exe'
  323. cmap ~e : e $MYVIMRC
  324. cmap ~E : e! $MYVIMRC
  325. cmap Q : q!
  326. cmap ~p2: !C:\Python27\python.exe %
  327. cmap ~p3 : !python %
  328. cmap ~cq : ConqueTerm
  329. cmap ~b  :+ConqueTerm\ bash
  330. cmap ~c +ConqueTerm\ cmd
  331. cmap ~g +ConqueTerm\ git-bash.exe
  332. cmap ~l +ConqueTerm\ bash
  333.  
  334.  
  335. "set title titlestring+=\(%{strftime('%c',getftime(expand('%')))}\)\
  336.  
  337. "set title titlestring+=%t%(\ %M%)%(\ (%{expand(\"%:p:h\")})%)%(\ %a%)\ -\ %{v:servername}%{strftime('%c',getftime(expand('%')))}
  338.  
  339. cmap ~e : e $MYVIMRC
  340. cmap ~E : e! $MYVIMRC
  341. cmap Q : q!
  342. cmap ~p2: !C:\Python27\python.exe %
  343. cmap ~p3 : !python %
  344. cmap ~cq : ConqueTerm
  345. cmap ~b  :+ConqueTerm\ bash
  346. cmap ~c +ConqueTerm\ cmd
  347. cmap ~g +ConqueTerm\ git-bash.exe
  348. cmap ~l +ConqueTerm\ $LINUX_BASH
  349.  
  350.  
  351. nmap <Leader>s :Scratch<CR>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement