当前位置:网站首页>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
边栏推荐
- 【MnasNet】《MnasNet:Platform-Aware Neural Architecture Search for Mobile》
- 【Hide-and-Seek】《Hide-and-Seek: A Data Augmentation Technique for Weakly-Supervised Localization xxx》
- 乐理基础(简述)
- How to wrap qstring strings
- 【C#笔记】winform中保存DataGridView中的数据为Excel和CSV
- OpenCV常用方法出处链接(持续更新)
- 用C# 语言实现MYSQL 真分页
- OpenCV关于x,y坐标容易混淆的心得
- open3d学习笔记五【RGBD融合】
- 【学习笔记】反向误差传播之数值微分
猜你喜欢
Embedding malware into neural networks
【Batch】learning notes
open3d学习笔记四【表面重建】
【Wing Loss】《Wing Loss for Robust Facial Landmark Localisation with Convolutional Neural Networks》
Vscode下中文乱码问题
Open3d learning note 5 [rgbd fusion]
Eklavya -- infer the parameters of functions in binary files using neural network
Open3D学习笔记一【初窥门径,文件读取】
Open3d learning note 4 [surface reconstruction]
MySQL优化
随机推荐
包图画法注意规范
Global and Chinese market of snow sweepers 2022-2028: Research Report on technology, participants, trends, market size and share
OpenCV常用方法出处链接(持续更新)
Hystrix dashboard cannot find hystrix Stream solution
What if the laptop can't search the wireless network signal
Command line is too long
The internal network of the server can be accessed, but the external network cannot be accessed
【学习笔记】Matlab自编图像卷积函数
Summary of solving the Jetson nano installation onnx error (error: failed building wheel for onnx)
jetson nano安装tensorflow踩坑记录(scipy1.4.1)
Real world anti sample attack against semantic segmentation
Using super ball embedding to enhance confrontation training
力扣每日一题刷题总结:栈与队列篇(持续更新)
OpenCV 6.4 中值滤波器的使用
Global and Chinese market of recovery equipment 2022-2028: Research Report on technology, participants, trends, market size and share
[C # note] the data in DataGridView saved in WinForm is excel and CSV
联邦学习下的数据逆向攻击 -- GradInversion
用MLP代替掉Self-Attention
Prompt 范式简述
Replace convolution with full connection layer -- repmlp