Ubuntu下为vim安装YouCompleteMe插件
前提条件 已安装 Vundle (参考 Vim安装插件管理器Vundle) Vim 版本 ≥ Vim 7.4.1578+ (查看 vim --version) 安装 第一步,使用Vundle安装YouCompleteM 在.vimrc中添加以下内容 Plugin 'Valloric/YouCompleteMe' 然后拉取源码(或是 :PluginInstall 也可) ...
前提条件 已安装 Vundle (参考 Vim安装插件管理器Vundle) Vim 版本 ≥ Vim 7.4.1578+ (查看 vim --version) 安装 第一步,使用Vundle安装YouCompleteM 在.vimrc中添加以下内容 Plugin 'Valloric/YouCompleteMe' 然后拉取源码(或是 :PluginInstall 也可) ...
修改 /etc/vimrc 或 ~/.vimrc,在文件最后添加以下内容: " 当新建 .h .c .hpp .cpp .mk .sh等文件时自动调用SetTitle 函数 autocmd BufNewFile *.[ch],*.hpp,*.cpp,Makefile,*.mk,*.sh exec ":call SetTitle()" " 加入注释 func SetComment() call setline(1,"/*================================================================") call append(line("."), "* Copyright (C) ".strftime("%Y")." IEucd Inc. All rights reserved.") call append(line(".")+1, "* ") call append(line(".")+2, "* 文件名称:".expand("%:t")) call append(line(".")+3, "* 创 建 者:SongTL, songtianlun@comleader.com.cn") call append(line(".")+4, "* 创建日期:".strftime("%Y年%m月%d日")) call append(line(".")+5, "* 描 述:") call append(line(".")+6, "*") call append(line(".")+7, "================================================================*/") call append(line(".")+8, "") call append(line(".")+9, "") endfunc " 加入shell,Makefile注释 func SetComment_sh() call setline(3, "#================================================================") call setline(4, "# Copyright (C) ".strftime("%Y")." IEucd Inc. All rights reserved.") call setline(5, "# ") call setline(6, "# 文件名称:".expand("%:t")) call setline(7, "# 创 建 者:SongTL, songtianlun@comleader.com.cn") call setline(8, "# 创建日期:".strftime("%Y年%m月%d日")) call setline(9, "# 描 述:") call setline(10, "#") call setline(11, "#================================================================") call setline(12, "") call setline(13, "") endfunc " 定义函数SetTitle,自动插入文件头 func SetTitle() if &filetype == 'make' call setline(1,"") call setline(2,"") call SetComment_sh() elseif &filetype == 'sh' call setline(1,"#!/system/bin/sh") call setline(2,"") call SetComment_sh() else call SetComment() if expand("%:e") == 'hpp' call append(line(".")+10, "#ifndef _".toupper(expand("%:t:r"))."_H") call append(line(".")+11, "#define _".toupper(expand("%:t:r"))."_H") call append(line(".")+12, "#ifdef __cplusplus") call append(line(".")+13, "extern \"C\"") call append(line(".")+14, "{") call append(line(".")+15, "#endif") call append(line(".")+16, "") call append(line(".")+17, "#ifdef __cplusplus") call append(line(".")+18, "}") call append(line(".")+19, "#endif") call append(line(".")+20, "#endif //".toupper(expand("%:t:r"))."_H") elseif expand("%:e") == 'h' call append(line(".")+10, "#pragma once") elseif &filetype == 'c' call append(line(".")+10,"#include \"".expand("%:t:r").".h\"") elseif &filetype == 'cpp' call append(line(".")+10, "#include \"".expand("%:t:r").".h\"") endif endif endfun 使用效果: ...
配置 只需在Home目录创建一个 ~/.vimrc ****文件即可以配置 vim 了,如需安装插件,在 ~/.vim 目录下创建一个bundle文件夹,插件装在里面。(需安装 Vundle 插件管理器),将以下内容拷入~/.vimrc ****文件中即可。 ...
安装步骤 第一步,下载源码 到Vim官方Github仓库下载目前最新的Vim Release版本 wget https://codeload.github.com/vim/vim/tar.gz/v8.2.1258 第二步,解压 $ mv v8.2.1258 vim-v8.2.1258.tar.gz $ tar -xvzf vim-v8.2.1258.tar.gz 第三步,编译安装 $ cd vim-8.2.1258/ $ ./configure --prefix=$HOME/.local --enable-python3interp=yes && make && make install 这里注意一下我们需要用configure配置一下安装的路径,将Vim8安装到自己账户的目录下,避免干扰到系统上的其他用户 --enable-python3interp=yes 添加 python3 支持 在这里可能会遇到 no terminal library found 错误: ...