关山难越,谁悲失路之人;萍水相逢,尽是他乡之客。
百度360必应搜狗淘宝本站头条
当前位置:网站首页 > 编程教程 > 技术文章 > 正文

来,一起搭建自己的vim开发环境

guanshanw 2023-08-20 13:50 59 浏览 0 评论

由于我是一个VIM的“死忠粉”,下面详细介绍一下VIM开发环境的搭建。

怎么安装vim呢?

安装命令如下:

sudo apt-get install vim

怎么安装bundle来管理VIM插件?

首先,在 .vim 目录中建立 bundle 目录,以后Vundle自动下载的插件都保存在这里。然后,进入 Bundle 目录,使用 git clone 命令下载 vundle,具体命令如下:

cd ~/.vim 
mkdir bundle 
git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim

配置VIM,使其支持bundle,在.vimrc添加如下内容:

" be iMproved, required
set nocompatible 
" required 
filetype off
" set the runtime path to include Vundle and initialize 
set rtp+=~/.vim/bundle/Vundle.vim 
call vundle#begin() 
" alternatively, pass a path where Vundle should install plugins 
"call vundle#begin('~/some/path/here') 
" let Vundle manage Vundle, required 
Plugin 'VundleVim/Vundle.vim' 
" The following are examples of different formats supported. 
" Keep Plugin commands between vundle#begin/end. 
" plugin on GitHub repo 
Plugin 'tpope/vim-fugitive' 
" plugin from http://vim-scripts.org/vim/scripts.html 
"Plugin 'L9' 
" Git plugin not hosted on GitHub 
"Plugin 'git://git.wincent.com/command-t.git' 
" git repos on your local machine (i.e. when working on your own plugin) 
"Plugin 'file:///home/gmarik/path/to/plugin' 
" The sparkup vim script is in a subdirectory of this repo called vim. 
" Pass the path to set the runtimepath properly. 
Plugin 'rstacruz/sparkup', {'rtp': 'vim/'} 
" Install L9 and avoid a Naming conflict if you've already installed a 
" different version somewhere else. 
Plugin 'ascenator/L9', {'name': 'newL9'} 
Bundle 'scrooloose/nerdtree' 
Bundle 'Valloric/YouCompleteMe' 
Bundle "taglist.vim" 
Bundle "ctags.vim" 
Bundle "a.vim" 
Plugin 'bling/vim-airline' 
Plugin 'tpope/vim-commentary' 
Plugin 'altercation/vim-colors-solarized' 
Plugin 'godlygeek/tabular' 
" All of your Plugins must be added before the following line 
call vundle#end() " required 
filetype plugin indent on " required 
" To ignore plugin indent changes, instead use: 
"filetype plugin on 
" 
" Brief help 
" :PluginList - lists configured plugins 
" :PluginInstall - installs plugins; append `!` to update or just :PluginUpdate 
" :PluginSearch foo - searches for foo; append `!` to refresh local cache 
" :PluginClean - confirms removal of unused plugins; append `!` to auto-approve removal 
" 
" see :h vundle for more details or wiki for FAQ 
" Put your non-Plugin stuff after this line

打开一个vim, 运行:

:BundleInstal

常用命令使用说明:

其它设置,在.vimrc中添加:

"配置NERD Tree 
:map <f10> :NERDTreeToggle <cr>
filetype on 
syntax on 
set autoindent 
set smartindent 
set tabstop=4 
set shiftwidth=4 
set showmatch 
set ruler 
set number

怎么安装VIM的ctags插件呢?

首先,需要要让Ubuntu系统支持ctags,安装命令如下:

sudo apt-get install exuberant-ctags

接着,在.vimrc中添加如下内容:

Bundle "taglist.vim"

报错YouCompleteMe unavailable: requires Vim 7.4.143+

具体解决办法如下:

sudo add-apt-repository ppa:jonathonf/vim 

sudo apt-get update && sudo apt-get -u dist-upgrade 

sudo apt-get install vim-nox

更多使用技巧,参考:http://vim.wikia.com/wiki/Vim_Tips_Wiki。

今天的内容,不知道小伙伴理解了没,如果没有理解的话可以加入我们的群634247407提问,下期会有更加精彩的内容分享。

如果觉得内容不错,记得关注和分享哦!!!

相关推荐

七条简单命令让您玩转Git
七条简单命令让您玩转Git

凭借着出色的协作能力、快速部署效果与代码构建辅助作用,Git已经得到越来越多企业用户的青睐。除了用于开发商业及消费级应用之外,众多科学及政府机构也开始尝试使用这...

2023-10-07 12:14 guanshanw

基本完整的关于Git分支branch的操作
基本完整的关于Git分支branch的操作

Git使用背景项目中要用到dev或者其他分支开发完代码,需要将该分支合并到master的需求操作步骤下面以dev名称为lex为分支名为例来操作一遍客户端操作:...

2023-10-07 12:14 guanshanw

Git 进阶(合并与变基)
Git 进阶(合并与变基)

在Git中整合来自不同分支的修改主要有两种方法:合并(merge)以及变基(rebase)合并(merge)merge流程图merge的原理是找到这两个分...

2023-10-07 12:13 guanshanw

Git学习笔记 003 Git进阶功能 part5 合并(第一部分)

合并(merge)是很常用的操作。尤其是一个庞大的很多人参与开发的企业级应用。一般会设定一个主分支,和多个副分支。在副分支开发完成后,合并到主分支中。始终保持主分支是一个完整的,稳定的最新状态的分支。...

非标题党,三张图帮你理解git merge和git rebase的区别
非标题党,三张图帮你理解git merge和git rebase的区别

初始场景:基于正常的开发分支修改几个小bug,然后在合并到开发分支上。gitmergegitcheckoutfeaturegitmergeho...

2023-10-07 12:13 guanshanw

git 初次使用(01)
git 初次使用(01)

先从github上克隆代码下来:使用vscode克隆代码如下图,填写上github仓库地址:vscode有时候克隆代码速度比较慢,可以用命令行方式克隆gitc...

2023-10-07 12:12 guanshanw

Git 远程操作

4.Git远程操作命令说明gitremote远程版本库操作gitfetch从远程获取版本库gitpull下载远程代码并合并gitpush上传远程代码并合并4.1远程版本库操作gitre...

Git常用命令-总结
Git常用命令-总结

创建git用户$gitconfig--globaluser.name"YourName"$gitconfig--globaluser.em...

2023-10-07 12:12 guanshanw

git中删除从别人clone下来项目的git信息,并修改为自己的分支

如果你从别人的Git存储库中克隆了一个项目,并想要删除与该存储库相关的Git信息,并将其修改为你自己的分支,则可以执行以下步骤:使用gitclone命令克隆存储库:gitclone<u...

git系列-回滚和放弃本地修改

回滚历史提交就是reset的功能。这种情况是已经提交远程仓库,需要回滚到之前的提交。gitreset--hardcommitId//注:强制提交后,当前版本后面的提交版本将会删掉!gi...

GIT使用小技巧大全
GIT使用小技巧大全

在大型软件工程的开发过程中,版本控制是无法绕过去的;目前来说,最火的版本控制软件就是GIT了。早两年SVN比较火,不过被大神linus喷了几次后,就日落西山了,...

2023-10-07 12:11 guanshanw

git相关命令-上
git相关命令-上

这些命令都是看了文档后,个人觉得比较有用的一些,展示给大家。回到远程仓库的状态抛弃本地所有的修改,回到远程仓库的状态。gitfetch--all&...

2023-10-07 12:10 guanshanw

Git命令行接口:掌握Git的必备技能
Git命令行接口:掌握Git的必备技能

Git是一款强大的分布式版本控制工具,它支持命令行界面操作。熟练掌握Git命令行接口,是开发者使用Git的必备技能之一。在这篇文章中,我们将介绍Git命令行接口...

2023-10-07 12:10 guanshanw

Git命令详解
Git命令详解

相信各位小伙伴们应该都对git有一些了解,毕竟作为代码管理的神器,就算不是IT行业的小伙伴肯定也或多或少的听说过一些。今天就来和小伙伴们分享一下自己总结的常用命...

2023-10-07 12:10 guanshanw

工作7年收集到的git命令
工作7年收集到的git命令

概念git中的术语解释:仓库也叫版本库(repository)stage:暂存区,add后会存到暂存区,commit后提交到版本库git安装linux...

2023-10-07 12:10 guanshanw

取消回复欢迎 发表评论: