vimrc

Sample .vimrc

" vimPlugin/Align.vba

execute pathogen#infect()


let g:airline#extensions#tabline#enabled = 1

let g:airline_theme = 'papercolor'


" colorscheme codeschool

colorscheme bubblegum-256-dark

"colorscheme badwolf

:hi VimwikiHeader1 guifg=#FF0000

:hi VimwikiHeader2 guifg=#00FF00


" ctrlp - keep any number of files in cache

let g:ctrlp_max_files=0

" :CtrlPClearAllCaches


" Use Ag silver search

let g:ackprg = 'ag --nogroup --nocolor --column'


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

filetype plugin on

" 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

let g:airline_powerline_fonts=1


" 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>


" 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


" Run script with current buffer as input, and place output in a temp buffer

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

source ~/vs_scripts/vim_functions

endif