当前位置:网站首页>My VIM profile
My VIM profile
2022-07-02 08:06:00 【programmercherry】
open linux terminal
root Under the user vim /root/.vimrc
Excellent blog
Refer to the post
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" General settings
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Set the default decoding
set fenc=utf-8
set fencs=utf-8,usc-bom,euc-jp,gb18030,gbk,gb2312,cp936
" Do not use vi Keyboard mode , It is vim Their own
set nocompatible
" history Number of lines to be recorded in the file
set history=100
" When dealing with unsaved or read-only files , Pop up confirmation
set confirm
" And windows Share clipboard
set clipboard+=unnamed
" Detect file types
filetype on
" Load file type plug-in
filetype plugin on
" Load related indented files for a specific file type
filetype indent on
" Save global variables
set viminfo+=!
" Words with the following symbols should not be separated by line breaks
set iskeyword+=_,$,@,%,#,-
" Syntax highlighting
syntax on
" Highlight character , Let it not be affected 100 Column restrictions
:highlight OverLength ctermbg=red ctermfg=white guibg=red guifg=white
:match OverLength '\%101v.*'
" Status line color
highlight StatusLine guifg=SlateBlue guibg=Yellow
highlight StatusLineNC guifg=Gray guibg=White
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" File settings
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Don't back up files ( Choose according to your own needs )
set nobackup
" Do not generate swap file , When buffer Hide it when it's discarded
setlocal noswapfile
set bufhidden=hide
" The number of pixel lines inserted between characters
set linespace=0
" Command line autocomplete in enhanced mode
set wildmenu
" The line number and column number at the cursor position are displayed on the status line
set ruler
set rulerformat=%20(%2*%<%f%=\ %m%r\ %3l\ %c\ %p%%%)
" Command line ( In the status line ) Height , The default is 1, Here is 2
set cmdheight=2
" Make the backspace key (backspace) Normal processing indent, eol, start etc.
set backspace=2
" allow backspace And cursor keys across line boundaries
set whichwrap+=<,>,h,l
" Can be in buffer Using the mouse anywhere ( similar office Double click in the workspace to locate )
set mouse=a
set selection=exclusive
set selectmode=mouse,key
" When it's launched, it doesn't show the hint of helping Somali children
set shortmess=atI
" By using : commands command , Tell us which line of the document has been changed
set report=0
" Not allow vim Make a nasty drip
set noerrorbells
" Show white space between divided windows , Easy to read
set fillchars=vert:\ ,stl:\ ,stlnc:\
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Search and match
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Highlight the matching brackets
set showmatch
" Match the highlighted time of brackets ( The unit is one tenth of a second )
set matchtime=5
" Ignore case when searching
set ignorecase
" Don't highlight the sentence being searched (phrases)
set nohlsearch
" In search , Highlight the words and sentences one by one ( similar firefox Search for )
set incsearch
" Input :set list The command is what should be displayed ?
set listchars=tab:\|\ ,trail:.,extends:>,precedes:<,eol:$
" Cursor moves to buffer Keep the top and bottom of 3 Row distance
set scrolloff=3
" Don't blink
set novisualbell
" What my status line shows ( Including file type and decoding )
set statusline=%F%m%r%h%w\[POS=%l,%v][%p%%]\%{
strftime(\"%d/%m/%y\ -\ %H:%M\")}
" Always show status lines
set laststatus=2
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Text formatting and typesetting
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Auto format
set formatoptions=tcrqn
" Inherit the indent of the previous line , Especially for multiline comments
set autoindent
" by C The program provides automatic indentation
set smartindent
" Use C Indent of style
set cindent
" The box drawings are 4
set tabstop=4
" Indent uniformly to 4
set softtabstop=4
set shiftwidth=4
" Don't use spaces instead of tabs
set noexpandtab
" Don't change lines
set nowrap
" Use tabs at the beginning of lines and paragraphs
set smarttab
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" CTags Set up
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Sort by name
let Tlist_Sort_Type = "name"
" Show the window on the right
let Tlist_Use_Right_Window = 1
" Compression way
let Tlist_Compart_Format = 1
" If only one buffer,kill Windows also kill fall buffer
let Tlist_Exist_OnlyWindow = 1
" Don't close other files tags
let Tlist_File_Fold_Auto_Close = 0
" Don't show the fold tree
let Tlist_Enable_Fold_Column = 0
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Autocommands
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Display line numbers only when the following file types are detected , Plain text files do not display
if has("autocmd")
autocmd FileType xml,html,c,cs,java,perl,shell,bash,cpp,python,vim,php,ruby set number
autocmd FileType xml,html vmap <C-o> <ESC>'<i<!--<ESC>o<ESC>'>o-->
autocmd FileType java,c,cpp,cs vmap <C-o> <ESC>'<o
autocmd FileType html,text,php,vim,c,java,xml,bash,shell,perl,python setlocal textwidth=100
autocmd Filetype html,xml,xsl source $VIMRUNTIME/plugin/closetag.vim
autocmd BufReadPost *
\ if line("'\"") > 0 && line("'\"") <= line("$") |
\ exe " normal g`\"" |
\ endif
endif "has("autocmd")
" F5 Compile and run C Program ,F6 Compile and run C++ Program
" Please note that , The following code is in windows An error will be reported when using
" Need to get rid of it. ./ These two characters
" C Compile and run
map <F5> :call CompileRunGcc()<CR>
func! CompileRunGcc()
exec "w"
exec "!gcc % -o %<"
exec "! ./%<"
endfunc
" C++ Compile and run
map <F6> :call CompileRunGpp()<CR>
func! CompileRunGpp()
exec "w"
exec "!g++ % -o %<"
exec "! ./%<"
endfunc
" Can display beautifully .NFO file
set encoding=utf-8
function! SetFileEncodings(encodings)
let b:myfileencodingsbak=&fileencodings
let &fileencodings=a:encodings
endfunction
function! RestoreFileEncodings()
let &fileencodings=b:myfileencodingsbak
unlet b:myfileencodingsbak
endfunction
au BufReadPre *.nfo call SetFileEncodings('cp437')|set ambiwidth=single au BufReadPost *.nfo call RestoreFileEncodings()
" Highlight normal txt file ( need txt.vim Script )
au BufRead,BufNewFile * setfiletype txt
" Use the space bar to turn on and off folding
set foldenable
set foldmethod=manual
nnoremap <space> @=((foldclosed(line('.')) < 0) ? 'zc':'zo')<CR>
" minibufexpl General settings of plug-ins
let g:miniBufExplMapWindowNavVim = 1
let g:miniBufExplMapWindowNavArrows = 1
let g:miniBufExplMapCTabSwitchBufs = 1
let g:miniBufExplModSelTarget = 1
边栏推荐
- [learning notes] numerical differentiation of back error propagation
- 使用Matplotlib绘制图表初步
- Business architecture diagram
- Hystrix dashboard cannot find hystrix Stream solution
- Network metering - transport layer
- 【MobileNet V3】《Searching for MobileNetV3》
- Media query usage
- Data reverse attack under federated learning -- gradinversion
- OpenCV3 6.2 低通滤波器的使用
- 【Batch】learning notes
猜你喜欢
随机推荐
Sequence problem for tqdm and print
C # connect to MySQL database
How gensim freezes some word vectors for incremental training
Comparison between setTimeout and requestanimationframe (page refresh)
浅谈深度学习模型中的后门
SQL操作数据库语法
Feature Engineering: summary of common feature transformation methods
Data reverse attack under federated learning -- gradinversion
Prompt 范式简述
【Random Erasing】《Random Erasing Data Augmentation》
Meta Learning 简述
Several methods of image enhancement and matlab code
JVM instructions
针对语义分割的真实世界的对抗样本攻击
WCF更新服务引用报错的原因之一
【TCDCN】《Facial landmark detection by deep multi-task learning》
Open3d learning note 4 [surface reconstruction]
【学习笔记】反向误差传播之数值微分
【BiSeNet】《BiSeNet:Bilateral Segmentation Network for Real-time Semantic Segmentation》
Real world anti sample attack against semantic segmentation