zcranberry吧 关注:11贴子:1,613
  • 10回复贴,共1
map配置
foldmethod


1楼2012-09-14 10:12回复
    http://blog.csdn.net/steedliu/article/details/1763366
    去除多余的^M


    3楼2012-11-12 14:57
    回复
      ubuntu下的Vim已经可以作为一个C语言IDE用了。快速跳转,代码补全都已经搞定,用.vim配置的脚本都比较好搞定。ctags 和cscope相对麻烦一点,涉及到路径的问题很多。
      windows下,自己的笔记本上cscope和omni complete都曾经成功过,不过再用就不行了。不知道为什么。。。台式机上至今不好用。


      4楼2012-11-23 09:06
      回复

        内容:
        用vim这么久 了,始终也不知道怎么在vim中使用系统粘贴板,通常要在网上复制一段代码都是先gedit打开文件,中键粘贴后关闭,然后再用vim打开编辑,真的不 爽;上次论坛上有人问到了怎么在vim中使用系统粘贴板,印象里回复很多,有好几页的回复却没有解决问题,今天实在受不了了又在网上找办法,竟意外地找到 了,贴出来分享一下。
        如果只是想使用系统粘贴板的话直接在输入模式按Shift+Inset(粘贴)就可以了,下面讲一下vim的粘贴板的基础知识,有兴趣的可以看看,应该会有所收获的。
        vim帮助文档里与粘贴板有关的内容如下:
        vim有12个粘贴板,分别是0、1、2、...、9、a、“、+;用:reg命令可以查看各个粘贴板里的内容。在vim中简单用y只是复制到“(双引号)粘贴板里,同样用p粘贴的也是这个粘贴板里的内容;
        要将vim的内容复制到某个粘贴板,需要退出编辑模式,进入正常模式后,选择要复制的内容,然后按"Ny(注意带引号)完成复制,其中N为粘贴板号(注意是按一下双引号然后按粘贴板号最后按y),例如要把内容复制到粘贴板a,选中内容后按"ay就可以了,有两点需要说明一下:
        “号粘贴板(临时粘贴板)比较特殊,直接按y就复制到这个粘贴板中了,直接按p就粘贴这个粘贴板中的内容;
        +号粘贴板是系统粘贴板,用"+y将内容复制到该粘贴板后可以使用Ctrl+V将其粘贴到其他文档(如firefox、gedit)中,同理,要把在其他地方用Ctrl+C或右键复制的内容复制到vim中,需要在正常模式下按"+p;
        要将vim某个粘贴板里的内容粘贴进来,需要退出编辑模式,在正常模式按"Np,其中N为粘贴板号,如上所述,可以按"5p将5号粘贴板里的内容粘贴进来,也可以按"+p将系统全局粘贴板里的内容粘贴进来。注意:在我这里,只有vim.gtk或vim.gnome才能使用系统全局粘贴板,默认的vim.basic看不到+号寄存器。安装vim.gnome使用apt-get install vim-gnome,然后vim自动会链接到vim.gnome。


        6楼2013-02-04 12:12
        收起回复
          http://stackoverflow.com/questions/4151448/spaces-as-tabs-and-backspace-behavior-in-vim
          解决用4个空格代替的tab删除时一个一个删除的问题。


          7楼2013-02-05 14:53
          回复
            十六进制编辑命令
            %!xxd


            8楼2013-02-05 22:25
            回复
              autoformat C style
              gg=G
              Try the following keystrokes:gg=G
              Explanation: gg goes to the top of the file, = is a command to fix the indentation and G tells it to perform the operation to the end of the file.


              9楼2013-02-17 18:02
              收起回复
                http://www.vimer.cn/2009/10/vimgvim%E5%AE%9E%E7%8E%B0%E5%A4%9A%E6%96%87%E4%BB%B6%E7%9A%84%E6%9F%A5%E6%89%BE%E5%92%8C%E6%9B%BF%E6%8D%A2.html
                vimgrep部分不对,详情参考手册。
                多文件替换很好用


                11楼2013-05-12 23:29
                回复
                  要改语法着色,查看修改两个相关的文件,
                  比如 desert配色,asm文件,查看
                  asm.vim 和 desert.vim两者配合使用。


                  12楼2013-08-10 19:27
                  回复
                    linux 版的
                    set ruler
                    set number
                    set incsearch
                    set ignorecase
                    set smartcase
                    set hls
                    set guifont=Consolas\ 12
                    set tabstop=4
                    set backspace=indent,eol,start
                    set ci
                    set si
                    set et
                    set sw=4
                    set shiftwidth=4
                    "set softtabstop=4
                    set autochdir
                    set tags=tags;
                    set fileencodings=ucs-bom,utf-8,cp936,gb18030,big5,euc-jp,euc-kr,latin1
                    nmap <C-_>s :cs find s <C-R>=expand("<cword>")<CR><CR>
                    nmap <C-_>g :cs find g <C-R>=expand("<cword>")<CR><CR>
                    nmap <C-_>c :cs find c <C-R>=expand("<cword>")<CR><CR>
                    nmap <C-_>t :cs find t <C-R>=expand("<cword>")<CR><CR>
                    nmap <C-_>e :cs find e <C-R>=expand("<cword>")<CR><CR>
                    nmap <C-_>f :cs find f <C-R>=expand("<cfile>")<CR><CR>
                    nmap <C-_>i :cs find i ^<C-R>=expand("<cfile>")<CR>$<CR>
                    nmap <C-_>d :cs find d <C-R>=expand("<cword>")<CR><CR>
                    map <F2> :mksession! ~/vim_session <cr> " Quick write session with F2
                    map <F3> :source ~/vim_session <cr> " And load session with F3
                    map <C-s> :w<CR>
                    imap <C-s> <Esc>:w<CR>i
                    syntax enable
                    syntax on
                    colorscheme desert


                    13楼2014-01-16 21:47
                    回复
                      au GUIENTER * simalt ~x
                      set ruler
                      set number
                      set incsearch
                      set ignorecase
                      set smartcase
                      set hls
                      set guifont=consolas:h11
                      set smarttab
                      set tabstop=4
                      set shiftwidth=4
                      set expandtab
                      set backspace=indent,eol,start
                      set ci
                      set si
                      set et
                      set autochdir
                      set tags=tags;
                      "cs add cscope.out "目前工作不正常,仅单目录下可工作
                      "set fileencodings=ucs-bom,utf-8,cp936,gb18030,big5,euc-jp,euc-kr,latin1
                      set encoding=utf-8
                      set fileencodings=utf-8,chinese,latin-1
                      if has("win32")
                      set fileencoding=chinese
                      else
                      set fileencoding=utf-8
                      endif
                      "解决菜单乱码
                      source $VIMRUNTIME/delmenu.vim
                      source $VIMRUNTIME/menu.vim
                      "解决consle输出乱码
                      language messages zh_CN.utf-8
                      nmap <C-_>s :cs find s <C-R>=expand("<cword>")<CR><CR>
                      nmap <C-_>g :cs find g <C-R>=expand("<cword>")<CR><CR>
                      nmap <C-_>c :cs find c <C-R>=expand("<cword>")<CR><CR>
                      nmap <C-_>t :cs find t <C-R>=expand("<cword>")<CR><CR>
                      nmap <C-_>e :cs find e <C-R>=expand("<cword>")<CR><CR>
                      nmap <C-_>f :cs find f <C-R>=expand("<cfile>")<CR><CR>
                      nmap <C-_>i :cs find i ^<C-R>=expand("<cfile>")<CR>$<CR>
                      nmap <C-_>d :cs find d <C-R>=expand("<cword>")<CR><CR>
                      filetype plugin indent on
                      set completeopt=longest,menu
                      let Tlist_Show_One_File=1
                      let Tlist_Exit_OnlyWindow=1
                      let g:winManagerWindowLayout='FileExplorer|TagList'
                      nmap wm :WMToggle<cr>
                      map <F2> :mksession! ~/vim_session <cr> " Quick write session with F2
                      map <F3> :source ~/vim_session <cr> " And load session with F3
                      map <C-s> :w<CR>
                      imap <C-s> <Esc>:w<CR>i
                      syntax enable
                      syntax on
                      colorscheme desert


                      14楼2014-01-16 22:05
                      收起回复