显示标记插件会导致标记“弹出”约4秒后
我在 vim 中使用 显示标记 插件来显示标记的位置是。可以使用 \mt
命令打开/关闭显示的标记。当我第一次打开文档时,标记会像这样关闭:
然后大约 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>
I am using the Show Marks plugin in vim to display where the marks are. The displayed marks can be toggled on/off with the \mt
command. When I first open a document the marks are off like so:
Then about 4 seconds later with absolutely no action on my part, the left hand mark margin pops in like so:
I have three questions:
- What are those default marks?
- Why is it taking several seconds for it to get displayed?
- How can I force the mark margin to activate/deactivate at start up?
Here is .vimrc file (I know it's messy, but in the words of Colonel Walter E. Kurtz: "You have a right to kill me...but you have no right to judge me.")
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>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
约阿希姆提到,这些标记是特殊标记。
要仅显示您自己设置的标记,即“正常标记”,请将其添加到您的 .vimrc 文件中:
Those marks are special marks, which Joachim mentioned.
To only show the marks you have set yourself, i.e. the "normal marks", add this to your .vimrc file:
从帮助文件中:
默认标记可能是您上次更改的行之类的内容。
但它们看起来像数字标记,您可能只是在之前的编辑过程中设置了它们?我猜如果您输入
:delmarks 0 1 2 3 4 5 6 7
等,它们就会消失编辑:这也在帮助文件中,可能解释了 4 秒后的打开情况:
From the help files:
The default marks could be things like your last changed line.
But they look like numerical marks, you may have just set them during a previous edit? I'm guessing they will go away if you type
:delmarks 0 1 2 3 4 5 6 7
etcEdit: This is also in the help files which probably explains the opening after 4 seconds:
我也在寻找这些我没有设置的标记。
此链接
http://vim.wikia.com/wiki/Using_marks
在底部进行了解释翻页内置标记。
寻找“特殊标记”。
I was also looking for these marks that I didn't set.
This link
http://vim.wikia.com/wiki/Using_marks
explains at the bottom of the page the built-in marks.
Look for "Special marks".
尝试了很多插件,这个对我来说效果很好,它是唯一一个即时更新标记的插件: https: //github.com/yaocccc/vim-showmarks
Tried many plugins, and this one worked quite well for me, it's the only one that updated marks instantaneously: https://github.com/yaocccc/vim-showmarks