Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- set nocompatible " be iMproved, required
- filetype off " required
- " set the runtime path to include Vundle and initialize
- set rtp+=~/.vim/bundle/Vundle.vim
- call vundle#begin()
- " alternatively, pass a path where Vundle should install plugins
- "call vundle#begin('~/some/path/here')
- " let Vundle manage Vundle, required
- Plugin 'VundleVim/Vundle.vim'
- Plugin 'scrooloose/nerdcommenter'
- Plugin 'scrooloose/nerdtree'
- " Plugin 'joonty/vdebug'
- Plugin 'mileszs/ack.vim'
- Plugin 'tpope/vim-surround'
- Plugin 'Yggdroot/indentLine'
- Plugin 'tpope/vim-fugitive'
- Plugin 'chase/vim-ansible-yaml'
- Plugin 'pangloss/vim-javascript'
- Plugin 'mxw/vim-jsx'
- Plugin 'timakro/vim-searchant'
- " Plugin 'Chiel92/vim-autoformat'
- " All of your Plugins must be added before the following line
- call vundle#end() " required
- filetype plugin indent on " required
- " To ignore plugin indent changes, instead use:
- " filetype plugin on
- "
- " Brief help
- " :PluginList - lists configured plugins
- " :PluginInstall - installs plugins; append `!` to update or just :PluginUpdate
- " :PluginSearch foo - searches for foo; append `!` to refresh local cache
- " :PluginClean - confirms removal of unused plugins; append `!` to auto-approve removal
- "
- " see :h vundle for more details or wiki for FAQ
- " Put your non-Plugin stuff after this line
- " Uncomment the following to have Vim jump to the last position when
- " reopening a file
- if has("autocmd")
- au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
- endif
- syntax on
- set tabstop=2
- set softtabstop=2
- set shiftwidth=2
- set scrolloff=10
- set autoindent
- set smartindent
- set hlsearch
- set backspace=indent,eol,start
- set whichwrap+=<,>,[,]
- set noswapfile
- set smartcase
- set number
- set nobackup
- set pastetoggle=<F2>
- set ruler
- set colorcolumn=101
- command W w
- command Q q
- command Path echo expand('%:p')
- nnoremap <silent> QQ :q<CR>
- nnoremap <silent> WW :w<CR>
- nmap <F1> <Plug>SearchantStop
- imap <F1> <c-o><F1>
- nnoremap <silent> <F3> :set invlist<CR>:set invnumber<CR>:IndentLinesToggle<CR>
- imap <silent> <F3> <c-o>:set invlist<CR><c-o>:set invnumber<CR><c-o>:IndentLinesToggle<CR>
- vmap <silent> <F8> <c-\><c-n><F8>gv
- smap <silent> <F8> <c-\><c-n><F8>gv<c-g>
- colorscheme vividchalk
- hi Search cterm=None ctermfg=darkgrey ctermbg=yellow
- hi ColorColumn ctermbg=black cterm=reverse
- ""
- " Filetype configurations
- ""
- au BufRead,BufNewFile *logcat* set filetype=logcat
- au BufRead,BufNewFile .bash* set filetype=sh
- au BufRead,BufNewFile *.hdef set filetype=json
- au BufRead,BufNewFile *.yaml set filetype=ansible
- au FileType javascript setlocal shiftwidth=2 softtabstop=2 tabstop=2 expandtab
- au FileType python setlocal shiftwidth=2 softtabstop=2 tabstop=2 expandtab
- ""
- " NERD Commenter
- ""
- let g:NERDSpaceDelims = 1
- let g:NERDDefaultAlign = 'left'
- let g:NERDCommentEmptyLines = 1
- ""
- " NERD Tree
- ""
- map <C-n> :NERDTreeToggle<CR>
- imap <silent> <C-n> <c-o>:NERDTreeToggle<CR>
- autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
- ""
- " indentLines
- ""
- let g:indentLine_char='|'
- " related
- set list
- set listchars=tab:›―
- ""
- " Splits
- ""
- nnoremap <silent> <C-Left> <C-W><Left>
- nnoremap <silent> <C-Right> <C-W><Right>
- ""
- " Title
- ""
- let hostname=substitute(hostname(), '\..*$', '', '')
- let &titlestring="%{hostname} | %t%(\ %M%)%(\ [%{expand(\"%:~:h\")}]%)"
- if &term == "screen"
- set t_ts=^[k
- set t_fs=^[\
- endif
- if &term == "screen" || &term =~ "xterm"
- set title
- endif
- ""
- " SMART HOME
- ""
- "place in vimrc
- nmap <silent><Home> :call SmartHome("n")<CR>
- nmap <silent><End> :call SmartEnd("n")<CR>
- imap <silent><Home> <C-r>=SmartHome("i")<CR>
- imap <silent><End> <C-r>=SmartEnd("i")<CR>
- vmap <silent><Home> <Esc>:call SmartHome("v")<CR>
- vmap <silent><End> <Esc>:call SmartEnd("v")<CR>
- function SmartHome(mode)
- let curcol = col(".")
- "gravitate towards beginning for wrapped lines
- if curcol > indent(".") + 2
- call cursor(0, curcol - 1)
- endif
- if curcol == 1 || curcol > indent(".") + 1
- if &wrap
- normal g^
- else
- normal ^
- endif
- else
- if &wrap
- normal g0
- else
- normal 0
- endif
- endif
- if a:mode == "v"
- normal msgv`s
- endif
- return ""
- endfunction
- function SmartEnd(mode)
- let curcol = col(".")
- let lastcol = a:mode == "i" ? col("$") : col("$") - 1
- "gravitate towards ending for wrapped lines
- if curcol < lastcol - 1
- call cursor(0, curcol + 1)
- endif
- if curcol < lastcol
- if &wrap
- normal g$
- else
- normal $
- endif
- else
- normal g_
- endif
- "correct edit mode cursor position, put after current character
- if a:mode == "i"
- call cursor(0, col(".") + 1)
- endif
- if a:mode == "v"
- normal msgv`s
- endif
- return ""
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement