Skip to content

fayou521/kehr-vim

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

kehr-vim

##我的vim配置文件。##
2014-1-10更新后效果:
###1. 介绍说明:###

本项目是我目前使用vim的一些配置。初学时借鉴了网上的配置代码,后来对整体的配置做了整理,并添加了更多的功能。 插件的配置单独放在一个配置文件里,一个插件一个配置文件,在.vimrc中通过source连接进来,像这样:source ~/.vim/vimfiles/nerdtree.conf
管理模式:
vim的配置放在/home/kehr/Github/kehr-vim目录下,在家目录~/中只存放了kehr-vim目录下的.vim.vimrc 的同名软链接:.vim.vimrc。这样在家目录中就可以直接使用和修改vim的配置,然后直接使用git上传,方便多了。 ####1.1 功能特性

  1. 移动当前行或多行
    Normal模式下Ctrl+j移动当前行到下1行,Ctrl+k 移动当前行到上1行
    Visual模式下Ctrl+j移动当前所选行到下1行,Ctrl+k 移动当前所选行到上1行 (有点问题,慎用 ×_× )

  2. 复制当前行
    normal or insert 模式下,按下Ctrl+up键(up键就是),会复制当前行到下一行,光标随之下向下移动一行

  3. 复制选中的多行
    virtual模式下,选中多行后,按下Ctrl+Up,会将选中的多行复制到当前选中区域的上面。

  4. 删除当前行
    normal or insert 模式下,按下Ctrl+d键 ,删除光标所在行 。

  5. 删除选中的行
    virtual 模式下,选中多行,按下Ctrl+d键 或者 字母 d,删除所选多行 。

  6. 空格
    normal 模式下,按下空格键在光标之前插入空格

  7. 删除
    normal 模式下,按下 删除键——BackSpace 删除光标之前的字符

  8. vim剪贴板共享
    normal or virtual模式下,按下 ctrl+a,全文选中
    virtual模式下,按下 Ctrl+c,复制所选中内容
    normal模式下,按下Ctrl+p,粘贴系统剪切板内容到光标所在行的下一行

  9. 在vim中打开终端
    normal模式下,<F4>打开或关闭终端

  10. 编译运行当前文件
    normal模式下,<F5>编译并运行当前编辑的文件

  11. 开启目录树
    normal模式下,<F2>打开或关闭目录树
    insert 模式下,Ctrl+<F2>打开或关闭目录树

  12. 开启Taglist
    normal模式下,<F12>打开或关闭Taglist

  13. 自动生成文件模板和版权声明 在终端中使用vim创建文件,vim test.c,会在新文件中自动添加标头
    例如,c文件的标头:

    目前支持自动生成标头的文件类型有:ccppjavapythonshell

  14. 快捷保存文件
    normalinsert模式下,Ctrl+w 保存文件

  15. 自动补全括号、单引号、双引号

...

####1.2 已安装的插件有:

  1. vundle
用于管理所有安装的插件      插件地址:https://github.com/gmarik/Vundle.vim
  1. taglist
用于显示tag的插件。        插件地址:http://www.vim.org/scripts/script.php?script_id=273
  1. NERDtree
用于显示目录的插件。       插件地址:http://www.vim.org/scripts/script.php?script_id=1658
  1. neocomplcache
用于代码补全的插件。       插件地址:http://www.vim.org/scripts/script.php?script_id=2620
  1. Conque-Shell
用于在vim中显示控制台的插件。插件地址:http://www.vim.org/scripts/script.php?script_id=2771
  1. txt
用于自动探测文本类型的插件。 插件地址:http://www.vim.org/scripts/script.php?script_id=1532
  1. powerline
显示一个漂亮的状态栏。     插件地址:https://github.com/Lokaltog/vim-powerline

这个插件的配置我已经写好存放于~/.vim/vimfiles/powerline.conf,需要安装一个字体才能正常显示漂亮的效果。
字体使用的是ubuntu-mono-powerline-ttf,地址:https://github.com/pdf/ubuntu-mono-powerline-ttf,按照文档说明安装即可。
效果如下:

8. indentline

用于显示缩进线的插件    插件地址:https://github.com/Yggdroot/indentLine

效果(官方图片):

9.rainbow_parentheses

用于括号颜色增强        插件地址:https://github.com/kien/rainbow_parentheses.vim   

效果:

10. 这些插件的配置都放在.vim/vimfiles/目录下

####1.3 .vim的目录结构如下:####

`2014-1-10 update`:    
.vim
├── autoload
├── bundle
│   ├── Conque-Shell
│   │   ├── autoload
│   │   │   ├── conque_term
│   │   │   │   ├── conque_globals.py
│   │   │   │   ├── conque.py
│   │   │   │   ├── conque_screen.py
│   │   │   │   ├── conque_sole_communicator.py
│   │   │   │   ├── conque_sole.py
│   │   │   │   ├── conque_sole_shared_memory.py
│   │   │   │   ├── conque_sole_subprocess.py
│   │   │   │   ├── conque_sole_wrapper.py
│   │   │   │   ├── conque_subprocess.py
│   │   │   │   └── conque_win32_util.py
│   │   │   └── conque_term.vim
│   │   ├── doc
│   │   │   ├── conque_term.txt
│   │   │   └── tags
│   │   ├── plugin
│   │   │   └── conque_term.vim
│   │   ├── README
│   │   └── syntax
│   │       └── conque_term.vim
│   ├── indentLine
│   │   ├── after
│   │   │   └── plugin
│   │   │       └── indentLine.vim
│   │   ├── doc
│   │   │   ├── indentLine.txt
│   │   │   └── tags
│   │   └── README.md
│   ├── neocomplcache
│   │   ├── autoload
│   │   │   ├── neocomplcache
│   │   │   │   ├── async_cache.vim
│   │   │   │   ├── cache.vim
│   │   │   │   ├── commands.vim
│   │   │   │   ├── complete.vim
│   │   │   │   ├── context_filetype.vim
│   │   │   │   ├── filters
│   │   │   │   │   ├── converter_abbr.vim
│   │   │   │   │   ├── converter_case.vim
│   │   │   │   │   ├── converter_delimiter.vim
│   │   │   │   │   ├── converter_nothing.vim
│   │   │   │   │   ├── converter_remove_next_keyword.vim
│   │   │   │   │   ├── matcher_fuzzy.vim
│   │   │   │   │   ├── matcher_head.vim
│   │   │   │   │   ├── matcher_old.vim
│   │   │   │   │   ├── sorter_length.vim
│   │   │   │   │   ├── sorter_nothing.vim
│   │   │   │   │   └── sorter_rank.vim
│   │   │   │   ├── filters.vim
│   │   │   │   ├── handler.vim
│   │   │   │   ├── helper.vim
│   │   │   │   ├── init.vim
│   │   │   │   ├── mappings.vim
│   │   │   │   ├── sources
│   │   │   │   │   ├── buffer_complete.vim
│   │   │   │   │   ├── dictionary_complete.vim
│   │   │   │   │   ├── filename_complete.vim
│   │   │   │   │   ├── filename_include.vim
│   │   │   │   │   ├── include_complete.vim
│   │   │   │   │   ├── member_complete.vim
│   │   │   │   │   ├── omni_complete.vim
│   │   │   │   │   ├── syntax_complete.vim
│   │   │   │   │   ├── tags_complete.vim
│   │   │   │   │   ├── vim_complete
│   │   │   │   │   │   ├── autocmds.dict
│   │   │   │   │   │   ├── command_args.dict
│   │   │   │   │   │   ├── command_completions.dict
│   │   │   │   │   │   ├── command_prototypes.dict
│   │   │   │   │   │   ├── command_replaces.dict
│   │   │   │   │   │   ├── commands.dict
│   │   │   │   │   │   ├── features.dict
│   │   │   │   │   │   ├── functions.dict
│   │   │   │   │   │   ├── helper.vim
│   │   │   │   │   │   ├── mappings.dict
│   │   │   │   │   │   ├── options.dict
│   │   │   │   │   │   └── variables.dict
│   │   │   │   │   └── vim_complete.vim
│   │   │   │   ├── util.vim
│   │   │   │   └── variables.vim
│   │   │   ├── neocomplcache.vim
│   │   │   ├── unite
│   │   │   │   └── sources
│   │   │   │       ├── file_include.vim
│   │   │   │       └── neocomplcache.vim
│   │   │   ├── vital
│   │   │   │   ├── _08a462e
│   │   │   │   │   ├── data
│   │   │   │   │   │   └── list.vim
│   │   │   │   │   ├── prelude.vim
│   │   │   │   │   └── system
│   │   │   │   │       └── cache.vim
│   │   │   │   ├── _08a462e.vim
│   │   │   │   └── neocomplcache.vital
│   │   │   └── vital.vim
│   │   ├── doc
│   │   │   ├── neocomplcache.txt
│   │   │   └── tags
│   │   ├── plugin
│   │   │   ├── neocomplcache
│   │   │   │   ├── buffer_complete.vim
│   │   │   │   ├── dictionary_complete.vim
│   │   │   │   ├── include_complete.vim
│   │   │   │   ├── syntax_complete.vim
│   │   │   │   └── tags_complete.vim
│   │   │   └── neocomplcache.vim
│   │   ├── README
│   │   ├── README.md
│   │   └── vest
│   │       └── test-neocomplcache.vim
│   ├── nerdtree
│   │   ├── autoload
│   │   │   └── nerdtree.vim
│   │   ├── doc
│   │   │   ├── NERD_tree.txt
│   │   │   └── tags
│   │   ├── lib
│   │   │   └── nerdtree
│   │   │       ├── bookmark.vim
│   │   │       ├── creator.vim
│   │   │       ├── key_map.vim
│   │   │       ├── menu_controller.vim
│   │   │       ├── menu_item.vim
│   │   │       ├── opener.vim
│   │   │       ├── path.vim
│   │   │       ├── tree_dir_node.vim
│   │   │       └── tree_file_node.vim
│   │   ├── nerdtree_plugin
│   │   │   ├── exec_menuitem.vim
│   │   │   └── fs_menu.vim
│   │   ├── plugin
│   │   │   └── NERD_tree.vim
│   │   ├── README.markdown
│   │   └── syntax
│   │       └── nerdtree.vim
│   ├── rainbow_parentheses.vim
│   │   ├── autoload
│   │   │   └── rainbow_parentheses.vim
│   │   ├── plugin
│   │   │   └── rainbow_parentheses.vim
│   │   └── readme.md
│   ├── taglist.vim
│   │   ├── doc
│   │   │   ├── taglist.txt
│   │   │   └── tags
│   │   ├── plugin
│   │   │   └── taglist.vim
│   │   └── README
│   ├── txt.vim
│   │   ├── COPYING
│   │   ├── doc
│   │   │   ├── tags
│   │   │   └── txt.txt
│   │   ├── README
│   │   ├── README.orig
│   │   └── syntax
│   │       └── txt.vim
│   ├── vim-powerline
│   │   ├── autoload
│   │   │   ├── Pl
│   │   │   │   ├── Colorscheme.vim
│   │   │   │   ├── Hi.vim
│   │   │   │   ├── Match.vim
│   │   │   │   ├── Mod.vim
│   │   │   │   ├── Parser.vim
│   │   │   │   ├── Segment.vim
│   │   │   │   └── Theme.vim
│   │   │   ├── Pl.vim
│   │   │   └── Powerline
│   │   │       ├── Colorschemes
│   │   │       │   ├── default.vim
│   │   │       │   ├── solarized16.vim
│   │   │       │   ├── solarized256.vim
│   │   │       │   └── solarized.vim
│   │   │       ├── Functions
│   │   │       │   ├── ft_man.vim
│   │   │       │   ├── fugitive.vim
│   │   │       │   ├── hgrev.vim
│   │   │       │   └── syntastic.vim
│   │   │       ├── Functions.vim
│   │   │       ├── Matches.vim
│   │   │       ├── Segments
│   │   │       │   ├── ctrlp.vim
│   │   │       │   ├── ft_man.vim
│   │   │       │   ├── fugitive.vim
│   │   │       │   ├── hgrev.vim
│   │   │       │   ├── rvm.vim
│   │   │       │   ├── syntastic.vim
│   │   │       │   ├── tagbar.vim
│   │   │       │   └── virtualenv.vim
│   │   │       ├── Segments.vim
│   │   │       └── Themes
│   │   │           ├── default.vim
│   │   │           ├── solarized16.vim
│   │   │           └── solarized256.vim
│   │   ├── doc
│   │   │   ├── Powerline.txt
│   │   │   └── tags
│   │   ├── fontpatcher
│   │   │   ├── fontpatcher
│   │   │   ├── PowerlineSymbols.sfd
│   │   │   └── README.rst
│   │   ├── plugin
│   │   │   └── Powerline.vim
│   │   ├── Powerline_default_default_compatible.cache
│   │   ├── Powerline_default_default_fancy.cache
│   │   ├── Powerline_default_default_unicode.cache
│   │   ├── Powerline_solarized256_default_unicode.cache
│   │   └── README.rst
│   └── vundle
│       ├── autoload
│       │   ├── vundle
│       │   │   ├── config.vim
│       │   │   ├── installer.vim
│       │   │   └── scripts.vim
│       │   └── vundle.vim
│       ├── doc
│       │   ├── tags
│       │   └── vundle.txt
│       ├── LICENSE-MIT.txt
│       ├── README.md
│       └── test
│           ├── files
│           │   └── test.erl
│           ├── minirc.vim
│           └── vimrc
├── README
└── vimfiles
    ├── autocomplete.conf
    ├── basicSetting.conf
    ├── compilefile.conf
    ├── conqueterm.conf
    ├── indentline.conf
    ├── keyMapSetting.conf
    ├── neocomplcache.conf
    ├── nerdtree.conf
    ├── powerline.conf
    ├── rainbow_parentheses.conf
    ├── showtitle.conf
    └── taglist.conf

63 directories, 180 files

###2. 安装使用:

1.将本项目中的 .vimrc文件 和 .vim 目录 复制到当前用户的家目录下,即可直接使用。注意先备份你自己的 .vimrc 文件 和 .vim 目录。

#备份你的.vimrc文件
cp  ~/.vimrc  ~/.vimrc.backup
#备份你的 .vim 目录
cp  -r ~/.vim  ~/.vim.backup
#配置本项目的.vimrc
cp  -r .vim .vimrc  ~/

###3. 注意:

3.1 由于.vim目录 和 .vimrc 前面都有 . ,所以在你下载到本地的目录里文件是隐藏的。如果你的操作系统是ubuntu,使用nautilus文件管理器,只需在项目目录下按下Ctrl+H 就可一显示隐藏文件。

其它操作系统,参见对应系统的设置说明。

3.2 终端配置,命令ls -al 显示当前目录下所有文件。

3.3 目前基本不在windows下用vim,具体配置日后补上。

3.4 1.3节.vim的目录结构是使用命令 tree -n .vim 生成的。tree命令在ubuntu下使用sudo apt-get install tree安装,具体使用方法参见命令tree --help结果。

###4.感谢

###5.结束

About

my vim configuration files

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Vim Script 100.0%