Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite465a0a

Browse files
committed
Make :SearchNotes work properly without vim-shell (fixes#53)
This follows the initial suggestion of removing the try/catch construct.I still haven't a clue what the hell is going on here, but I'm donefighting Vim (script) and just want this to work now! :-)
1 parent08b9747 commite465a0a

File tree

3 files changed

+40
-70
lines changed

3 files changed

+40
-70
lines changed

‎README.md

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -376,12 +376,6 @@ If you write your git commit messages in Vim and want to use the notes file type
376376

377377
This is not a complete solution (there are more types of commit messages that the pattern above won't match) but that is outside the scope of this document. For inspiration you can take a look at the[runtime/filetype.vim][filetype.vim] file in Vim's Mercurial repository.
378378

379-
##Troubleshooting
380-
381-
###Searching notes does not work
382-
383-
There is a known problem where keyword searching of notes is broken when my[vim-shell plug-in][shell] is not installed (even though vim-shell is supposed to be an optional dependency). The easiest way to work around this is to simply install the vim-shell plug-in, if that is an option for you. Alternatively you can help me debug the problem discussed in[issue 85][85] :-).
384-
385379
##Contact
386380

387381
If you have questions, bug reports, suggestions, etc. the author can be contacted at<peter@peterodding.com>. The latest version is available at<http://peterodding.com/code/vim/notes/> and<http://github.com/xolox/vim-notes>. If you like the script please vote for it on[Vim Online][vim_online].
@@ -392,7 +386,6 @@ This software is licensed under the [MIT license] [mit].
392386
© 2015 Peter Odding&lt;<peter@peterodding.com>&gt;.
393387

394388

395-
[85]:https://github.com/xolox/vim-session/issues/85
396389
[ctrlwf]:http://vimdoc.sourceforge.net/htmldoc/windows.html#CTRL-W_f
397390
[ctrlwgf]:http://vimdoc.sourceforge.net/htmldoc/windows.html#CTRL-W_gf
398391
[edit]:http://vimdoc.sourceforge.net/htmldoc/editing.html#:edit

‎autoload/xolox/notes.vim

Lines changed: 33 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
" Vim auto-load script
22
" Author: Peter Odding <peter@peterodding.com>
3-
" Last Change: November1, 2015
3+
" Last Change: November4, 2015
44
" URL: http://peterodding.com/code/vim/notes/
55

66
" Note: This file is encoded in UTF-8 including a byte order mark so
77
" that Vim loads the script using the right encoding transparently.
88

9-
letg:xolox#notes#version='0.33.3'
9+
letg:xolox#notes#version='0.33.4'
1010
letg:xolox#notes#url_pattern='\<\(mailto:\|#"diff-9dabcf74fee8f5a7b9ab5c351b817a2ff52dfa9fe6eaf24dddc2a0d2b53c0ba7-11-11-0" data-selected="false" role="gridcell" tabindex="-1" valign="top">11
11
lets:scriptdir=expand('<sfile>:p:h')
1212

@@ -471,46 +471,40 @@ endfunction
471471

472472
function!xolox#notes#search(bang,input)" {{{1
473473
" Search all notes for the pattern or keywords {input} (current word if none given).
474-
try
475-
let starttime=xolox#misc#timer#start()
476-
letinput=a:input
474+
let starttime=xolox#misc#timer#start()
475+
letinput=a:input
476+
ifinput==''
477+
letinput=s:tag_under_cursor()
477478
ifinput==''
478-
letinput=s:tag_under_cursor()
479-
ifinput==''
480-
callxolox#misc#msg#warn("notes.vim %s: No string under cursor",g:xolox#notes#version)
481-
return
482-
endif
479+
callxolox#misc#msg#warn("notes.vim %s: No string under cursor",g:xolox#notes#version)
480+
return
483481
endif
484-
ifinput=~'^/.\+/$'
485-
callxolox#misc#msg#debug("notes.vim %s: Performing pattern search (%s) ..",g:xolox#notes#version,input)
486-
calls:internal_search(a:bang,input,'','')
487-
calls:set_quickfix_title([],input)
488-
else
489-
let keywords=split(input)
490-
letall_keywords=s:match_all_keywords(keywords)
491-
letany_keyword=s:match_any_keyword(keywords)
492-
callxolox#misc#msg#debug("notes.vim %s: Performing keyword search (%s) ..",g:xolox#notes#version,input)
493-
calls:internal_search(a:bang, all_keywords,input, any_keyword)
494-
if &buftype=='quickfix'
495-
" Enable line wrapping in the quick-fix window.
496-
setlocalwrap
497-
" Resize the quick-fix window to 1/3 of the screen height.
498-
let max_height= &lines /3
499-
execute'resize' max_height
500-
" Make it smaller if the content doesn't fill the window.
501-
normal G$
502-
let preferred_height=winline()
503-
execute'resize'min([max_height, preferred_height])
504-
normal gg
505-
calls:set_quickfix_title(keywords,'')
506-
endif
482+
endif
483+
ifinput=~'^/.\+/$'
484+
callxolox#misc#msg#debug("notes.vim %s: Performing pattern search (%s) ..",g:xolox#notes#version,input)
485+
calls:internal_search(a:bang,input,'','')
486+
calls:set_quickfix_title([],input)
487+
else
488+
letkeywords=split(input)
489+
letall_keywords=s:match_all_keywords(keywords)
490+
let any_keyword=s:match_any_keyword(keywords)
491+
callxolox#misc#msg#debug("notes.vim %s: Performing keyword search (%s) ..",g:xolox#notes#version,input)
492+
calls:internal_search(a:bang, all_keywords,input, any_keyword)
493+
if &buftype=='quickfix'
494+
" Enable line wrapping in the quick-fix window.
495+
setlocalwrap
496+
" Resize the quick-fix window to 1/3 of the screen height.
497+
let max_height= &lines /3
498+
execute'resize' max_height
499+
" Make it smaller if the content doesn't fill the window.
500+
normal G$
501+
let preferred_height=winline()
502+
execute'resize'min([max_height, preferred_height])
503+
normal gg
504+
calls:set_quickfix_title(keywords,'')
507505
endif
508-
callxolox#misc#timer#stop("notes.vim %s: Searched notes in %s.",g:xolox#notes#version, starttime)
509-
catch/^Vim\%((\a\+)\)\=:E480/
510-
callxolox#misc#msg#warn("notes.vim %s: No matches",g:xolox#notes#version)
511-
catch
512-
callxolox#misc#msg#warn("notes.vim %s: Encountered error during search: %s (%s)",g:xolox#notes#version,v:exception,v:throwpoint)
513-
endtry
506+
endif
507+
callxolox#misc#timer#stop("notes.vim %s: Searched notes in %s.",g:xolox#notes#version, starttime)
514508
endfunction
515509

516510
function!s:tag_under_cursor()" {{{2

‎doc/notes.txt

Lines changed: 7 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,9 @@ Contents ~
5252
3. VOoM|notes-voom|
5353
4. Txtfmt|notes-txtfmt|
5454
8. Using the notes file type for git commit messages|using-notes-file-type-for-git-commit-messages|
55-
9. Troubleshooting|notes-troubleshooting|
56-
1. Searching notes does not work|searching-notes-does-not-work|
57-
10. Contact|notes-contact|
58-
11. License|notes-license|
59-
12. References|notes-references|
55+
9. Contact|notes-contact|
56+
10. License|notes-license|
57+
11. References|notes-references|
6058

6159
===============================================================================
6260
*notes-introduction*
@@ -754,34 +752,20 @@ the pattern above won't match) but that is outside the scope of this document.
754752
For inspiration you can take a look at the runtime/filetype.vim[17] file in
755753
Vim's Mercurial repository.
756754

757-
===============================================================================
758-
*notes-troubleshooting*
759-
Troubleshooting~
760-
761-
-------------------------------------------------------------------------------
762-
*searching-notes-does-not-work*
763-
Searching notes does not work~
764-
765-
There is a known problem where keyword searching of notes is broken when my
766-
vim-shell plug-in[14] is not installed (even though vim-shell is supposed to
767-
be an optional dependency). The easiest way to work around this is to simply
768-
install the vim-shell plug-in, if that is an option for you. Alternatively you
769-
can help me debug the problem discussed in issue 85[18] :-).
770-
771755
===============================================================================
772756
*notes-contact*
773757
Contact~
774758

775759
If you have questions, bug reports, suggestions, etc. the author can be
776760
contacted at peter@peterodding.com. The latest version is available at
777761
http://peterodding.com/code/vim/notes/ andhttp://github.com/xolox/vim-notes.
778-
If you like the script please vote for it on Vim Online[19].
762+
If you like the script please vote for it on Vim Online[18].
779763

780764
===============================================================================
781765
*notes-license*
782766
License~
783767

784-
This software is licensed under the MIT license[20]. © 2015 Peter Odding
768+
This software is licensed under the MIT license[19]. © 2015 Peter Odding
785769
<peter@peterodding.com>.
786770

787771
===============================================================================
@@ -805,8 +789,7 @@ References ~
805789
[15]http://www.vim.org/scripts/script.php?script_id=2657
806790
[16]http://www.vim.org/scripts/script.php?script_id=2208
807791
[17]https://code.google.com/p/vim/source/browse/runtime/filetype.vim?r=fbc1131f0ba5be4ec74fb2ccdfb3559b446a2b1e#778
808-
[18]https://github.com/xolox/vim-session/issues/85
809-
[19]http://www.vim.org/scripts/script.php?script_id=3375
810-
[20]http://en.wikipedia.org/wiki/MIT_License
792+
[18]http://www.vim.org/scripts/script.php?script_id=3375
793+
[19]http://en.wikipedia.org/wiki/MIT_License
811794

812795
vim: ft=help

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp