Menu

Jumping back to original page

Viki
mzucker
2007-10-17
2013-04-17
  • mzucker

    mzucker - 2007-10-17

    Hello,

    Thank you very much for building this.  I'm excited to learn how to use it.

    I am rather new to Vim and have a question about following the WikiWord links from page to page, and back again.

    The script page says:
    "When the cursor is over a wiki name, you can press <c-cr> to jump to (or create) the referred page. Pressing <LocalLeader>vb brings you back to the original document. Alternatively, you can use <m-leftmouse> and <m-rightmouse> to jump back and forth."

    I'm able to create a new page and/of jump to an extisting page by using either <c-cr> or <m-leftmouse>.  However, I can't seem to figure out how to get back to the original document.  Using <m-rightmouse> seems to have no effect (that's Alt + rightmouse, right?).  And when I try <LocalLeader>vb (which I think is \vb) it throws me into visual mode and highlights the closest word backward.

    I'm running in a Windows Vista environment.  Any tips you can offer would be very much appreciated!

    Thanks,
    Mike

     
    • Tom Link

      Tom Link - 2007-10-17

      In a viki buffer, could you please do:

          redir @*
          echo maparg('<m-rightmouse>')
          echo g:maplocalleader
          echo maparg(g:maplocalleader .'vb')
          echo b:vikiMapFunctionality
          echo g:vikiMapFunctionality
          echo g:vikiSaveHistory
          echo b:VIKIBACKREFS
          echo g:VIKIBACKREFS
          redir END

      and post the output? The redir commands are just there to collect the output in the clipboard. It's possible that some variables are not defined.

      Regards,
      Thomas.

       
    • mzucker

      mzucker - 2007-10-18

      Thanks for the response.  I ran these in VikiMinorMode and here is the contents of my clipboard:

      <LeftMouse>:call viki#GoBack(0)<CR>

      E121: Undefined variable: g:maplocalleader
      E15: Invalid expression: g:maplocalleader

      E121: Undefined variable: g:maplocalleader
      E116: Invalid arguments for function maparg(g:maplocalleader .'vb')
      E15: Invalid expression: maparg(g:maplocalleader .'vb')

      E121: Undefined variable: b:vikiMapFunctionality
      E15: Invalid expression: b:vikiMapFunctionality

      ALL

      0

      E121: Undefined variable: b:VIKIBACKREFS
      E15: Invalid expression: b:VIKIBACKREFS

      {}

      Thanks again for your help!
      Mike

       
      • Tom Link

        Tom Link - 2007-10-18

        First, you might want to define g:maplocalleader. I think '\' is
        mapleader by default.

        Then, does calling :call viki#GoBack(0)<CR> from the command-line work?

        Did you do this in a buffer that you entered through a viki link? If you enter a buffer via viki, is b:VIKIBACKREFS still empty/undefined?

         
    • mzucker

      mzucker - 2007-10-18

      Yes, :call viki#GoBack(0)<CR> does bring me back to the original page.

      When I enter a buffer via viki, echo b:VIKIBACKREFS now returns the following:

      [['C:\Users\mzucker007\viki\WikiHome', 12, 9], ['C:\Users\mzucker007\viki\VimNotes', 2, 11]]

      Many thanks for looking at this!

       
    • Kevin Hathorn

      Kevin Hathorn - 2008-10-30

      I've created a page call main.viki .  From there, I can <c-cr> on 'VikiName' to a page that was created by viki.  However, on this page I can not navigate back to main.viki using <leader>vb and 'ec g:maplocalleader' return the messages:

      E121: Undefined variable: g:maplocalleader
      E15: Invalid expression: g:maplocalleader

      Using ':map<cr>' shows no leader mappings in VikiName for viki as there were in main.viki .

      Using the test from above:
      redir @a
      echo maparg('<m-rightmouse>')
      echo g:maplocalleader
      echo maparg(g:maplocalleader .'vb')
      echo b:vikiMapFunctionality
      echo g:vikiMapFunctionality
      echo g:vikiSaveHistory
      echo b:VIKIBACKREFS
      echo g:VIKIBACKREFS
      redir END

      I get:
      <LeftMouse>:call viki#GoBack(0)<CR>

      E121: Undefined variable: g:maplocalleader
      E15: Invalid expression: g:maplocalleader

      E121: Undefined variable: g:maplocalleader
      E116: Invalid arguments for function maparg(g:maplocalleader .'vb')
      E15: Invalid expression: maparg(g:maplocalleader .'vb')

      E121: Undefined variable: b:vikiMapFunctionality
      E15: Invalid expression: b:vikiMapFunctionality

      ALL

      0

      []

      {}

      Using ':call viki#GoBack()' will take me back to main.viki from VikiName and leader mappings for viki reappear.

      Can you help me with this?

      Kevin

       
      • Tom Link

        Tom Link - 2008-10-30

        I think you have to define g:maplocalleader (or g:vikiMapLeader) in your .vimrc file. See also :help maplocalleader<cr>. I'd assume this solves the problem. Please let me know if it doesn't.

        BTW, if you use ".viki" as suffix for viki pages, you should also set g:vikiNameSuffix = ".viki".

         
    • Kevin Hathorn

      Kevin Hathorn - 2008-10-30

      After executing ':VikiMode<cr>' the mappings appear and I can navigate back to the main page.  Where can I add this command to execute for each viki link?

       
      • Tom Link

        Tom Link - 2008-10-30

        If you use .viki as suffix for viki pages, you could add

        augroup filetypedetect
            au BufNewFile,BufRead *.viki  setf viki
        augroup END

        to ~/.vim/filetype.vim.

         

Log in to post a comment.