Vim配置
vim 配置文件
vim 的全局配置一般在/etc/vim/vimrc
或者/etc/vimrc
,对所有用户生效。用户个人的配置在~/.vimrc
复制代码
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
- 74
- 75
- 76
- 77
- 78
- 79
- 80
- 81
- 82
- 83
- 84
- 85
- 86
- 87
- 88
- 89
- 90
- 91
- 92
- 93
- 94
- 95
- 96
- 97
- 98
- 99
- 100
- 101
- 102
- 103
- 104
- 105
- 106
- 107
- 108
"语法高亮
syntax on
"在底部显示,当前处于命令模式还是插入模式
set showmode
"命令模式下,在底部显示,当前键入的指令
set showcmd
"显示行号
set nu
"设置光标行高亮显示,背景是红色,文字时白色
"ctermbg:当前行的背景色,ctermfg:当前行的前景色(文字颜色)
set cursorline
hi CursorLine cterm=NONE ctermbg=darkred ctermfg=white
"显示括号匹配
set showmatch
"设置缩进
"设置Tab长度为4空格'
set tabstop=4
"设置自动缩进长度为4空格'
set shiftwidth=4
"自动对齐,继承前一行的缩进方式,适用于多行注释'
set autoindent
"智能缩进
set smartindent
"c文件自动缩进
set cindent
"搜索时,每输入一个字符,就自动跳到第一个匹配的结果
set incsearch
"设置粘贴模式
"set paste
"启用鼠标
set mouse=a " always use mouse
"绑定复制/粘贴快捷键,复制到系统粘贴板
let mapleader=";" "设置前置键
vmap <leader>c "+y "可视化模式使用 ;c 复制
nmap <leader>v "+p "正常模式使用 ;v 粘贴
imap <leader>v <esc>"+p "插入模式使用 ;v 粘贴
"设置tags,首先在当前目录寻找tags文件,没找到的话再去上层目录寻找
set tags=tags;
set autochdir
"让taglist中函数刷新变快
set updatetime=100
"PATHOGEN配置
execute pathogen#infect()
filetype plugin on "允许插件
filetype plugin indent on "启动智能补全
"nerdtree配置
"快捷键:使用F2打开关闭
"map <F2> :NERDTreeMirror <CR>
"map <F2> :NERDTreeToggle <CR> "开关NERDTree
map <F2> :NERDTreeTabsToggle <CR> "开关NERDTree tab版, 需要安装vim-nerdtree-tabs插件
"NERDTree配置
let NERDChristmasTree=1 "显示增强
let NERDTreeAutoCenter=1 "自动调整焦点
let NERDTreeShowFiles=1 "显示文件
let NERDTreeShowLineNumbers=1 "显示行号
let NERDTreeHightCursorline=1 "高亮当前文件
let NERDTreeShowHidden=0 "显示隐藏文件
let NERDTreeMinimalUI=0 "不显示'Bookmarks' label 'Press ? for help'
let NERDTreeWinPos='left' "窗口位置在左边
let NERDTreeWinSize=31 "窗口宽度
"当NERDTree为剩下的唯一窗口时自动关闭
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
"打开vim时自动打开NERDTreetab
let g:nerdtree_tabs_open_on_console_startup=0
"taglist配置信息
"打开关闭快捷键
map <silent> <F3> :TlistToggle<CR>
let Tlist_Auto_Open=0 " Let the tag list open automatically
let Tlist_Auto_Update=0 " Update the tag list automatically
let Tlist_Compact_Format=1 " Hide help menu
let Tlist_Ctags_Cmd='ctags' " Location of ctags
let Tlist_Enable_Fold_Column=0 "do show folding tree
let Tlist_Process_File_Always=1 " Always process the source file
let Tlist_Show_One_File=1 " Only show the tag list of current file
let Tlist_Exit_OnlyWindow=1 " If you are the last, kill yourself
let Tlist_File_Fold_Auto_Close=0 " Fold closed other trees
let Tlist_Sort_Type="name" " Order by name
let Tlist_WinWidth=30 " Set the window 40 cols wide.
let Tlist_Close_On_Select=0 " Close the list when a item is selected
let Tlist_Use_SingleClick=1 "Go To Target By SingleClick
let Tlist_Use_Right_Window=1 "在右侧显示
"EasyComplete配置
imap <Tab> <Plug>EasyCompTabTrigger
imap <S-Tab> <Plug>EasyCompShiftTabTrigger
let g:pmenu_scheme = 'dark'
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步