.vimrc

.vimrc

"show line number
set number

set autoindent
set smartindent

"colorscheme set
syntax enable
syntax on
"if has('gui_running')
" set background=dark
"else
" set background=light
"endif

"set background=light
set background=dark
colorscheme solarized
"hi Normal guibg=#99cc99 guifg=Black
"hi LineNr guibg=#003366 guifg=#99ccff ctermbg=7777 ctermfg=blue
set cursorline
"hi CursorLine cterm=NONE ctermbg=darkred ctermfg=white guibg=#66cc99 guifg=black


"set font size 
set guifont=Courier 16

''toolbar hide...
set guioptions-=m "remove menu bar
set guioptions-=T "remove toolbar
set guioptions-=r "remove right-hand scroll bar
set guioptions-=L "remove left-hand scroll bar</span>

set cc=85

set wrap
set tabstop=2
set softtabstop=2
set shiftwidth=2
"Special setup for python
autocmd FileType python setlocal tabstop=4 softtabstop=4 shiftwidth=4


"let tab display as >---, end of line display as -
set listchars=tab:>-,eol:-
"set list
"use space instead tab
set expandtab

"nobackup file : x.sv~
set nobackup

"set undo directory for all files
set undofile
set undodir=~/.undodir

"save setup
let mapleader = "<Space>"
"save and exit
nmap <leader>w :w!<cr>
nmap <leader>q :q!<cr>

"split windows
nmap <leader>v :vs<cr>
nmap <leader>s :sp<cr>

"add line comment --//
nmap <leader>c I#<Esc>

"ALL--->add different comment "//or #" for different type of file
autocmd FileType python,perl                     nnoremap <leader>c I#<Esc>
autocmd FileType c,verilog_systemverilog nnoremap <leader>c I//<Esc>
autocmd FileType vim                                 nnoremap <leader>c I"<Esc>

"remove the first charactor, like // or # or " comment flag
autocmd FileType python,perl                     nnoremap <leader>d 0x
autocmd FileType c,verilog_systemverilog nnoremap <leader>d 0xx
autocmd FileType vim                                 nnoremap <leader>d 0x
 
"highlight specified keywrod
syntax keyword Todo ACTION FIXME TODO
 
"set timestamp for commenct
nmap <leader>t :read !date<CR>I//lxin:
 
"indent whole file from bundle/xx/indent or .vim/indent/ base on filetypenmap <leader>f  <Esc>

"open this file for edit
nmap <leader>e :tabnew ~/.vimrc<cr>

"show pwd: current path
nmap <leader>p :pwd<cr>

"Control 2/4 space for tab
nnoremap <Leader>2 :set tabstop=2 softtabstop=2 shiftwidth=2<CR>
nnoremap <Leader>4 :set tabstop=4 softtabstop=4 shiftwidth=4<CR>

"set for ctags,list all available match items when press ctrl+] or ":tag xx"
nmap <C-]> g<C-]>

"set global tags path
set tags+=/home/xin.li01/self_labs/uvm-1.2/.tags
 
"set python/ruby file header
nmap <leader>py  0i#! /usr/bin/env python3<CR>
nmap <leader>rb 0i#! /usr/bin/env ruby<CR>

"Cancel the function of up/down/left/right
noremap <Up> <Nop>
noremap <Down> <Nop>
noremap <Left> <Nop>
noremap <Right> <Nop>

""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"Common---Applications
"Function definition path: ~/.vim/plugin/common_func.vim
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
map <F4> :call AddAuthor()<cr>

""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"Python---Applications
"Function definition path: ~/.vim/plugin/python_func.vim
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

"Set python file header "#! /usr/bin/env python3"

nmap <Leader>py 0i#! /usr/bin/env python3<CR>
map <F2> :call Add_python_argparse()<cr>
map <F3> :call Add_python_main_cond()<cr>

--
原文地址:https://www.cnblogs.com/freeic/p/11607761.html