fmoralesc / vim-pad

a quick notetaking plugin
MIT License
319 stars 22 forks source link

no results in search with macvim grep or ack on a mac (10.9.4) #49

Closed elliottw closed 9 years ago

elliottw commented 10 years ago

vim version:

lithium% mvim --version
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Apr 21 2014 14:54:22)
MacOS X (unix) version
Included patches: 1-258
Compiled by Bjorn Winckler <bjorn.winckler@gmail.com>
Huge version with MacVim GUI.  Features included (+) or not (-):
+acl             +file_in_path    +mouse_sgr       +tag_binary
+arabic          +find_in_path    -mouse_sysmouse  +tag_old_static
+autocmd         +float           +mouse_urxvt     -tag_any_white
+balloon_eval    +folding         +mouse_xterm     -tcl
+browse          -footer          +multi_byte      +terminfo
++builtin_terms  +fork()          +multi_lang      +termresponse
+byte_offset     +fullscreen      -mzscheme        +textobjects
+cindent         -gettext         +netbeans_intg   +title
+clientserver    -hangul_input    +odbeditor       +toolbar
+clipboard       +iconv           +path_extra      +transparency
+cmdline_compl   +insert_expand   +perl            +user_commands
+cmdline_hist    +jumplist        +persistent_undo +vertsplit
+cmdline_info    +keymap          +postscript      +virtualedit
+comments        +langmap         +printer         +visual
+conceal         +libcall         +profile         +visualextra
+cryptv          +linebreak       +python          +viminfo
+cscope          +lispindent      -python3         +vreplace
+cursorbind      +listcmds        +quickfix        +wildignore
+cursorshape     +localmap        +reltime         +wildmenu
+dialog_con_gui  -lua             +rightleft       +windows
+diff            +menu            +ruby            +writebackup
+digraphs        +mksession       +scrollbind      -X11
+dnd             +modify_fname    +signs           -xfontset
-ebcdic          +mouse           +smartindent     +xim
+emacs_tags      +mouseshape      -sniff           -xsmp
+eval            +mouse_dec       +startuptime     -xterm_clipboard
+ex_extra        -mouse_gpm       +statusline      -xterm_save
+extra_search    -mouse_jsbterm   -sun_workshop    -xpm
+farsi           +mouse_netterm   +syntax
   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
  system gvimrc file: "$VIM/gvimrc"
    user gvimrc file: "$HOME/.gvimrc"
2nd user gvimrc file: "~/.vim/gvimrc"
    system menu file: "$VIMRUNTIME/menu.vim"
  fall-back for $VIM: "/Applications/MacVim.app/Contents/Resources/vim"
Compilation: clang -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_MACVIM -Wall -Wno-unknown-pragmas -pipe  -DMACOS_X_UNIX  -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: clang   -L. -L/usr/local/lib -L. -L/usr/local/lib  -L/usr/local/lib -o Vim -framework Cocoa -framework Carbon       -lm -lncurses  -liconv -framework Cocoa   -fstack-protector -L/usr/local/lib  -L/System/Library/Perl/5.16/darwin-thread-multi-2level/CORE -lperl -framework Python   -framework Ruby

ack:

lithium% ack --version
ack 2.12
Running under Perl 5.16.2 at /usr/bin/perl

.vimrc:

let g:pad_dir = "~/text/"
let g:pad_search_backend = "ack"

results:

When using Shift-F, typing any character leads to [NEW] and that character.

fmoralesc commented 10 years ago

Can confirm. ack's API might have changed since the last time I checked, I'll try to examine what's going on.

fmoralesc commented 10 years ago

Actually, something similar happens with grep as backend. :( This is not good.

elliottw commented 10 years ago

yeah, i noticed it with grep, but figured i didn't install the perl regex stuff correctly so didn't want to bring it up.

fmoralesc commented 10 years ago

Just pushed a fix for ack, which somehow seems to have fixed it for grep too (i think it was choking on binary data in the .git dir for my notes, something similar might have happened to you). In my system ack is considerably slower than grep.

elliottw commented 10 years ago

didn't seem to do anything. updated with vundle, no dice. completely wiped, installed again with vundle, still no. restarted zsh, macvim, everything but my machine, still no identifying any characters.

what info can i give to help you troubleshoot? i even moved vim-pad to a new directory and created two new files with vim-pad because previously i imported a bunch of files, and still nothing.

fmoralesc commented 10 years ago

Hm. First, check if you are using the devel branch.

Then, in file plugin/padlib/handler.py, change lines 121-122 so they read

    print " ".join(command)
    cmd_output = Popen(command, stdout=PIPE, stderr=PIPE).communicate()[0].split("\n")
    print cmd_output

That should display what is the output of ack, if any. If cmd_output is [], something is wrong in the execution of the program. vim-pad is not checking for errors, but it probably should.

elliottw commented 10 years ago

Ok, did rm -Rf on vim-pad/ cloned the master branch added print ran :ListPads typed: shift-f this was the output: https://www.dropbox.com/s/fgvki82a06t912i/Screenshot%202014-08-09%2016.20.35.png screenshot 2014-08-09 16 20 35

once I typed a character, this was the output: https://www.dropbox.com/s/4ry5bbihqbj92sn/Screenshot%202014-08-09%2016.20.50.png

screenshot 2014-08-09 16 20 50

not sure where i was supposed to see an output

fmoralesc commented 10 years ago

Check :messages, the print statements output should be there. For example, this is the output I get when searching for "vim". captura de pantalla de 2014-08-09 16 48 04

elliottw commented 10 years ago

Here you go:

screenshot 2014-08-09 17 14 33

fmoralesc commented 10 years ago

Thanks. It seems the pad_dir variable is not being processed correctly. Try removing the final /.

elliottw commented 10 years ago

no change

let g:pad_dir = "/Users/elliott/tmp"
fmoralesc commented 10 years ago

(Sorry for the delay) What happens when you run ack in the terminal with those parameters?

ack "t" /Users/elliot/tmp --noheading --max-count 1 -i

does it give out results? Does it fail with an error?

elliottw commented 10 years ago

here you go:

lithium% ack "t" /Users/elliott/tmp --noheading --max-count 1 -i
/Users/elliott/tmp/is_this_a_new_pad?:1:is this a new pad?
/Users/elliott/tmp/is_this_another_new_pad?:1:is this another new pad?
elliottw commented 10 years ago

well it works in terminal vim, but not macvim. Here are the outputs for both when --version:

terminal:

lithium% vim --version
VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Dec 19 2013 15:19:49)
Compiled by root@apple.com
Normal version without GUI.  Features included (+) or not (-):
-arabic +autocmd -balloon_eval -browse +builtin_terms +byte_offset +cindent
-clientserver -clipboard +cmdline_compl +cmdline_hist +cmdline_info +comments
-conceal +cryptv +cscope +cursorbind +cursorshape +dialog_con +diff +digraphs
-dnd -ebcdic -emacs_tags +eval +ex_extra +extra_search -farsi +file_in_path
+find_in_path +float +folding -footer +fork() -gettext -hangul_input +iconv
+insert_expand +jumplist -keymap -langmap +libcall +linebreak +lispindent
+listcmds +localmap -lua +menu +mksession +modify_fname +mouse -mouseshape
-mouse_dec -mouse_gpm -mouse_jsbterm -mouse_netterm -mouse_sysmouse
+mouse_xterm +multi_byte +multi_lang -mzscheme +netbeans_intg -osfiletype
+path_extra -perl +persistent_undo +postscript +printer -profile +python/dyn
-python3 +quickfix +reltime -rightleft +ruby/dyn +scrollbind +signs
+smartindent -sniff +startuptime +statusline -sun_workshop +syntax +tag_binary
+tag_old_static -tag_any_white -tcl +terminfo +termresponse +textobjects +title
 -toolbar +user_commands +vertsplit +virtualedit +visual +visualextra +viminfo
+vreplace +wildignore +wildmenu +windows +writebackup -X11 -xfontset -xim -xsmp
 -xterm_clipboard -xterm_save
   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
      user exrc file: "$HOME/.exrc"
  fall-back for $VIM: "/usr/share/vim"
Compilation: gcc -c -I. -D_FORTIFY_SOURCE=0 -Iproto -DHAVE_CONFIG_H -arch i386 -arch x86_64 -g -Os -pipe
Linking: gcc -arch i386 -arch x86_64 -o vim -lncurses

and macvim:

lithium% mvim --version
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Apr 21 2014 14:54:22)
MacOS X (unix) version
Included patches: 1-258
Compiled by Bjorn Winckler <bjorn.winckler@gmail.com>
Huge version with MacVim GUI.  Features included (+) or not (-):
+acl             +file_in_path    +mouse_sgr       +tag_binary
+arabic          +find_in_path    -mouse_sysmouse  +tag_old_static
+autocmd         +float           +mouse_urxvt     -tag_any_white
+balloon_eval    +folding         +mouse_xterm     -tcl
+browse          -footer          +multi_byte      +terminfo
++builtin_terms  +fork()          +multi_lang      +termresponse
+byte_offset     +fullscreen      -mzscheme        +textobjects
+cindent         -gettext         +netbeans_intg   +title
+clientserver    -hangul_input    +odbeditor       +toolbar
+clipboard       +iconv           +path_extra      +transparency
+cmdline_compl   +insert_expand   +perl            +user_commands
+cmdline_hist    +jumplist        +persistent_undo +vertsplit
+cmdline_info    +keymap          +postscript      +virtualedit
+comments        +langmap         +printer         +visual
+conceal         +libcall         +profile         +visualextra
+cryptv          +linebreak       +python          +viminfo
+cscope          +lispindent      -python3         +vreplace
+cursorbind      +listcmds        +quickfix        +wildignore
+cursorshape     +localmap        +reltime         +wildmenu
+dialog_con_gui  -lua             +rightleft       +windows
+diff            +menu            +ruby            +writebackup
+digraphs        +mksession       +scrollbind      -X11
+dnd             +modify_fname    +signs           -xfontset
-ebcdic          +mouse           +smartindent     +xim
+emacs_tags      +mouseshape      -sniff           -xsmp
+eval            +mouse_dec       +startuptime     -xterm_clipboard
+ex_extra        -mouse_gpm       +statusline      -xterm_save
+extra_search    -mouse_jsbterm   -sun_workshop    -xpm
+farsi           +mouse_netterm   +syntax
   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
  system gvimrc file: "$VIM/gvimrc"
    user gvimrc file: "$HOME/.gvimrc"
2nd user gvimrc file: "~/.vim/gvimrc"
    system menu file: "$VIMRUNTIME/menu.vim"
  fall-back for $VIM: "/Applications/MacVim.app/Contents/Resources/vim"
Compilation: clang -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_MACVIM -Wall -Wno-unknown-pragmas -pipe  -DMACOS_X_UNIX  -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: clang   -L. -L/usr/local/lib -L. -L/usr/local/lib  -L/usr/local/lib -o Vim -framework Cocoa -framework Carbon       -lm -lncurses  -liconv -framework Cocoa   -fstack-protector -L/usr/local/lib  -L/System/Library/Perl/5.16/darwin-thread-multi-2level/CORE -lperl -framework Python   -framework Ruby
fmoralesc commented 10 years ago

Thanks for taking the time of gathering this info. I can't think of anything in mvim's config that should make this fail. Both versions support +python, which could have affected the plugin. I'm assuming both versions are using the same python library (you can check executing :py import sys; print sys.version in vim).

TBH, I'm kind of out of ideas. I can't reproduce the bug anymore since the commits I made yesterday.

elliottw commented 10 years ago

yeah, i think i'll just stick to the terminal version. I'm sorry I couldn't have been more help. At least the changes did fix the terminal version of vim. MacVim works in mysterious ways I guess.

fmoralesc commented 10 years ago

No, I'm sorry not to have been of more help. I'm trying to set up an OS-X VM to test things directly, but I haven't had much luck in the past with that. :(

elliottw commented 10 years ago

no worries. i've had plenty of problems with the mac (xapian etc).

Biotechjones commented 9 years ago

Hey, I just wanted to throw in my voice. I too am having this problem. MacVim, when I envoke search on the vim-pad it instantly states [new] and doesn't search at all.

To add something, when I put a note or few into a subfolder (such as ~/notes/example) the I start searching for 'example' then the search does work! but once I start searching for something other than the subfolder name then it reverts to starting a new file.

fmoralesc commented 9 years ago

@Biotechjones I think grep (or ag) is not being used at all in OSX; folder search is handled by vim-pad itself without resorting to external executables, that's why you are having those results.

I've been unable to set up a VM to test it (I have no machine with OSX available to test things out), so I'm pretty in the blind. If you open vim in the notes folder and execute:

 :!grep example

what is the result?

Biotechjones commented 9 years ago

Hey I ran :!grep example -- it hung the program.

I then ran grep example in terminal in my ~/Dropbox/Notes/ folder and it to hung, waiting for more input.

What does work in terminal is ls | grep example and :!ls|grep example works in vim too.

fmoralesc commented 9 years ago

Of course! Silly me, I was thinking of :!grep -r example .. Anyway, it's the same. Your results confirm grep is executable, so there must be something else wrong.

I tried to set up a OSX VM today, and I got the thing to install, but then it didn't boot :/ Virtualbox doesn't seem to like it at all.

fmoralesc commented 9 years ago

After so long, I've finally made some progress on this (I could finally set up a OSX VM with macvim).

It seems like the issue is that https://github.com/fmoralesc/vim-pad/blob/devel/pythonx/vim_pad/handler.py#L145 sometimes gets bad data: instead of receiving the full output of the grep program, like this:

  /Users/fm/Documents/notes/note_1:1:this is a test

it receives only

 this is a test

which it then tries to treat like a filename and gets filtered out at https://github.com/fmoralesc/vim-pad/blob/devel/pythonx/vim_pad/handler.py#L197 (which in turn clears the notes list, obviously).

I'm not sure yet what is causing this, but at least I've determined what is the problem. :/

fmoralesc commented 9 years ago

Simply made the grep programs return the filenames instead of the filenames + the matches. Fixed at last.

fkirkholt commented 9 years ago

Installed this plugin yesterday, and have the same problem. The search doesn't work. Have this problem in both MacVim and in terminal vim, and with both grep and ack.

smutch commented 9 years ago

I am also having the same problem in terminal vim using the most recent checkout of the devel branch.

I followed some of the instructions in the above comments in order to try and debug the problem. It looks like the issue is that grep on OSX (10.10.3 anyway) doesn't understand the --exclude=.* or -P arguments.

Using ag seems to work though.

fmoralesc commented 9 years ago

Yes, the grep version in OSX is a POS, this is noted in the README and there is not much we can do.

The issue with ack was fixed recently thanks to a contributor (support for it was outdated).

smutch commented 9 years ago

Ah yes. Sorry about that! I missed the README note.

Thanks for the awesome plugin btw!