首页 > 其他分享 >vim setting

vim setting

时间:2023-04-03 23:34:47浏览次数:35  
标签:set Normal guibg vim setting au highlight specify


/etc/vim/vimrc


set nocompatible    " use vim defaults
set backspace=2    "make backspace like most other apps
set ls=2            " allways show status line
set tabstop=5       " numbers of spaces of tab character
set shiftwidth=5    " numbers of spaces to (auto)indent
set scrolloff=5     " keep 3 lines when scrolling
set showcmd         " display incomplete commands
set hlsearch        " highlight searches
set incsearch       " do incremental searching
set ruler           " show the cursor position all the time
set visualbell t_vb=    " turn off error beep/flash
set novisualbell    " turn off visual bell
set nobackup        " do not keep a backup file
set number          " show line numbers
set ignorecase      " ignore case when searching
"set noignorecase   " don't ignore case
set title           " show title in console title bar
set ttyfast         " smoother changes
"set ttyscroll=0        " turn off scrolling, didn't work well with PuTTY
set modeline        " last lines in document sets vim mode
set modelines=3     " number lines checked for modelines
set shortmess=atI   " Abbreviate messages
set nostartofline   " don't jump to first character when paging
set whichwrap=b,s,h,l,<,>,[,]   " move freely between files
"set viminfo='20,<50,s10,h
set mouse=a

set fileencodings=utf-8,gb2312,gbk,gb18030
set termencoding=utf-8
set encoding=prc

colorscheme desert

set autoindent     " always set autoindenting on
set smartindent        " smart indent
set cindent            " cindent
"set noautoindent
"set nosmartindent
"set nocindent  

"set autowrite      " auto saves changes when quitting and swiching buffer
"set expandtab      " tabs are converted to spaces, use only when required
"set sm             " show matching braces, somewhat annoying...
"set nowrap         " don't wrap lines

highlight Normal guibg=grey90
highlight Cursor guibg=Green guifg=NONE
highlight NonText guibg=grey80
highlight Constant gui=NONE guibg=grey95
highlight Special gui=NONE guibg=grey95

" Color settings for the cursor (different colors for insert mode)
" Modified for black
"highlight Cursor   guifg=white  guibg=black
"highlight Cursor   guifg=red  guibg=lightgreen
highlight Cursor   guifg=white  guibg=black
highlight iCursor  guifg=white  guibg=black

" Cursor shape (insert => vertical line)
set guicursor=n-v-c:block-Cursor
"set guicursor+=i:ver30-iCursor

" Gui background color
"	 highlight Normal guibg=lightblue
"	highlight Normal guibg=lightyellow
"	highlight Normal guibg=#fffddd
"	highlight Normal guibg=#99cccc
"	 highlight Normal guibg=lightmagenta
"	 highlight Normal guibg=lightgreen
" Modified for black
	highlight Normal guibg=#eeeeee
	highlight Normal guibg=white guifg=darkblue
	highlight Normal guibg=black guifg=white

   highlight Visual guibg=black 
"   highlight Visual guibg=lightmagenta

:highlight Normal ctermfg=grey ctermbg=black

syntax on           " syntax highlighing
if has("gui_running")
    " See ~/.gvimrc
    set guifont=Monospace\ 10  " use this font
    set lines=50       " height = 50 lines
    set columns=100        " width = 100 columns
    set background=light   " adapt colors for background
    set selectmode=mouse,key,cmd
"    set keymodel=
else
"    colorscheme elflord    " use this color scheme
    set background=dark        " adapt colors for background
endif

if has("autocmd")
    " Restore cursor position
    au BufReadPost * if line("'\"") > 0|if line("'\"") <= line("$")|exe("norm '\"")|else|exe "norm $"|endif|endif

    " Filetypes (au = autocmd)
    au FileType helpfile set nonumber      " no line numbers when viewing help
    au FileType helpfile nnoremap <buffer><cr> <c-]>   " Enter selects subject
    au FileType helpfile nnoremap <buffer><bs> <c-T>   " Backspace to go back
    
    " When using mutt, text width=72
    au FileType mail,tex set textwidth=72
    au FileType cpp,c,java,sh,pl,php,asp  set autoindent
    au FileType cpp,c,java,sh,pl,php,asp  set smartindent
    au FileType cpp,c,java,sh,pl,php,asp  set cindent
    "au BufRead mutt*[0-9] set tw=72
    
    " Automatically chmod +x Shell and Perl scripts
    "au BufWritePost   *.sh             !chmod +x %
    "au BufWritePost   *.pl             !chmod +x %

    " File formats
    au BufNewFile,BufRead  *.pls    set syntax=dosini
    au BufNewFile,BufRead  modprobe.conf    set syntax=modconf
endif

 

others

 


" use extended function of vim (no compatible with vi)

set nocompatible

" specify encoding

set encoding=euc-jp

" specify file encoding

set fileencodings=iso-2022-jp,sjis

" specify file formats

set fileformats=unix,dos

" take backup

" if not, specify [ set nobackup ]

set backup

" specify backup directory

set backupdir=~/backup

" take 50 search histories

set history=50

" ignore Case

set ignorecase

" distinct Capital if you mix it in search words

set smartcase

" highlights matched words

" if not, specify [ set nohlsearch ]

set hlsearch

" use incremental search

" if not, specify [ set noincsearch ]

set incsearch

" show line number

" if not, specify [ set nonumber ]

set number

" Visualize break ( $ ) or tab ( ^I )

set list

" highlights parentheses

set showmatch

" show color display

" if not, specify [ syntax off ]

syntax on

" change colors for comments if it's set [ syntax on ]

highlight Comment ctermfg=LightCyan

" wrap lines

" if not, specify [ set nowrap ]

set wrap

 

 

 

 

 

 

 

标签:set,Normal,guibg,vim,setting,au,highlight,specify
From: https://blog.51cto.com/u_8895844/6167721

相关文章

  • The Vim commands cheat sheet (ubuntu) vi编辑器常用的命令及快捷键
    HowtoExit :q[uit]QuitVim.Thisfailswhenchangeshavebeenmade.:q[uit]!Quitwithoutwriting.:cq[uit]Quitalways,withoutwriting.:wqWritethecurrentfileandexit.:wq!Writethecurrentfileandexitalways.:wq{file}Writeto{file}.Exitifnotedi......
  • 启动redis时,告警日志中出现“The TCP backlog setting of 511……”以及“overcommit_
    问题描述:启动redis时,告警日志中出现“TheTCPbacklogsettingof511……”以及“overcommit_memoryissetto0…..”警告,如下所示:系统:rhel7.9数据库:redis6.2.61、异常重现[[email protected]]#redis-serverredis6379.conf[root@leo-redis626-aredis-6.......
  • Vimgenius使用教程
    (需要绕过IP封锁等访问限制)BecomeaVimGeniusIncreaseyourspeedandimproveyourmusclememorywithVimGenius,atimedflashcard-stylegamedesignedtomakeyoufasterinVim.It’sfreeandyoudon’tneedtosignup.Whatareyouwaitingfor?StartNow......
  • Neovim,要尝一口不?
    Neovim风评很好,我机器上其实早装了它来替代vim。只不过这两年用vscode较多,冷落了它,除了偶尔改改配置文件,很少用。难得大过年的有点儿空,就来倒腾它一下子,最终效果如下。基础配置从0.5版开始,Neovim允许使用Lua代替VimL作为配置语言,所以这里也直接从init.lua开始了。......
  • mingw64 + nvim + coc.nvim + nvim-dap : C++ windows - 01
    目标用做C++编译器尽量不要扩展其它功能python是避免不了,所以才安装的。1.1下载安装https://mirror.tuna.tsinghua.edu.cn/msys2/distrib/msys2-x86_64-latest.exe安装路径:C:\gnu\msys641.2mingw64.exe使用这个:C:\gnu\msys64\mingw64.exe1.3安装程序:pac......
  • mingw64 + nvim + coc.nvim + nvim-dap : C++ windows - 02
    2.1命令行工具https://github.com/sharkdp/fdhttps://github.com/junegunn/fzfhttps://github.com/BurntSushi/ripgrephttps://github.com/tree-sitter/tree-sitterC:\gnu\cli\fd.exeC:\gnu\cli\fzf.exeC:\gnu\cli\rg.exeC:\gnu\cli\tree-sitter.exe添加到path......
  • mingw64 + nvim + coc.nvim + nvim-dap : C++ windows - 03
    3.1cclshttps://github.com/MaskRay/ccls/wiki/Build在msys中:pacman-S--noconfirmmingw-w64-x86_64-clangmingw-w64-x86_64-clang-tools-extramingw64/mingw-w64-x86_64-pollymingw-w64-x86_64-cmakemingw-w64-x86_64-jqmingw-w64-x86_64-ninjamingw-w64-x86_64-n......
  • mingw64 + nvim + coc.nvim + nvim-dap : C++ windows - 04
    4.1init.vim将init.vim放置到下面:echostdpath('config')~\AppData\Local\nvim4.2plughttps://github.com/junegunn/vim-plug将plug.vim放置到下面~\AppData\Local\nvim-data\site\autoload4.3:PlugInstall4.3.1网络问题gitproxy4.3.2process4.3......
  • mingw64 + nvim + coc.nvim + nvim-dap : C++ windows - 05
    PSC:\Users\dev\Desktop\cpp>cd.\build\PSC:\Users\dev\Desktop\cpp\build>cmake..-DCMAKE_BUILD_TYPE=Debug--Buildingfor:Ninja--TheCcompileridentificationisGNU12.2.0--TheCXXcompileridentificationisGNU12.2.0--Detect......
  • Linux vi/vim
    Linuxvi/vim所有的UnixLike系统都会内建vi文书编辑器,其他的文书编辑器则不一定会存在。但是目前我们使用比较多的是vim编辑器。vim具有程序编辑的能力,可以主动的以字体颜色辨别语法的正确性,方便程序设计。vi是每个开发人员必须要掌握的基础软件,学习系统编程也是离......