V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
humiaozuzu
V2EX  ›  Vim

推荐下自己的vimrc配置

  •  
  •   humiaozuzu · 2012-09-16 17:01:46 +08:00 · 19840 次点击
    这是一个创建于 4243 天前的主题,其中的信息可能已经有所发展或是发生改变。
    无聊时把自己的插件和配置整理了下,把插件根据功能进行了分类,添加了一些不错的功能

    1. 代码补全(实时补全,括号补全,代码片段扩展,zencoding)
    2. 快速跳转(%跳转,easy motion)
    3. 快速编辑(利用text-object特性快速编辑,注释/反注释代码,代码对齐,indent guide功能)
    4. IDE特性(文件浏览,tab栏,函数名类名列表,git集成,语法查错等)
    5. 不同的语言应用不同的style guide(python根据pep8,其他的类似)
    6. 附件的方便的功能(文件编码检测,高亮当前行,开启文件后自动跳到退出时的位置,:wq退出再也不蛋疼了等)

    每一个部分都有基本的帮助或截图或视频和快捷键




    地址
    https://github.com/humiaozuzu/dot-vimrc
    48 条回复    2014-10-25 20:34:26 +08:00
    bearcat001
        1
    bearcat001  
       2012-09-16 18:26:09 +08:00
    emacs党路过……
    humiaozuzu
        2
    humiaozuzu  
    OP
       2012-09-16 18:42:03 +08:00
    @bearcat001 哈哈,我也用过一年多emacs的,现在换口味到vim了
    dongsheng
        3
    dongsheng  
       2012-09-16 19:01:03 +08:00
    这个ctrlp不错,用上了,谢谢 :)
    jerommix
        4
    jerommix  
       2012-09-16 23:09:58 +08:00
    这怎么感觉也快要月经帖了呢
    那我就再做个广告吧 https://github.com/zhenlonghe/zhenlong-vimrc
    nendors
        5
    nendors  
       2012-09-16 23:25:28 +08:00
    楼上的没贴图觉得没楼主的吸引力明显
    liuyao729
        6
    liuyao729  
       2012-09-17 00:37:55 +08:00
    有个不错,但这么多太占窗口了
    SamZeng
        7
    SamZeng  
       2012-09-17 00:41:03 +08:00
    javascript 调试的呢
    wangxiaokaizi
        8
    wangxiaokaizi  
       2012-09-17 08:17:47 +08:00
    淼哥赞个
    humiaozuzu
        9
    humiaozuzu  
    OP
       2012-09-17 09:32:16 +08:00
    @liuyao729 = =,是演示的时候开的,实际用时最多nerdtree
    Blask
        10
    Blask  
       2012-09-17 14:47:12 +08:00
    试过之后过来+1
    humiaozuzu
        11
    humiaozuzu  
    OP
       2012-09-17 14:55:12 +08:00
    @Blask 不过依旧有一些问题,欢迎反馈!
    killpanda
        12
    killpanda  
       2012-10-25 09:51:11 +08:00
    用着呢 非常棒!
    做了一些细微的调整立马可用了。
    sinxccc
        13
    sinxccc  
       2012-10-25 09:56:38 +08:00
    随口说一句,总觉得加这么多插件有点偏离 VI 本身的目的了…
    humiaozuzu
        14
    humiaozuzu  
    OP
       2012-10-25 10:31:28 +08:00
    @killpanda 如果有觉得默认配置不是很合适的地方欢迎make pull requests

    @sinxccc 你的吐槽和别人在 hacker news 上面的评论一样。。。
    pyKun
        15
    pyKun  
       2012-10-25 10:40:14 +08:00   ❤️ 1
    在探索vim插件的路上就需要这么相互沟通。。。
    顺便问下楼主平时用的电脑是多大的。。。。开多了窗口不是看代码的部分会变的很小么。。。。

    @jerommix 我觉得这个月经帖挺好。。。习惯,风格,新的插件总会在变化的。。。
    humiaozuzu
        16
    humiaozuzu  
    OP
       2012-10-25 11:44:39 +08:00
    @pyKun 这里开多主要是为了截图。。。 平时顶多开tagbar,找文件时会开一下nerdtree或者直接ctrlp
    DeeCheung
        17
    DeeCheung  
       2012-10-25 14:28:51 +08:00
    @humiaozuzu
    求教 ctrlp 设置指定目录缓存或者排除。
    Tabular 用法
    easymotion
    supertab snippets 兼容
    vim-javascript syntax 不兼容 jquery.vim syntax
    DeeCheung
        18
    DeeCheung  
       2012-10-25 14:36:13 +08:00
    没有编辑只好补充
    snippets 中 jquery 用的filetype 是 javascripts-jquery
    -。- 需要手动设置后才能用snippets 不过又没 syntax了
    DeeCheung
        19
    DeeCheung  
       2012-10-25 14:39:44 +08:00
    -.- 继续送铜币

    gundo 中不能记录到文件? 我用 sessionman 进行管理后,丢失 undo 记录.
    jerommix
        20
    jerommix  
       2012-10-25 14:50:53 +08:00
    @DeeCheung :h ctrlp 里面写得很清楚啊. let g:ctrl_cache_dir = $YourDir
    DeeCheung
        21
    DeeCheung  
       2012-10-25 16:59:04 +08:00
    @jerommix 缓存我是用到了 我是想排除一些目录不进入检索的缓存.

    现在写的就很蛋疼。。

    " plugin - ctrlp {{{
    let g:ctrlp_use_caching = 1
    let g:ctrlp_clear_cache_on_exit = 0
    let g:ctrlp_cache_dir = $HOME.'/.vim/tmp/cache/ctrlp'
    let g:ctrlp_show_hidden = 0
    let g:ctrlp_lazy_update = 1
    let g:ctrlp_open_new_file = 't'
    " 过滤 目录
    set wildignore+=*/Downloads/*,*/apps/*,*/Books/*,*/cenv/*,*/pypy/*,*/ln/*,*/repos/*,*/VirtualBox\ VMs/*,*/Video/*,
    \*/Backup/*,*/themes/*,*/home/fonts/*,*/home/config/*,*/4win7/*
    "*/home/dotvim/*
    let g:ctrlp_custom_ignore = {
    \ 'dir': '\v[\/]\.(git|hg|svn)$',
    \ 'file': '\v\.(exe|so|dll|tar|bz2|7z|rar|zip|pdf|epub|mobi|chm|swp|pyc|gz|iso|mov|avi|mkv|flv|ogv|m4v|mp4|ass|srt|torrent|vdi|jpg|gif|png|ico|tdl|xmind|db|ttf|otf|egg|jar|nfo|frp|sublime-package)$',
    \ }
    "}}}
    jerommix
        22
    jerommix  
       2012-10-25 17:01:23 +08:00
    @DeeCheung 分享一下我的吧
    nnoremap <C-W><C-U> :CtrlPMRU<CR>
    nnoremap <C-W>u :CtrlPMRU<CR>

    let g:ctrlp_custom_ignore = '\.git$\|\.hg$\|\.svn$'
    let g:ctrlp_working_path_mode=0
    let g:ctrlp_match_window_bottom=1
    let g:ctrlp_max_height=15
    let g:ctrlp_match_window_reversed=0
    let g:ctrlp_mruf_max = 500
    let g:ctrlp_use_caching = 1
    let g:ctrlp_max_files = 0
    set wildignore+=*/.git/*,*/.hg/*,*/.svn/* " Linux/MacOSX
    let g:ctrlp_use_caching = 1
    let g:ctrlp_clear_cache_on_exit = 0
    humiaozuzu
        23
    humiaozuzu  
    OP
       2012-10-25 19:47:01 +08:00
    @jerommix 插件相关用法可以自己 :help 插件名 学习,目录排除可以看我的配置,然后sublime text里面有一个不错的配置可以参考下:

    "folder_exclude_patterns": [".svn", ".git", ".hg", "CVS"],
    "file_exclude_patterns": ["*.pyc", "*.pyo", "*.exe", "*.dll", "*.obj","*.o", "*.a", "*.lib", "*.so", "*.dylib", "*.ncb", "*.sdf", "*.suo", "*.pdb", "*.idb", ".DS_Store", "*.class", "*.psd", "*.db"],

    tab的问题,如果前面输入的单词刚好可以扩展就会扩展,不行就是默认的tab。

    jquery的问题暂时还要折腾,解决了就在github上面更新
    jerommix
        24
    jerommix  
       2012-10-25 19:51:50 +08:00
    @humiaozuzu 你好像回复错了吧。。。
    humiaozuzu
        25
    humiaozuzu  
    OP
       2012-10-25 19:59:40 +08:00
    @jerommix 噗。。。 sorry
    重新 @DeeCheung
    leecade
        26
    leecade  
       2012-10-25 20:08:48 +08:00   ❤️ 1
    哥, 直接 sublime vi 模式
    chendahui007
        27
    chendahui007  
       2012-10-26 11:01:31 +08:00
    @leecade how
    dived
        28
    dived  
       2012-11-01 14:47:10 +08:00
    可能是我VIM版本(7.0.237)高了
    按照installation安装完后使用VIM:
    neocomplcache does not work this version of Vim (700).
    Tagbar: Vim versions lower than 7.0.167 have a bug that prevents this version of Tagbar from working. Please use the alternate version posted on the website.
    这个怎么搞,在~/.vim/vimrc 还是~/.vim/bundles.vim里面修改
    humiaozuzu
        29
    humiaozuzu  
    OP
       2012-11-01 17:54:02 +08:00
    @dived ~/.vim/bundles.vim 里面把不要的插件注释掉,然后重新进入vim,输入 :BundleClean 就可以清楚插件。
    你的vim版本太旧了,更新下吧。
    yaotian
        30
    yaotian  
       2012-11-02 11:16:36 +08:00
    自动完成双引号和右边括号,但是好像还是要敲一遍?或者还是要敲一下esc?
    yaotian
        31
    yaotian  
       2012-11-02 23:18:49 +08:00
    如何将NERDTree的快捷键换成,+n? 而且leader和后面的字母的间隔需要很短才会生效,设置了间隔时间?
    JesseZ
        32
    JesseZ  
       2012-11-03 12:28:35 +08:00
    多数是终端上用VIM,.vimrc很简单,就下面几个:
    set fileencodings=utf-8,gb18030,utf-16,big5
    set nocompatible
    set fileformats=unix
    set hlsearch
    set incsearch
    set ai
    set ts=4
    tioover
        33
    tioover  
       2012-11-03 14:45:03 +08:00
    yaotian
        34
    yaotian  
       2012-11-15 21:50:42 +08:00
    当打左括号,右括号自动完成。应该用什么快捷键跳出括号?
    zonyitoo
        35
    zonyitoo  
       2012-11-17 00:12:55 +08:00
    左边的tag要生成那个tag文件才能使用,这个比较郁闷,若是能自动生成为好
    upupxjg
        36
    upupxjg  
       2012-11-17 00:16:08 +08:00
    mark一个 ,顺便问大家都用的什么终端?原生的??
    humiaozuzu
        37
    humiaozuzu  
    OP
       2012-11-17 01:05:57 +08:00
    @zonyitoo 是自动生成的

    @upupxjg mac下推荐iTerm2
    这篇文章不错 http://www.yangzhiping.com/tech/iterm2.html
    bwlinux
        38
    bwlinux  
       2012-11-28 09:44:03 +08:00
    @humiaozuzu 为什么有的快捷键工作不正常呢。\a,不正常。我按了\a,都是认为我按了a,。我切换到janus的vim,<leader>是正常的。不知道什么地方出问题了。
    我用arch linux+vim。
    neildd
        39
    neildd  
       2012-11-28 11:10:29 +08:00
    太IDE了
    humiaozuzu
        40
    humiaozuzu  
    OP
       2012-11-28 11:21:49 +08:00
    @bwlinux 我ubuntu下测试过没问题呢。。。 你可以检查下是否安装ack,有修改过我提供的配置吗?其他使用\的快捷键是不是有效?
    bengle
        41
    bengle  
       2012-11-28 11:22:32 +08:00
    @humlaozuzu mac下的命令行oh my zsh也很好用,另外vim下推荐bundle管理
    kosenpai
        42
    kosenpai  
       2012-11-28 15:57:02 +08:00
    感觉太棒了。
    voidman
        43
    voidman  
       2012-11-28 16:50:21 +08:00
    试了一下,非常赞!就是个人觉得默认的配色感觉稍微有点刺眼。
    bwlinux
        44
    bwlinux  
       2012-11-28 22:42:13 +08:00
    @humiaozuzu 这个问题是这么发现的,因为我想用BufferGator,安装了。然后发现\b不正常,然后我发现因为你修改了easymotion的快捷键,我恢复到easymotion的默认。用:map检查,\b是绑定了BufferGatorOpen,但是还是\b还是不行。然后我就测试了\a,发现还是不行。回头我把BufferGator给去除,恢复到你默认的,看easymotion,是不是正常。
    fooCoder
        45
    fooCoder  
       2013-02-01 13:11:34 +08:00
    gundo的撤销功能无法使用。。。求解。。显示提示不能修改 因为选项“modifiable”是关的,set modifiable之后提示已经最新,但是其实没有回到选中的状态。。。
    ioiioi
        46
    ioiioi  
       2013-10-30 23:13:41 +08:00
    我想问问,如何调整easymotion的两次<leader>之间的间隔?默认是“,”,我发现很难把握两次","之间的间隔,导致无法呼出EasyMotion。
    humiaozuzu
        47
    humiaozuzu  
    OP
       2013-10-31 03:17:16 +08:00
    @ioiioi 就是和鼠标的双击一样的操作啊,连按2下+一个vim按键
    AndyCarry
        48
    AndyCarry  
       2014-10-25 20:34:26 +08:00
    怎么我的solarized主题没有生效呢?
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3163 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 32ms · UTC 13:06 · PVG 21:06 · LAX 06:06 · JFK 09:06
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.