vimrc - my current

" My current .vimrc - uses vundle + git to download and use vim plugins


"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

" VUNDLE CONFIGURATION

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

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 'tomtom/tlib_vim'

Plugin 'preservim/nerdtree'

Plugin 'nachumk/systemverilog.vim'

Plugin 'majutsushi/tagbar'

Plugin 'tomtom/tskeleton_vim'

" Plugin 'SirVer/ultisnips'

Plugin 'vhda/verilog_systemverilog.vim'

Plugin 'honza/vim-snippets'

Plugin 'triglav/vim-visual-increment'

Plugin 'jreybert/vim-align'

Plugin 'rafi/awesome-vim-colorschemes'

Plugin 'vim-airline/vim-airline'

Plugin 'vim-airline/vim-airline-themes'

Plugin 'marcweber/vim-addon-mw-utils'

Plugin 'garbas/vim-snipmate'

Plugin 'kien/ctrlp.vim'

Plugin 'ap/vim-buftabline'

Plugin 'junegunn/fzf.vim'

Plugin 'Yggdroot/indentLine'


call vundle#end() " required

filetype plugin indent on " required


"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

" PLUGIN CONFIGURATIONS

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

"

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

" ULTI SNIPS

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

" Trigger configuration. You need to change this to something else than <tab> if you use https://github.com/Valloric/YouCompleteMe.

" let g:UltiSnipsExpandTrigger="<tab>"

let g:UltiSnipsJumpForwardTrigger="<c-b>"

let g:UltiSnipsJumpBackwardTrigger="<c-z>"


" If you want :UltiSnipsEdit to split your window.

let g:UltiSnipsEditSplit="vertical"


" let g:UltiSnipsSnippetDirectories=["FolderA","FolderB"]

" let g:UltiSnipsSnippetDirectories="~/.vim/custom/snippets/cpp"

let g:UltiSnipsSnippetsDir="~/.vim/custom/snippets"

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

" TSKELETONS

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

autocmd BufNewFile *.sv TSkeletonSetup skeleton.sv


"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

" CTRLP

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

let g:ctrlp_working_path_mode = 'ra'


"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

" AUTO INCREMENT

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

" Autoincrement plugin

" Visual select and type <C-a> to increment number

" Type <C-X> to increment alphabets.

" set nrformats=alpha,octal,hex

set nrformats=alpha



"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

" OTHER

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

"autocmd vimenter * NERDTree

"runtime macros/matchit.vim

nnoremap <leader>u :VerilogGotoInstanceStart<CR>

"let g:SuperTabDefaultCompletionType = 'context'

let g:airline_powerline_fonts=1


"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

" GENERAL VIM CONFIGS "

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

set nocompatible



" Space and TAB

set expandtab " Convert TAB to Space

set tabstop=4 " Number of space used for a TAB

set shiftwidth=4


syntax enable " Enable syntax processing


" UI Config

set number " Set line number

set showcmd " Show command in bottom bar

set wildmenu " Visually autocomplete for command menu

set showmatch " highlight matching [{()}]



" Search

set incsearch " Search as entered

set hlsearch " Highlight search

:highlight Search guifg=black guibg=yellow gui=NONE



" Moving between screens

" ALT + UP arrow will move to the top split screen

nmap <silent> <S-Up> :wincmd k<CR>


" ALT + DOWN arrow will move to the down split screen

nmap <silent> <S-Down> :wincmd j<CR>


" ALT + LEFT arrow will move to the left split screen

nmap <silent> <S-Left> :wincmd h<CR>


" ALT + RIGHT arrow will move to the right split screen

nmap <silent> <S-Right> :wincmd l<CR>


set backspace=2

set backspace=indent,eol,start



" CTAGS

" TAG generation: ctags --langmap=verilog:.jv -R -f ./.tag/tags .

if filereadable("/volume/zfdesign01_bng/users/vinayakas/zf_13march15/.tag/tags")

set tags=/volume/zfdesign01_bng/users/vinayakas/zf_13march15/.tag/tags

endif


" Resize buffers using Ctrl+Shift+<Up/Down>

nmap <silent> <C-S-Up> :resize +15<CR>

nmap <silent> <C-S-Right> :vertical resize +15<CR>



" Map custom extensions to standard syntax

" au BufNewFile,BufRead *.sv setf verilog

au BufNewFile,BufRead *.basetemplate setf perl

"au BufNewFile,BufRead *.jv setf verilog

"au BufNewFile,BufRead *.jhp setf perl



set nocp

set foldmethod=marker

set modeline



" step 2: font configuration

" These are the basic settings to get the font to work (required):

"set guifont=Droid\ Sans\ Mono\ for\ Powerline\ Nerd\ Font\ Complete\ 12

"set encoding=utf-8

" required if using https://github.com/bling/vim-airline


set guifont=Liberation\ Mono\ 11



" To run current vim line as command

" nmap <silent><S-E> :exec '!'.getline('.')<CR>



" Vim advanced : tips

" Edit a file content in hex -> :%!xxd

" Get back from hex mode -> :%!xxd -r

" Add date to file -> :r!date

" Add calendar to file -> :r!cal 1 2017


nnoremap <C-S-Left> :tabprevious<CR>

nnoremap <C-S-Right> :tabnext<CR>

nnoremap k gbi)

nnoremap <C-t> :tabnext<CR>


" set formatoptions=1 -> Won't line break during editing

" autocmd BufWinEnter,FileType javascript colorscheme jellybeans

set formatoptions=1



nmap ,cs :let @*=expand("%:p")<CR> " Mnemonic: Copy File path

nmap yf :let @"=expand("%:p")<CR> " Mnemonic: Yank File path

nmap yfn :let @"=expand("%")<CR> " Mnemonic: yank File Name


" Copy matches

"function! CopyMatches(reg)

" let hits = []

" %s//\=len(add(hits, submatch(0))) ? submatch(0) : ''/gne

" let reg = empty(a:reg) ? '+' : a:reg

" execute 'let @'.reg.' = join(hits, "\n") . "\n"'

"endfunction


"command! -register CopyMatches call CopyMatches(<q-reg>)


" Color alternate lines

function Read_rpt()

hi Alternate guibg=DarkCyan guifg=NONE

execute 'match Alternate /\%(' . join(map(range(1,100), '"\\%" . v:val * 2 . "l"'), '\|') . '\)/'

endfunction



function Clear_rpt()

hi Alternate guibg=NONE guifg=NONE

endfunction


"colorscheme desert

colorscheme deus

" colorscheme deep-space


"let g:tagbar_ctags_bin = /home/vinayaka_s/CTAGS/bin

" set tags=/home/vinayaka_s/THQ/tags;

set tags=./tags;


if !empty(glob("~/vs_scripts/vim_functions"))

source ~/vs_scripts/vim_functions

endif


if !empty(glob("~/.vim/custom/vimFn/vimFn.vim"))

source ~/.vim/custom/vimFn/vimFn.vim

endif


set hidden

nnoremap <C-Up> :bnext<CR>

nnoremap <C-Down> :bprev<CR>


" ]c : - next difference

" [c : - previous difference

" do - diff obtain

" dp - diff put

" :diffupdate - re-scan the files for differences

" %bd|e# - Close all buffers except current