dream/ 四月 8, 2018/ linux/ 0评论

远程的时候果然还是vim最好用,直接用SSH连接就能用,VNC或者RDP果然刷新率还是太低了,当然在电脑上还是直接用IDE好了

1. 先附上效果图

android下的远程效果图

2. 配置过程

#如果没有vim当然要先安装,部分插件依赖于python
sudo apt-get install vim -y
 
#ctags,其他插件依赖该插件
sudo apt-get install ctags -y
 
#vim插件管理apt-vim https://github.com/egalpin/apt-vim.git
curl -sL https://raw.githubusercontent.com/egalpin/apt-vim/master/install.sh | sh
#github提供的自动安装脚本
#自动安装的项目,提示是否安装
#pathogen
#tagbar
 
#安装nerdtree#文件列表
apt-vim install -y https://github.com/scrooloose/nerdtree.git
sudo apt-get install build-essential  cmake -y
sudo apt-get install python3 python3-dev -y
#安装YouCompleteMe#自动补全工具
cd ~/.vim/bundle
git clone https://github.com/Valloric/YouCompleteMe.git
#自动安装
cd YouCompleteMe
#更新子模块
git submodule update --init --recursive
#安装
./install.py --clang-completer

3. 根据需要配置插件

gedit  ~/.vimrc

syntax on"语法高亮
set mouse=a  " always use mouse  
 
set number"显示行号
"自动缩进与C语言风格缩进
set autoindent
set cindent
 
"缩进宽度
set tabstop=4
set softtabstop=4
set shiftwidth=4
"switch case 对齐风格
set cino=g0,:0
 
"Tagbar
let g:tagbar_width=35	"宽度
let g:tagbar_ctags_bin='/usr/bin/ctags'  "设置tagbar使用的ctags的插件
let g:tagbar_right=1	"位置在右侧
let g:tagbar_autofocus=0	"是否自动聚焦 
autocmd BufReadPost *.cpp,*.c,*.h,*.hpp,*.cc,*.cxx call tagbar#autoopen() "打开文件自动打开tagbar   
nmap <F6> :TagbarToggle<CR>	"快捷键
" NERD tree
let NERDChristmasTree=0
let NERDTreeWinSize=35
let NERDTreeChDirMode=2
let NERDTreeIgnore=['\~$']
let NERDTreeShowBookmarks=1
let NERDTreeWinPos="left"
" Automatically open a NERDTree if no files where specified
autocmd vimenter * if !argc() | NERDTree | endif
" Close vim if the only window left open is a NERDTree
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
" Open a NERDTree
nmap <F5> :NERDTreeToggle<cr>
"YouCompleteMe
"自动开启语义补全
let g:ycm_seed_identifiers_with_syntax = 1
"在注释中也开启补全
let g:ycm_complete_in_comments = 1
let g:ycm_collect_identifiers_from_comments_and_strings = 0
"字符串中也开启补全
let g:ycm_complete_in_strings = 1
let g:ycm_collect_identifiers_from_tags_files = 1
"开启基于tag的补全,可以在这之后添加需要的标签路径  
let g:ycm_collect_identifiers_from_tags_files = 1
"开始补全的字符数
let g:ycm_min_num_of_chars_for_completion = 2
"补全后自动关闭预览窗口
let g:ycm_autoclose_preview_window_after_completion = 1
"禁止缓存匹配项,每次都重新生成匹配项
let g:ycm_cache_omnifunc=0
"离开插入模式后自动关闭预览窗口
autocmd InsertLeave * if pumvisible() == 0|pclose|endif
"语法关键字补全
let g:ycm_seed_identifiers_with_syntax = 1  
"在实现和声明之间跳转,并分屏打开
let g:ycm_goto_buffer_command = 'horizontal-split'
nnoremap <Leader>g :YcmCompleter GoTo<CR>
 
execute pathogen#infect()
call pathogen#helptags()

 

参考链接:https://blog.csdn.net/demorngel/article/details/69054982

 

点击数:85

Share this Post

说点什么

avatar
300
  订阅  
提醒