vim 使用小技巧


配好系统,开始配置vim编辑器,众多编辑器中还是最喜欢vim。记录一下一些设置过程中碰到的小问题。

vim 关闭后内容在终端停留

打开vim准备编辑,发现vim退出之后内容仍然停留在终端屏幕上,这样不利于终端操作,想把它改过来。vim关闭后内容依旧在终端显示查了资料后发现只需要打开.bashrc文件,在文件末尾加一句:

export TERM=xterm

重新source一下就可以了。

看了这个解决方案后,发现其实是使用的shell模式不同造成的,所以另一个解决方案是从Xshell的设置里修改就可以。把终端里面的仿真终端类型设置成xterm也可以解决这个问题。
在这里插入图片描述

vim 小键盘无效

打开vim之后,小键盘输入数字都变成了乱码,这个主要是因为Xshell终端登录的设置问题造成的,在Xshell属性的终端选项中,将VT模式中的初始数字键盘模式改为“设置为普通”即可。
在这里插入图片描述

Vundle插件管理安装配置

Vundle安装

接下来是安装Vundle进行vim插件管理,在终端输入以下命令:

[cz@cz] git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim

即可将Vundle安装在~/.vim/bundle/vundle下。github国内链接可能不太稳定,有时候需要多试几次。

Vundle配置

Vundle的配置在.vimrc文件中进行,如果home下没有这个文件,可以先创建一个。下面是我的一个配置版本,这些插件可能用PluginInstall命令不太好装,可以先下载下来,拷贝进~/.vim/bundle目录下。

set nocompatible              " be iMproved, required
filetype off                  " required
 
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
 
" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'
Plugin 'indentLine'
Plugin 'molokai'
Plugin 'vim-easymotion'
Plugin 'YankRing.vim'
Plugin 'vim-tags'
Plugin 'taglist.vim'
Plugin 'pydiction'
Plugin 'nerdtree'
 
call vundle#end()
 
filetype plugin indent on
 
"color 
colorscheme molokai
set t_Co=256
set background=dark
let g:molokai_original = 1
 
"indentLine
let g:indentLine_concealcursor = 'inc'
let g:indentLine_conceallevel = 2
"let g:indentLine_setConceal = 0
 
"configure tab space
set ts=5
set expandtab
set softtabstop=5
set shiftwidth=5
%retab!
 
"set the line number and cursor
"set number
set cursorcolumn
"set cursorline
 
"vim-tags
let g:vim_tags_auto_generate = 1
let g:vundle_default_git_proto = 'git'
 
"Taglist  :Tlist can open taglist window
let Tlist_Show_One_File = 1
let Tlist_Exit_OnlyWindow = 1
let Tlist_Use_Right_Window = 1
"let Tlist_Auto_Open=1
let Tlist_File_Fold_Auto_Close=1
let Tlist_Use_Horiz_Window=1
 
"set the mouse select without line number and copy by yunk
"set mouse=a
"set clipboard+=unnamed
 
"set the ctags
set tags=tags
set autochdir
 
"set python auto complete
let g:pydiction_location = '~/.vim/bundle/pydiction/complete-dict'

"set code fold the subfunction
"set foldmethod=indent
 
"NerdTree
map <C-b> :NERDTreeToggle<CR>
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif 

"YankRing
let g:yankring_history_dir = '~/.vim/'
let g:yankring_history_file = '.yankring_history'
  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值