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

List of words into fly-as-type dialog?

Expand Messages
  • Matej Cepl
    Hi, I have this function: map l :call FNListTags() function s:FNListTags() new set buftype=nofile bufhidden=hide noswapfile map
    Message 1 of 1 , Jul 2 8:44 AM
    • 0 Attachment
      Hi,

      I have this function:

      map <Leader>l :call <SID>FNListTags()<CR>

      function s:FNListTags()
      new
      set buftype=nofile bufhidden=hide noswapfile
      map <buffer> <Esc> :q!<CR>
      read !cat *.fn | tr ' ' '\n' | sort | uniq | grep '{[^\!]*}' |
      \ grep -v '{/'
      global/^\s*$/d
      %substitute/}.*$/}/
      %substitute/[}{]//g
      %!uniq|sort
      endfunction

      It creates a list of tagnames in marked-up files in the current
      directory. Then I have a second function for marking selected text with
      the new tags:

      vmap <Leader>t :call <SID>FNInsertTag()<CR>

      function s:FNInsertTag() range
      execute "normal! \"as\<C-K>.M"
      let s:tagname=inputdialog("Name of the tag?: ")
      normal gv"fd
      let @f= "{".s:tagname."}".@f."{/".s:tagname."}"
      normal "fP
      gqap
      execute "normal! /\<C-K>.M\<Cr>s" . @a
      return
      endfunction

      Now, would it be possible to somehow join these two functions, so that
      vim would offer in the dialogbox names of tags already in use as default
      (further typing would change the offered tagname -- something like
      Gnucash or even search when insearch is on in Vim)? Or am I asking too
      much from just scripting language?

      Thanks,

      Matej Cepl

      --
      Matej Cepl,
      GPG Finger: 89EF 4BC6 288A BF43 1BAB 25C3 E09F EF25 D964 84AC
      138 Highland Ave. #10, Somerville, Ma 02143, (617) 623-1488
    Your message has been successfully submitted and would be delivered to recipients shortly.