-
2022-04-11 10:45:44
安装:
sudo apt-get install vim
配置:
如果要配置全局参数,则修改/etc/vim/vimrcsudo vim /etc/vim/vimrc
如果仅修改vim个人配置的话,则修改/home/username/.vimrc
vim /home/lyy/.vimrc
一般配置参数如下,将其复制保存到文件尾部即可。
" 在窗口标题栏显示文件名称 set title " 显示行号 set number " 语法高亮 set syntax=on " Tab键的宽度为4 set tabstop=4 " 统一缩进为4 set softtabstop=4 " 自动缩进 set autoindent " 代码补全 set completeopt=preview,menu " 去掉输入错误的提示声音 set noeb " 不需要备份 set nobackup " 禁止生成临时文件 set noswapfile " 搜索时高亮显示 set hlsearch " 不区分大小写 set ignorecase
更多相关内容 -
Ubuntu vim配置(很简单)
2021-04-15 19:27:55下载vimconfig.tar.tgz,将文件拷贝到ubuntu, 执行下面命令: tar zxvf vimconfig.tar.tgz cd vimconfig cp .* ~/ -rvf 部分配置情况: "-------------TagList--------------- "设置ctags路径 let Tlist_Ctags_Cmd ... -
ubuntu vim配置
2019-01-14 15:00:23vim函数自动补齐,追踪代码,F2函数列表,F3文件列表等等快捷键,可看.vimrc参考,记得下载sudo apt-install cscope sudo apt-install ctags,要不然会报错。用法:解压后直接把.vimrc文件 和.vim文件夹直接放在家... -
ubuntu vim配置(参考)
2021-08-30 13:59:05安装好ubuntu虚拟机后,一般都会安装vim,但是原生的vim编辑器一般都不太好用。 结合网上的一些参考配置,就写了一份自己的配置,特此用此博客记录下,需要的自取即可。 执行如下指令: vim /etc/vim/vimrc 将下列...安装好ubuntu虚拟机后,一般都会安装vim,但是原生的vim编辑器一般都不太好用。
结合网上的一些参考配置,就写了一份自己的配置,特此用此博客记录下,需要的自取即可。
执行如下指令:vim /etc/vim/vimrc
将下列内容复制到vimrc文本中。
" All system-wide defaults are set in $VIMRUNTIME/debian.vim and sourced by " the call to :runtime you can find below. If you wish to change any of those " settings, you should do it in this file (/etc/vim/vimrc), since debian.vim " will be overwritten everytime an upgrade of the vim packages is performed. " It is recommended to make changes after sourcing debian.vim since it alters " the value of the 'compatible' option. " This line should not be removed as it ensures that various options are " properly set to work with the Vim-related packages available in Debian. runtime! debian.vim " Vim will load $VIMRUNTIME/defaults.vim if the user does not have a vimrc. " This happens after /etc/vim/vimrc(.local) are loaded, so it will override " any settings in these files. " If you don't want that to happen, uncomment the below line to prevent " defaults.vim from being loaded. " let g:skip_defaults_vim = 1 " Uncomment the next line to make Vim more Vi-compatible " NOTE: debian.vim sets 'nocompatible'. Setting 'compatible' changes numerous " options, so any other options should be set AFTER setting 'compatible'. "set compatible " Vim5 and later versions support syntax highlighting. Uncommenting the next " line enables syntax highlighting by default. if has("syntax") syntax on endif " If using a dark background within the editing area and syntax highlighting " turn on this option as well "set background=dark " Uncomment the following to have Vim jump to the last position when " reopening a file "if has("autocmd") " au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif "endif " Uncomment the following to have Vim load indentation rules and plugins " according to the detected filetype. "if has("autocmd") " filetype plugin indent on "endif " The following are commented out as they cause vim to behave a lot " differently from regular Vi. They are highly recommended though. "set showcmd " Show (partial) command in status line. "set showmatch " Show matching brackets. "set ignorecase " Do case insensitive matching "set smartcase " Do smart case matching "set incsearch " Incremental search "set autowrite " Automatically save before commands like :next and :make "set hidden " Hide buffers when they are abandoned "set mouse=a " Enable mouse usage (all modes) " Source a global configuration file if available if filereadable("/etc/vim/vimrc.local") source /etc/vim/vimrc.local endif set nu set tabstop set nobackup set cursorline set ruler set autoindent set t_Co=256 autocmd BufNewFile *.cpp,*.[ch],*.sh,*.java exec ":call SetTitle()" func SetTitle() if &filetype == 'sh' call setline(1, "##########################################################################") call append(line("."), "# File Name: ".expand("%")) call append(line(".")+1, "# Author: 小和尚念经敲木鱼") call append(line(".")+2, "# mail: ") call append(line(".")+3, "# Created Time: ".strftime("%c")) call append(line(".")+4, "#########################################################################") call append(line(".")+5, "#!/bin/bash") call append(line(".")+6, "") call append(line(".")+7, "#/************end of file*****************/") else call setline(1, "/*************************************************************************") call append(line("."), " > File Name: ".expand("%")) call append(line(".")+1, " > Author: 小和尚念经敲木鱼") call append(line(".")+2, " > Mail: ") call append(line(".")+3, " > Created Time: ".strftime("%c")) call append(line(".")+4, " ***********************************************************************/") call append(line(".")+5, "") endif if &filetype == 'cpp' call append(line(".")+6, "#include<iostream>") call append(line(".")+7, "using namespace std;") call append(line(".")+8, "/************************************************************************") call append(line(".")+9, "* 文件说明") call append(line(".")+10, "************************************************************************/") call append(line(".")+11, "int main(int agc,char * agv[])") call append(line(".")+12, "{") call append(line(".")+13, "") call append(line(".")+14, " ") call append(line(".")+15, " ") call append(line(".")+16, " return 0;") call append(line(".")+17, "}") call append(line(".")+18, "/******************************end of file******************************/") else endif if &filetype == 'c' call append(line(".")+6, "#include<stdio.h>") call append(line(".")+7, "/************************************************************************") call append(line(".")+8, "* 文件说明") call append(line(".")+9, "************************************************************************/") call append(line(".")+10, "int main(int agc,char * agv[])") call append(line(".")+11, "{") call append(line(".")+12, "") call append(line(".")+13, " ") call append(line(".")+14, " ") call append(line(".")+15, " return 0;") call append(line(".")+16, "}") call append(line(".")+17, "/*******************************end of file*****************************/") endif if &filetype == 'java' call append(line(".")+6,"public class ".expand("%")) call append(line(".")+7,"") endif "新建文件后,自动定位到文件末尾 autocmd BufNewFile * normal G endfunc set autowrite set magic set foldcolumn=0 set number set hlsearch set incsearch
退出保存。
执行下面指令:source /etc/vim/vimrc
完成收工! -
ubuntu vim 配置
2018-08-18 01:45:02第一步 bundule 配置 参考帖子 https://www.cnblogs.com/demonspider/p/3216273.html git clone git@github.com:chloerei/vimrc.git cd vimrc rake deploy 第二步 安装vimplus 参考帖子: ...第一步 bundule 配置
参考帖子 https://www.cnblogs.com/demonspider/p/3216273.html
git clone git@github.com:chloerei/vimrc.git cd vimrc rake deploy
第二步 安装vimplus
参考帖子: https://www.cnblogs.com/highway-9/p/5984285.html
安装(github地址:https://github.com/chxuan/vimplus.git, 欢迎star和fork)
Mac OS X
-
安装HomeBrew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
-
安装vimplus
git clone https://github.com/chxuan/vimplus.git ~/.vimplus cd ~/.vimplus ./install.sh
Ubuntu
-
版本要求
ubuntu14.04
及其以上64
位系统。 -
安装vimplus(建议在普通用户下安装)
git clone https://github.com/chxuan/vimplus.git ~/.vimplus cd ~/.vimplus ./install.sh
Centos
-
版本要求
centos7
及其以上64
位系统。 -
安装vimplus(建议在普通用户下安装)
git clone https://github.com/chxuan/vimplus.git ~/.vimplus cd ~/.vimplus ./install.sh
ArchLinux
-
安装vimplus
git clone https://github.com/chxuan/vimplus.git ~/.vimplus cd ~/.vimplus ./install.sh
个性化
修改
~/.vimrc.local
文件内容,以启用个性化定制,可覆盖~/.vimrc
中的设置。插件列表
插件 说明 cpp-mode 提供生成函数实现、函数声明/实现跳转、.h .cpp切换等功能(I'm author -
-
Ubuntu下VIM配置成C++开发编辑器
2021-01-10 06:13:521、复制配置文件到本用户环境下,再新建一个.vim文件夹,并创建bundle子文件夹 sudo cp /etc/vim/vimrc /home/wangy/.vimrc sudo mkdir /home/wangy/.vim sudo mkdir /home/wangy/.vim/bundle sudo mkdir /home/... -
Ubuntu vim配置文件
2019-04-22 13:23:53vim 配置文件,用于备份,目前还不完善,后期还需要更新。 -
ubuntu中vim简易配置
2021-10-09 12:23:51set nocp "设置兼容 set expandtab "设置tab set shiftwidth=4 "设置tab的间隔 set tabstop=4 "四个空格代表一个tab set sts=4 set showmatch "在输入括号时光标会短暂地跳到与之相匹配的括号处 set autoindent ...- 打开配置文件
sudo vim /etc/vim/vimrc
- 简易够用配置
set nocompatible set nu filetype on set history=1000 set background=dark syntax on set autoindent set mouse=a set smartindent set showmatch set guioptions-=T set vb t_vb= set ruler set nohls set incsearch if has("vms") set nobackup else set backup set shiftwidth=4 "设置tab的间隔 set tabstop=4 "四个空格代表一个tab set sts=4 set nowrap "设置自动换行 set encoding=utf-8 "设置编码为utf-8 set fileencoding=utf-8 set fileencodings=ucs-bom,utf-8,GB18030,cp936,big5,euc-jp,euc-kr,latin1 endif
- 具体详细配置
set nocp "设置兼容 set expandtab "设置tab set shiftwidth=4 "设置tab的间隔 set tabstop=4 "四个空格代表一个tab set sts=4 set showmatch "在输入括号时光标会短暂地跳到与之相匹配的括号处 set autoindent "设置自动缩进 " set smartindent "设置智能缩进 set nowrap "设置自动换行 set tw=500 set lbr set number "设置是否显示行 set guifont=Monospace\ 11 "设置字体大小 set encoding=utf-8 "设置编码为utf-8 set fileencoding=utf-8 set fileencodings=ucs-bom,utf-8,GB18030,cp936,big5,euc-jp,euc-kr,latin1 set helplang=cn "帮助中文支持 colorscheme tango "设置主体颜色 "set mouse=v " 设置粘贴和复制 "自动补全配置 autocmd FileType python set omnifunc=pythoncomplete#Complete autocmd FileType javascript set omnifunc=javascriptcomplete#CompleteJS autocmd FileType html set omnifunc=htmlcomplete#CompleteTags autocmd FileType css set omnifunc=csscomplete#CompleteCSS autocmd FileType xml set omnifunc=xmlcomplete#CompleteTags autocmd FileType php set omnifunc=phpcomplete#CompletePHP autocmd FileType c set omnifunc=ccomplete#Complete " =================================进行Taglist的设置<Begin>============================ map <F3> :TlistToggle<CR> "map <F3> :silent! Tlist<CR> "按下F3就可以呼出了 "let Tlist_Ctags_Cmd='/usr/bin/ctags' "因为我们放在环境变量里,所以可以直接执行 let Tlist_Use_Right_Window=1 "让窗口显示在右边,0的话就是显示在左边 "let Tlist_Show_One_File=1 "让taglist可以同时展示多个文件的函数列表 "let Tlist_File_Fold_Auto_Close=1 "非当前文件,函数列表折叠隐藏 "let Tlist_Exit_OnlyWindow=1 "当taglist是最后一个分割窗口时,自动推出vim "let Tlist_Process_File_Always=0 "是否一直处理tags.1:处理;0:不处理 "let Tlist_Inc_Winwidth=0 "不是一直实时更新tags,因为没有必要 " =================================进行Taglist的设置<End>============================== " ############################键盘映射设置区域############################### map <F2> :NERDTreeToggle<CR> map <F4> t :NERDTreeMirror<CR> " 对应使用函数的配置 set guitablabel=%{ShortTabLabel()} function ShortTabLabel () let bufnrlist = tabpagebuflist (v:lnum) let label = bufname (bufnrlist[tabpagewinnr (v:lnum) -1]) let filename = fnamemodify (label, ':t') return filename endfunction set tabline=%!MyTabLine() function MyTabLine() let s = '' for i in range(tabpagenr('$')) " 选择高亮 if i + 1 == tabpagenr() let s .= '%#TabLineSel#' else let s .= '%#TabLine#' endif " 设置标签页号 (用于鼠标点击) let s .= '%' . (i + 1) . 'T' " MyTabLabel() 提供完整路径标签 MyShortTabLabel 提供文件名标签 let s .= ' %{MyShortTabLabel(' . (i + 1) . ')} ' endfor " 最后一个标签页之后用 TabLineFill 填充并复位标签页号 let s .= '%#TabLineFill#%T' " 右对齐用于关闭当前标签页的标签 if tabpagenr('$') > 1 let s .= '%=%#TabLine#%999Xclose' endif return s endfunction " 文件名标签 function MyShortTabLabel(n) let buflist = tabpagebuflist(a:n) let label = bufname (buflist[tabpagewinnr (a:n) -1]) let filename = fnamemodify (label, ':t') return filename endfunction "完整路径标签 function MyTabLabel(n) let buflist = tabpagebuflist(a:n) let winnr = tabpagewinnr(a:n) return bufname(buflist[winnr - 1]) endfunction " vim 标签样式 " TabLineFill tab pages line, where there are no labels hi TabLineFill term=none hi TabLineFill ctermfg=DarkGrey hi TabLineFill guifg=#777777 " TabLineSel tab pages line, active tab page label hi TabLineSel term=inverse hi TabLineSel cterm=none ctermfg=yellow ctermbg=Black hi TabLineSel gui=none guifg=yellow guibg=Black " Develop editing options au FileType vim setl expandtab au FileType vim setl shiftwidth=2 au FileType vim setl tabstop=2 " 显示状态栏(默认值为 1,无法显示状态栏) set laststatus=2 " Format the statusline set statusline=\ %F%m%r%h\ %w\ \ CWD:\ %r%{CurDir()}E5%h\ \ \ Line:\ %l/%L:%c function! CurDir() let curdir = substitute(getcwd(), '/Users/amir/', "~/", "g") return curdir endfunction "#######################设置PHP函数自动提醒#########################Start "设置字典自动完成 set complete+=k "设置字典 set dictionary=~/.vim/doc/php_funclist.txt " 自动完成使用TAB键 function! InsertTabWrapper() let col=col('.')-1 if !col || getline('.')[col-1] !~ '\k' return "\<TAB>" else return "\<C-N>" endif endfunction "将InsertTabWrapper映射到TAB上 inoremap <TAB> <C-R>=InsertTabWrapper()<CR> "#######################设置PHP函数自动提醒#########################End "#######中括号 大括号 小括号 自动补全 :inoremap ( ()<ESC>i :inoremap ) <c-r>=ClosePair(')')<CR> :inoremap { {}<ESC>i :inoremap } <c-r>=ClosePair('}')<CR> :inoremap [ []<ESC>i :inoremap ] <c-r>=ClosePair(']')<CR> :inoremap < <><ESC>i :inoremap > <c-r>=ClosePair('>')<CR> function ClosePair(char) if getline('.')[col('.') - 1] == a:char return "\<Right>" else return a:char endif endfunction
-
ubuntu vim设置显示行号
2019-05-09 11:28:00打开vim的配置文件 /etc/vim/vimrc sudo vim /etc/vim/vimrc 然后找到 #set number ,把注释取消就行了 如果没有,就自己加一行 转载于:https://www.cnblogs.com/zdj8023/p/10837480.html... -
Ubuntu vim配置支持鼠标
2021-03-02 18:12:00修改~/.vimrc文件,添加如下命令: set mouse=a -
ubuntu-vim配置
2020-12-12 17:49:58ubuntu-vim配置 备份 vim 配置 配置 .vimrc 创建 ~/.vimrc 文件, 输入: " vundle 环境设置 filetype off set rtp+=~/.vim/bundle/Vundle.vim " vundle 管理的插件列表必须位于 vundle#begin() 和 vundle#end() ... -
Ubuntu20.04 vim 配置
2022-04-04 19:16:02在用户目录下新建文件“.ycm_extra_conf.py”,复制以下代码到文件(该配置只针对C、C++!) import os import ycm_core flags = [ '-Wall', '-Wextra', '-Werror', '-Wno-long-long', '-Wno-v -
ubuntu vim配置文件
2014-04-08 14:04:16自己用的vim配置环境,感觉不错,希望能对大家有所帮助。 -
ubuntu中vim的配置文件
2020-08-20 10:07:31ubuntu中vim的通用配置,直接把之前旧的配置文件覆盖即可使用配置好的vi,此文件是本人自己的配置文件,不一定符合所有人的胃口,但是肯定会比没有配置的好用 -
ubuntu下vim配置文件
2020-03-26 09:31:57本文档主要对ubuntu下的vim进行了一些配置,在创建文件可以自动将个人信息和头文件加上。需要的朋友可以下载试试 -
ubuntu vim利用pydiction配置tensorflow自动补全
2021-12-27 15:09:20ubuntu vim 利用Pydiction实现tensorflow自动补全 一.下载Pydiction 直接去官网,把源码clone下来 $ cd ~/.vim/plugged #我这里的是安装在plugged下了,没有按照官网的来,放在~/.vim/bundle下,因为我的.vim下没有... -
ubuntu vim 配置文件 .vim .vimrc
2014-01-16 16:22:09自己配置的VIM IDE环境,包括ctags、cscope等插件,语法高亮等,用了一年时间,读写代码感觉比较方便 -
Ubuntu中设置vim的行号
2021-09-02 09:31:51Ubuntu中设置vim的行号 1.打开终端,在命令行中输入cd /etc/vim 后敲回车,进入/etc/vim目录; 2.进入etc/vim目录后,找到vimrc文件(vim的初始化文件),使用cp命令对其进行备份,命令为:cp vimrc vimrc.bak(备份... -
Ubuntu vim界面的复制粘贴操作
2021-06-07 20:28:27Ubuntu vim界面的复制粘贴操作 首先使用鼠标复制要粘贴的内容,按键盘上的ctrl+insert键, 然后vim(vi)打开一个文件,按键盘上的shift+insert键进行粘贴。 参考: ... ... -
Ubuntu vim安装、配置及其注意事项。附带Vim的使用
2020-08-06 16:05:54二、vim配置 设置vim 输入如下命令行 : sudo vim /etc/vim/vimrc 1、设置语法高亮 寻找到 if has("syntax") syntax on end if 设置语法高亮,若配置文件将此处被注释,将注释删除。 2、更多个性化配置(在... -
Ubuntu vim配置.vimrc文件及用vundle安装插件
2015-10-22 12:20:24背景:新的Ubuntu环境,已经有一个配置好的.vimrc文件,里面包含YouCompleteMe等插件,这些插件都是通过Vundle工具安装的(Vundle是一个vim的插件管理器) 第一步: 先安装vundle: 在网上查了一些博客,因为项目... -
Ubuntu配置Vim及不同语法显示不同颜色操作步骤
2020-09-15 06:41:52本文分步骤给大家介绍了Ubuntu配置Vim及不同语法显示不同颜色效果,非常不错,具有参考借鉴价值,需要的朋友参考下吧 -
Ubuntu 下 vim 搭建python 环境 配置
2020-12-30 07:40:121. 安装完整的vim# apt-get install vim-gnome2. 安装ctags,ctags用于支持taglist,必需!# apt-get install ctags3. 安装taglist#apt-get install vim-scripts#apt-get install vim-addon-manager# vim-addons ... -
ubuntu 15.5 设置vim 采用c语言自动缩进
2022-03-14 16:41:11set tabstop=4 //设置一个tab显示多少空格 set softtabstop=4 //设置回格键退回缩进长度 set shiftwidth=4 //一级缩进的长度 set expandtab //缩进用空格来表示或者用tab符表示 set nu //显示行数 set cindent //... -
(转)Ubuntu 下Vim设置颜色主题(colorscheme)
2019-04-22 14:53:32查看Vim实例中当前的颜色主题 打开一个Vim窗口,输入命令:color或:colorscheme后回车查看当前的颜色主题。 得到Vim示例当前的颜色主题 ...输入命令"colorscheme 主题名字",即可设置当前vim实例的颜... -
Ubuntu下vim文本编辑器简单配置
2021-01-07 05:59:11对当前系统中所有用户生效的VIM基本配置 打开/etc/vim/vimrc: sudo vim /etc/vim/vimrc 在文件末尾添加: 高亮显示当前 set cursorline 启用行号 set nu 启用鼠标 set mouse=a 自动缩进 set autoindent set ... -
Ubuntu下vim设置tab键为4个空格
2021-09-11 10:45:121、Ubuntu下vim tab键默认为8个字节缩进,但是我们实际编程的时候感觉缩进量太大,很不美观 2、我们怎么设置tab键缩进大小呢? (1)若/etc/vim/vimrc目录下为可读可写,直接进入该目录最下面添加如下代码 set ... -
Ubuntu vim配置文件及系统安装
2015-11-29 16:28:45特别值得一提的是Ubuntu vim系统有很多值得学习的地方,这里我们主要介绍Ubuntu vim安装,包括介绍Ubuntu vim配置文件等方面。Ubuntu vim 设置语法高亮显示和自动缩进。Ubuntu 包含了非常好的翻译和容易使用的架构,...
收藏数
120,473
精华内容
48,189