Menu

key mapping and spaces on the rhs

fleg
2014-02-05
2014-02-12
  • fleg

    fleg - 2014-02-05

    hi,
    i'd like to be able to do something like...

    map L ?^\s\s*[a-z]

    or

    map L ?^ [a-z]|<tab>[a-z]</tab>

    but i get the 'too many fields' or 'right-side not recognised' error messages.

    i know that jvi doesnt implement all the functionality that vim does so i was wondering
    if there is a different way to do this in jvi?
    cheers,
    fleg

    ps in case you're interested :) what i'm trying to write is a macro that will find the
    first line of the current java function i am in, i then (with the rest of the macro which isnt
    shown here) find the function name and generate a logging statement which includes that name.

    pps and whilst i'm here, thanks err for the visual beep fix that arrived recently!

     
  • Ernie Rael

    Ernie Rael - 2014-02-05

    According to the doc: http://jvi.sourceforge.net/vimhelp/map.txt.html#:map-special-keys

    you can use: <Space>

    re: visual bell, I hope people didn't mind too much making it the default; it seemed the most effective way to quietly announce the feature ;-)

     
  • fleg

    fleg - 2014-02-06
    >you can use: <Space>
    
    hmm tried it, didnt work.
    
    heres some things i've found :-
    
    1/ just doing...
    
        ?   public
    
      works
    
    2/ but...
    
        ?^    public
    
       doesnt
    
    3/ this...
    
        ?<Space><Space>public
    
      also doesnt work
    
    4/ so when i do...
    
        map L ?<Space><Space>public
    
        with no <CR> on the end. when i hit L it prompts me with...
    
        ?    public
    
        but also doesnt work when i hit <CR>
    
    >re: visual bell, I hope people didn't mind too much making it the default; 
    >it seemed the most effective way to quietly announce the feature ;-)
    
    works for me!
    cheers,
    fleg
    
     
  • Ernie Rael

    Ernie Rael - 2014-02-06

    This works for me. Here's debug output generated with

    Tools>Options>jVi>Debug>debugKeyStrokes

    set to ALL. This is both the ":" command that creates the mapping and then using it, notice that it checks "L" and then returns "?". (I had to use noremap since I map the "^")

    CommandAction: 'noremap L ?^<Space><Space><Space><Space>public<CR>'
    parseMapCommand: noremap L ?^<Space><Space><Space><Space>public<CR>: Mapping{'L' --> '?^    public\n' mode=nvop, noremap}
    putMapping(unmap false): Mapping{'L' --> '?^    public\n' mode=nvop, noremap}
    putMapping: remove Mapping{'L' --> '?^    public\n' mode=nvop, noremap}
    CharAction: 'L' 4c(76) 1
    getChar check: 'L' noremap=false, state=0x101, G.no_mapping=0, G.allow_keys=0 G.no_zero_mapping=0
    getChar: map: Mapping{'L' --> '?^    public\n' mode=nvop, noremap}
    getChar check: '?' noremap=true, state=0x101, G.no_mapping=0, G.allow_keys=0 G.no_zero_mapping=0
    

    I wonder if it could be some option setting or something like that. I have "use modal frame" UNchecked, it shouldn't matter, but that's the command input window.

     
  • Ernie Rael

    Ernie Rael - 2014-02-06

    BTW, the command "[m" is implemented. I don't use it much, not sure how well it works.

     
  • Ernie Rael

    Ernie Rael - 2014-02-07

    Forgot to mention that the "q" (recording) command might be of use as well. Not as convenient as a mapping, but...

    Having any success?

     
  • fleg

    fleg - 2014-02-12

    sorry for the delay, was unexpectedly called away.

    Having any success?

    ha! well i've turned on the debug you suggested but i dont see any output.
    when i start up nb, i get the jvi message about fixed-size fonts in the
    output window, which is where i was expecting the debug to appear? am i making
    some n00b mistake?

    one other piece of info, i tried nb7.3.1, a fresh install of jvi with
    all defaults settings left alone and nothing added and i get the same error.
    cheers,
    fleg

    ps btw i'm on os x lion, but surely the os coulnt be the problem! ;)

     
  • fleg

    fleg - 2014-02-12

    ok, i lied. on nb7.3.1...

    map L ?<Space><Space>public
    

    works like i expect.

    also tried unchecking modal frame on 7.4 and it didnt have any effect.

    i'm not sure if this helps but i used the above mapping.

    then when i hit L, i copy/pasted what it was prompting me with into an xterm,
    and it displayed as ctrl-Fpublic, ie...

    ^Fpublic

    cheers,
    fleg

     

    Last edit: fleg 2014-02-12
  • fleg

    fleg - 2014-02-12

    blush.

    i had the space mapped to ctrl-f.

    using normap works.

    thanks for your help, i should have known better than to doubt jvi!
    cheers,
    fleg

     
  • Ernie Rael

    Ernie Rael - 2014-02-12

    i've turned on the debug you suggested but i dont see any output.

    The debug output is done with System.err.print... which gets sent to the logger. The logger output goes both to

    • messages.log - buffered (found in <userdir>/var/log)
    • console - unbuffered

    The output to the console may not be seen depending on how NB is started. I've got -J-Dnetbeans.logger.console=true in <nb-install>/etc/netbeans.conf. </nb-install>

    I'm on Windows; in the icon that starts NB, I added "--console new". You might be able to use this on OSX. I'm guessing that if NB is started from a console then the output would just show up in the console.

     
  • jiya sas

    jiya sas - 2020-12-02
    Post awaiting moderation.

Log in to post a comment.

MongoDB Logo MongoDB