GithubHelp home page GithubHelp logo

Cannot map <space> about vimperator-labs HOT 12 OPEN

pevu avatar pevu commented on July 19, 2024
Cannot map

from vimperator-labs.

Comments (12)

fx-kirin avatar fx-kirin commented on July 19, 2024 8

@adamryman 's hack is really helpful.

If somebody doesn't want to modify your local vimperator, add the following code hook in .vimperatorrc file.

" To Enable map <Space>
js <<EOM
  window.addEventListener('keypress',function (event) {
    var code=event.charCode;
    if ((liberator.mode === modes.INSERT && modes.extended === modes.MENU)
    ||(liberator.mode ==modes.NORMAL && code==32)
    ||(liberator.mode ==modes.COMMAND_LINE && code !=32)){
      let map = mappings.get(liberator.mode, events.toString(event));
      if (map) {
        event.preventDefault();
        event.stopPropagation();
        map.execute();
      }
    }
  },false);
EOM

" My Customization
map <Space> <Leader>

from vimperator-labs.

adamryman avatar adamryman commented on July 19, 2024 3

@jwhitley

That is interesting, those do not work for me either.

I realize now that I use leaders in a very nonstandard way. In vim, I leave let mapleader="\" by default and then I map <Space> <Leader> because this allows me to see a \ with set showcmd when I press space, rather than just seeing a space (i.e. nothing).

I did the same in vimperator without realizing it. But it does work if you want this functionality.

So follow my instructions and to use space as a leader key do the following

:let mapleader="\"
:map <space> <leader>
" And as an example, feel free to try something else
:map <leader>j :echo "Hello, World; Leader is now Space"<Return>

Then try pressing <space>j and seeing if it worked.

Let me know if this is functionality you wanted. It works for everything I wanted it to.

from vimperator-labs.

adamryman avatar adamryman commented on July 19, 2024 2

I modified one line in my local zipped copy of vimperator and I seem to have the functionality I want.

https://github.com/vimperator/vimperator-labs/blob/master/vimperator/content/config.js#L305

"<Space>": modes.NORMAL | modes.INSERT,

To

"<Space>":  modes.INSERT,

And now I can map leader to Space.

If anyone else wants to do this just navigate to your firefox profile/extensions (i.e. ~/.mozilla/firefox/$YOURPROFILE.default/extensions) and edit your vimperator zip. (vim can do this if you have zip and unzip installed)

Then modify content/config.js as I did, save, quit, and restart firefox. Bam, you can map space.

What problems may I have by doing this? If I do run into any, I will post them here.

from vimperator-labs.

maxauthority avatar maxauthority commented on July 19, 2024

Space (and a few other keys like Enter) unfortunately has some places where
it is hard coded, so I agree with you about the bug, but there is nothing
simple we can fix that without testing it properly for accessibility.

On Sun, Jul 20, 2014 at 6:52 PM, pevu [email protected] wrote:

This doesn't work:

noremap f

This does:

noremap F

They both show up as mapped keys, meaning I can :unmap afterwards,
but the issue remains.

Space is a very conveniently placed key for just about everything, would
be a shame to give it up to scrolling. And the default F is not in a
convenient location for me (using Dvorak).

(Firefox 30, Windows 8.1 x64)


Reply to this email directly or view it on GitHub
#10.

from vimperator-labs.

whitelynx avatar whitelynx commented on July 19, 2024

This has been frustrating me in Muttator as well; I use Space in Vim to toggle folds, and I'd expect Enter to open the currently-selected email; however, with the following key mappings, neither key has any effect:

nnoremap <Space> za
nnoremap <CR> M

from vimperator-labs.

jgkamat avatar jgkamat commented on July 19, 2024

I've been trying out vimperator and this issue isn't letting me pass space through to videos, is there a way that we can make space pass through to the webpage (but not remapping it, as per this issue), so that we can play/pause videos and other things? Firefox handles scrolling too in this case.

from vimperator-labs.

adamryman avatar adamryman commented on July 19, 2024

Is there a good way for me to find all the places where Space is hard coded? I would like a make a fork where space can be mapped. I use space for leader in vim and I would really love the same in vimperator.

from vimperator-labs.

jwhitley avatar jwhitley commented on July 19, 2024

@adamryman no repro here. Perhaps one of us is missing something necessary?

I made the change you described to content/config.js, updated my .vimperatorrc leader mapping aslet mapleader="<space>", and restarted Firefox. I also tried let mapleader="\<space>", in case Vimperator carries over Vim's syntax here. Neither way caused my <leader> mappings to work with space -- hitting space just paged down in FF (39.0).

from vimperator-labs.

jwhitley avatar jwhitley commented on July 19, 2024

@adamryman Brilliant! That does it. It's a complete hack, but it does the job for now. The mental switching of <leader> between Vim and Vimperator has been a major pain; I haven't created any <leader> bindings that I actually use in Vimperator as a result. Thanks.

from vimperator-labs.

adamryman avatar adamryman commented on July 19, 2024

@jwhitley Glad it worked for you! As far as the mental switch between <leader> in vim and vimperator, I agree completely. I did not create any <leader> bindings until now either.

Very happy that my little hack helped someone else out.

If anyone wants to know how I did this, I just searched the codebase for "<space>" and "<Space>" and changed the only line that seemed to be related.

@jwhitley if you come across any weird issues that are related to this, please post them here. Also I will be studying your .vimrc, I see you have nice fugitive leader bindings that I may borrow haha.

from vimperator-labs.

tuxflo avatar tuxflo commented on July 19, 2024

I'm used to map my Key to / for searching. Using the tip from @adamryman worked like a charm.

from vimperator-labs.

tecfu avatar tecfu commented on July 19, 2024

Brilliant work: @adamryman @fx-kirin .

@fx-kirin I'm using your patch in my .vimperatorrc at it works a treat. Thank you.

from vimperator-labs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.