显示标记插件会导致标记在大约4秒后“弹出”

时间:2012-01-03 23:51:05

标签: vim vim-plugin

我正在使用vim中的Show Marks插件来显示标记的位置。可以使用\mt命令打开/关闭显示的标记。当我第一次打开文档时,标记就像这样:

Marks Off

然后大约4秒钟后我的行动完全没有动作,左手标记边距就像这样弹出:

Marks On

我有三个问题:

  1. 这些默认标记是什么?
  2. 为什么要显示它需要几秒钟?
  3. 如何在启动时强制标记边距激活/停用?

  4. 这是.vimrc文件(我知道它很乱,但用Walter E. Kurtz上校的话说:“你有权杀了我......但是你无权判断我。”)

    set modeline                        "These two lines display the file name at the bottom
    set ls=2
    
    set undodir=~/.vim/undodir
    set undofile
    set undolevels=100    "maximum number of changes that can be undone
    set undoreload=10000 "maximum number lines to save for undo on a buffer reload
    
    "Keep undo history when switching buffers
    set hidden
    
    set nocompatible                    "Don't use vi-compatibility mode
    
    set backspace=2                     "Use the smart version of backspace
    
    set expandtab                       "Tab-related settings
    
    set number                                              "Line Numbers
    
    set shiftwidth=4
    set showcmd
    "set ts=4                                                "4 columns for tabs
    
    set smarttab
    
    set smartindent                                          "Indent every time you press enter
    
    set scrolloff=999                       "Cursor Always in middle
    
    set ruler                           "Always display row/column info 
    
    set tabpagemax=100                  "I want a lot of tabs
    
    set tags=tags;/
    
    imap jj <Esc>                       "Map jj to escape
    
    map <S-j> :bp<CR>           "Map F7 to previous tab
    
    map <S-k> :bn<CR>               "Map F7 to next tab
    
    map <Space> <PageDown>              "Map space bar to next page down
    
    set hlsearch "Highlight search strings
    
    "map <S-u> <C-u>                        "Map page movement keys to shift as well
    
    "map <S-d> <C-d>                        "Map page movement keys to shift as well
    
    "map <S-b> <C-b>                        "Map page movement keys to shift as well
    
    "map <S-f> <C-f>                        "Map page movement keys to shift as well
    
    map <F2> :NERDTreeToggle<CR>    "Toggle Nerd Tree on/off
    
    syntax on
    
    "for Syntastic
    
    function! BufSel(pattern)
      let bufcount = bufnr("$")
      let currbufnr = 1
      let nummatches = 0
      let firstmatchingbufnr = 0
      while currbufnr <= bufcount
        if(bufexists(currbufnr))
          let currbufname = bufname(currbufnr)
          if(match(currbufname, a:pattern) > -1)
            echo currbufnr . ": ". bufname(currbufnr)
            let nummatches += 1
            let firstmatchingbufnr = currbufnr
          endif
        endif
        let currbufnr = currbufnr + 1
      endwhile
      if(nummatches == 1)
        execute ":buffer ". firstmatchingbufnr
      elseif(nummatches > 1)
        let desiredbufnr = input("Enter buffer number: ")
        if(strlen(desiredbufnr) != 0)
          execute ":buffer ". desiredbufnr
        endif
      else
        echo "No matching buffers"
      endif
    endfunction
    
    "Bind the BufSel() function to a user-command
    command! -nargs=1 Bs :call BufSel("<args>")
    
    call pathogen#infect() 
    
    "For syntax checking (syntastic)
    let g:syntastic_auto_loc_list=1
    let g:syntastic_disabled_filetypes=['html']
    let g:syntastic_enable_signs=1
    "set statusline=%{SyntasticStatuslineFlag()}
    set statusline=%<\ %n:%f\ %m%r%y%{SyntasticStatuslineFlag()}%=line:\ %l\ of\ %L\ (%p%%),\ col:\ %c%V\ \ \ \ \ Modified:\ %{Time()}
    
    function! Time()
      return strftime("%c", getftime(bufname("%")))
    endfunction
    
    "For jsbeautify
    map <F9> :call g:Jsbeautify()<CR> 
    
    "Check PHP Syntax
    :autocmd FileType php noremap <C-L> :!php -l %<CR>
    
    "Beautify PHP Syntax In 4 steps
    "1) reduce all multiple blank lines to a single blank line
    "2) change all blank lines to something unique like 'if(true)echo('it puts the lotion on the skin');'
    "3) apply beautifier 
    "4) change unique quote back to new line
    func! ParsePHP()
        :exe 'g/^\_$\n\_^$/d'
        :%s/^[\ \t]*\n/$x = 'It puts the lotion on the skin';\r/ge
        :exe '%!php_beautifier --filters "ArrayNested() IndentStyles(style=k&r)"'
        :%s/$x = 'It puts the lotion on the skin';//ge
    endfunc
    
    map <F8> :call ParsePHP()<CR>
    

3 个答案:

答案 0 :(得分:8)

这些标记是Joachim提到的特殊标记。

要仅显示您自己设置的标记,即“正常标记”,请将其添加到.vimrc文件中:

let showmarks_include = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"   

答案 1 :(得分:3)

从帮助文件:

let g:showmarks_enable=0

默认标记可能是您上次更改的行。

:h `[

但它们看起来像数字标记,您可能只是在之前的编辑中设置它们?我猜他们如果你输入:delmarks 0 1 2 3 4 5 6 7等等就会消失。

编辑:这也在帮助文件中,这可能解释了4秒后的开放:

ShowMarks is activated by the |CursorHold| |autocommand| which is triggered
every |updatetime| milliseconds.  This is set to 4000(4 seconds) by default.
If this is too slow, setting it to a lower value will make it more responsive.

答案 2 :(得分:3)

我也在寻找那些我没有设定的标记。 这个链接

http://vim.wikia.com/wiki/Using_marks

在页面底部解释了内置标记。 寻找“特殊标记”。