Loading ...
Sorry, an error occurred while loading the content.
 

Re: idutils vim integration

Expand Messages
  • sinbad
    ... sorry, i don t get it, how am i suppose to use this. i find the documentation to be empty. -- -- You received this message from the vim_use maillist. Do
    Message 1 of 4 , Sep 9, 2013
      On Monday, September 9, 2013 9:04:05 PM UTC+5:30, MarcWeber wrote:
      > This is my implementation:
      >
      > https://github.com/MarcWeber/vim-addon-other
      >
      > (this repo contains more than gnu id utils).
      >
      >
      >
      > Adjusting any solution to your needs is that simple that you should be
      >
      > able to do it on your own.
      >
      >
      >
      > Marc Weber

      sorry, i don't get it, how am i suppose to use this.
      i find the documentation to be empty.

      --
      --
      You received this message from the "vim_use" maillist.
      Do not top-post! Type your reply below the text you are replying to.
      For more information, visit http://www.vim.org/maillist.php

      ---
      You received this message because you are subscribed to the Google Groups "vim_use" group.
      To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
      For more options, visit https://groups.google.com/groups/opt_out.
    • Marc Weber
      ... First learn that you should drop text you re not replying to. The plugin file cotnains: noremap mid :call vim_addon_other#GnuIdutils_Mkid() noremap
      Message 2 of 4 , Sep 10, 2013
        Excerpts from sinbad's message of Tue Sep 10 07:34:56 +0200 2013:
        > sorry, i don't get it, how am i suppose to use this.
        > i find the documentation to be empty.

        First learn that you should drop text you're not replying to.

        The plugin file cotnains:

        noremap \mid :call vim_addon_other#GnuIdutils_Mkid()<cr>
        noremap \lid :call vim_addon_other#GnuIdutils_Lid()<cr>

        The autoload/vim_addon_other.vim file contains the implementation:

        let s:gnu_id_utils_file = fnamemodify(expand('<sfile>'),':h').'/gnu-idutils.config'
        fun! vim_addon_other#GnuIdutils_Mkid()
        let this_config = s:gnu_id_utils_file
        let cmd = funcref#Call( get(s:config,'mkid', funcref#Function('return ["mkid", "-m", ARGS[0]]') ) , [this_config])
        let errorFormat = "dummy"
        call bg#RunQF(cmd,'c',errorFormat)
        endf

        fun! vim_addon_other#GnuIdutils_Lid()
        "lid","-R","grep","-r",word
        let cmd = funcref#Call( get(s:config, 'lid', funcref#Function('return ["lid", "-R", "grep", input("lid -R grep (^word$ for whole word matchr :")]') ) )
        let errorFormat = get(s:config,'greplid_ef', '%f:%l:%m')
        call bg#RunQF(cmd,'c',errorFormat)
        return

        " non bg version
        exec 'set efm='.errorFormat
        exec 'set grepprg='.cmd[0]
        exec 'grep '.join(cmd[1:],' ')
        endf



        What is happening here?
        noremap creates the mappings, calling the functions.

        The bg#RunQF is a hack allowing to run those commands in the background.
        Its tested on linux only. That implementation can be found in
        vim-addon-background-cmd. However its trivial to use commands from Vim
        instead:

        Thus you can paste such in your .vimrc and customize it:

        noremap \mid :call GnuIdutils_Mkid()<cr>
        noremap \lid :call GnuIdutils_Lid()<cr>

        fun! GnuIdutils_Mkid()
        let this_config = s:gnu_id_utils_file
        " using & to run in background, creating the database takes some time
        call system('mkid -m '.g:gnu_id_utils_file.' &')
        endf

        fun! GnuIdutils_Lid()
        let cmd = ["lid", "-R", "grep", input("lid -R grep (^word$ for whole word matchr :")]
        exec 'set grepprg='.cmd[0]
        " some quoting is still missing here:
        exec 'grep '.join(cmd[1:],' ')
        " eventually reset grep program here
        endf

        Marc Weber

        --
        --
        You received this message from the "vim_use" maillist.
        Do not top-post! Type your reply below the text you are replying to.
        For more information, visit http://www.vim.org/maillist.php

        ---
        You received this message because you are subscribed to the Google Groups "vim_use" group.
        To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
        For more options, visit https://groups.google.com/groups/opt_out.
      Your message has been successfully submitted and would be delivered to recipients shortly.