Advertisement
Guest User

Untitled

a guest
Dec 15th, 2017
248
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VIM 4.86 KB | None | 0 0
  1. set nocompatible              " be iMproved, required
  2. filetype off                  " required
  3.  
  4. " set the runtime path to include Vundle and initialize
  5. set rtp+=~/.vim/bundle/Vundle.vim
  6. call vundle#begin()
  7. " alternatively, pass a path where Vundle should install plugins
  8. "call vundle#begin('~/some/path/here')
  9.  
  10. " let Vundle manage Vundle, required
  11. Plugin 'VundleVim/Vundle.vim'
  12.  
  13. Plugin 'scrooloose/nerdcommenter'
  14. Plugin 'scrooloose/nerdtree'
  15. " Plugin 'joonty/vdebug'
  16. Plugin 'mileszs/ack.vim'
  17. Plugin 'tpope/vim-surround'
  18. Plugin 'Yggdroot/indentLine'
  19. Plugin 'tpope/vim-fugitive'
  20. Plugin 'chase/vim-ansible-yaml'
  21. Plugin 'pangloss/vim-javascript'
  22. Plugin 'mxw/vim-jsx'
  23. Plugin 'timakro/vim-searchant'
  24. " Plugin 'Chiel92/vim-autoformat'
  25.  
  26. " All of your Plugins must be added before the following line
  27. call vundle#end()            " required
  28. filetype plugin indent on    " required
  29. " To ignore plugin indent changes, instead use:
  30. " filetype plugin on
  31. "
  32. " Brief help
  33. " :PluginList       - lists configured plugins
  34. " :PluginInstall    - installs plugins; append `!` to update or just :PluginUpdate
  35. " :PluginSearch foo - searches for foo; append `!` to refresh local cache
  36. " :PluginClean      - confirms removal of unused plugins; append `!` to auto-approve removal
  37. "
  38. " see :h vundle for more details or wiki for FAQ
  39. " Put your non-Plugin stuff after this line
  40.  
  41. " Uncomment the following to have Vim jump to the last position when
  42. " reopening a file
  43. if has("autocmd")
  44.   au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
  45. endif
  46.  
  47. syntax on
  48.  
  49. set tabstop=2
  50. set softtabstop=2
  51. set shiftwidth=2
  52. set scrolloff=10
  53. set autoindent
  54. set smartindent
  55. set hlsearch
  56. set backspace=indent,eol,start
  57. set whichwrap+=<,>,[,]
  58. set noswapfile
  59. set smartcase
  60. set number
  61. set nobackup
  62.  
  63. set pastetoggle=<F2>
  64. set ruler
  65. set colorcolumn=101
  66.  
  67. command W w
  68. command Q q
  69. command Path echo expand('%:p')
  70.  
  71. nnoremap <silent> QQ :q<CR>
  72. nnoremap <silent> WW :w<CR>
  73.  
  74. nmap     <F1> <Plug>SearchantStop
  75. imap     <F1> <c-o><F1>
  76. nnoremap <silent> <F3> :set invlist<CR>:set invnumber<CR>:IndentLinesToggle<CR>
  77. imap     <silent> <F3> <c-o>:set invlist<CR><c-o>:set invnumber<CR><c-o>:IndentLinesToggle<CR>
  78. vmap     <silent> <F8> <c-\><c-n><F8>gv
  79. smap     <silent> <F8> <c-\><c-n><F8>gv<c-g>
  80.  
  81. colorscheme vividchalk
  82. hi Search cterm=None ctermfg=darkgrey ctermbg=yellow
  83. hi ColorColumn ctermbg=black cterm=reverse
  84.  
  85. ""
  86.  " Filetype configurations
  87.  ""
  88. au BufRead,BufNewFile *logcat* set filetype=logcat
  89. au BufRead,BufNewFile .bash* set filetype=sh
  90. au BufRead,BufNewFile *.hdef set filetype=json
  91. au BufRead,BufNewFile *.yaml set filetype=ansible
  92. au FileType javascript setlocal shiftwidth=2 softtabstop=2 tabstop=2 expandtab
  93. au FileType python setlocal shiftwidth=2 softtabstop=2 tabstop=2 expandtab
  94.  
  95. ""
  96.  " NERD Commenter
  97.  ""
  98. let g:NERDSpaceDelims = 1
  99. let g:NERDDefaultAlign = 'left'
  100. let g:NERDCommentEmptyLines = 1
  101.  
  102. ""
  103.  " NERD Tree
  104.  ""
  105. map <C-n> :NERDTreeToggle<CR>
  106. imap <silent> <C-n> <c-o>:NERDTreeToggle<CR>
  107. autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
  108.  
  109. ""
  110.  " indentLines
  111.  ""
  112. let g:indentLine_char='|'
  113. " related
  114. set list
  115. set listchars=tab:›―
  116.  
  117. ""
  118.  " Splits
  119.  ""
  120. nnoremap <silent> <C-Left> <C-W><Left>
  121. nnoremap <silent> <C-Right> <C-W><Right>
  122.  
  123. ""
  124.  " Title
  125.  ""
  126. let hostname=substitute(hostname(), '\..*$', '', '')
  127. let &titlestring="%{hostname} | %t%(\ %M%)%(\ [%{expand(\"%:~:h\")}]%)"
  128. if &term == "screen"
  129.   set t_ts=^[k
  130.   set t_fs=^[\
  131. endif
  132. if &term == "screen" || &term =~ "xterm"
  133.   set title
  134. endif
  135.  
  136. ""
  137.  " SMART HOME
  138.  ""
  139.  
  140. "place in vimrc
  141. nmap <silent><Home> :call SmartHome("n")<CR>
  142. nmap <silent><End> :call SmartEnd("n")<CR>
  143. imap <silent><Home> <C-r>=SmartHome("i")<CR>
  144. imap <silent><End> <C-r>=SmartEnd("i")<CR>
  145. vmap <silent><Home> <Esc>:call SmartHome("v")<CR>
  146. vmap <silent><End> <Esc>:call SmartEnd("v")<CR>
  147.  
  148. function SmartHome(mode)
  149.   let curcol = col(".")
  150.   "gravitate towards beginning for wrapped lines
  151.   if curcol > indent(".") + 2
  152.     call cursor(0, curcol - 1)
  153.   endif
  154.   if curcol == 1 || curcol > indent(".") + 1
  155.     if &wrap
  156.       normal g^
  157.     else
  158.       normal ^
  159.     endif
  160.   else
  161.     if &wrap
  162.       normal g0
  163.     else
  164.       normal 0
  165.     endif
  166.   endif
  167.   if a:mode == "v"
  168.     normal msgv`s
  169.   endif
  170.   return ""
  171. endfunction
  172.  
  173. function SmartEnd(mode)
  174.   let curcol = col(".")
  175.   let lastcol = a:mode == "i" ? col("$") : col("$") - 1
  176.   "gravitate towards ending for wrapped lines
  177.   if curcol < lastcol - 1
  178.     call cursor(0, curcol + 1)
  179.   endif
  180.   if curcol < lastcol
  181.     if &wrap
  182.       normal g$
  183.     else
  184.       normal $
  185.     endif
  186.   else
  187.     normal g_
  188.   endif
  189.   "correct edit mode cursor position, put after current character
  190.   if a:mode == "i"
  191.     call cursor(0, col(".") + 1)
  192.   endif
  193.   if a:mode == "v"
  194.     normal msgv`s
  195.   endif
  196.   return ""
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement