【笔记】改变vim或者终端terminal的光标形状。光标变细了之后看起来爽快多了!

  刚从windows转到linux的用户可能都有一个不爽的地方,就是终端和vim中光标都是一个字符的宽度,很粗,在输入的时候很容易找不到当前输入的字符会出现在哪两个字符中间。

  于是乎,为了眼睛痛快、头脑清爽,我查了一下如何改变终端中光标的形状。在这里总结一下。

  因为我的初衷是使vim的光标改变,所以使用的办法是在.vimrc中写些代码

方法(一)

  在当前用户的./vimrc文件中添加如下代码。效果是终端中所有的光标都变细,也就是说vim普通模式和插入模式都是细光标  

  "使得terminal的光标变为细线,而不是默认的粗条。这个在vim的普通模式和插入模式都会生效。
  set gcr=n-v-c:ver25-Cursor/lCursor,ve:ver35-Cursor,o:hor50-Cursor,i-ci:ver25-Cursor/lCursor

方法(二)

  在当前用户的./vimrc文件中添加如下代码。效果是,在vim的插入模式时光标变细。

  

  if has("autocmd")  
       au InsertEnter * silent execute "!gconftool-2 --type string --set /apps/gnome-terminal/profiles/Default/cursor_shape ibeam"  
       au InsertLeave * silent execute "!gconftool-2 --type string --set /apps/gnome-terminal/profiles/Default/cursor_shape block"  
       au VimLeave * silent execute "!gconftool-2 --type string --set /apps/gnome-terminal/profiles/Default/cursor_shape ibeam"  
  endif  

参考资料:

http://blog.sina.com.cn/s/blog_ac9fdc0b0101ol0b.html

http://blog.csdn.net/xiaohui5319/article/details/7507042

十分感谢原作者!

A mind needs books like a sword needs a whetstone.
原文地址:https://www.cnblogs.com/yzsatcnblogs/p/4277891.html