Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Single hjkl enabled, while repetitive striking disabled? #23

Open
wikitopian opened this issue Mar 2, 2013 · 16 comments
Open

Single hjkl enabled, while repetitive striking disabled? #23

wikitopian opened this issue Mar 2, 2013 · 16 comments

Comments

@wikitopian
Copy link
Owner

teimu on r/vim and others have noted that these keys can be constructively integrated into intelligent motion commands, such as v5jd to delete five lines down and so on.

Is there a graceful way to allow for j but disallow jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj ?

And should that be a separate mode or an enhancement to hard mode? I'm kind of favoring the latter?

@dbakker
Copy link

dbakker commented Mar 2, 2013

How about something like this? Another option might be to make Vim sleep a bit after each repetition.

I think it is definitely an enhancement. There is no reason not to use hjkl if you need to move exactly one character, for instance when doing something like jdd.

@ghost
Copy link

ghost commented Mar 3, 2013

This should definitely be added in the regular hardmode, because navigating using the hjkl in a non repetitive way should be allowed.

I for example use relative line numbers so I can easily jump to a certain line by just looking at the line numbers and hittting j/k and actually disabled the plugin for now because it slowed me down even when not using anti-patterns

@wikitopian
Copy link
Owner Author

I'm honestly not sharp enough with VimScript to discern whether your proposed solution is graceful and appropriate or not, @dbakker , or what the pros and cons of this solution or alternative solutions is.

I'm a bit swamped with work this coming week, but I'll take some time to figure out what's going on in your function and whether it's the right way to go.

Anybody else have any thoughts on his HardModeHJKL function?

@ghost
Copy link

ghost commented Mar 4, 2013

The code looks fine to me (Not a vimscript expert though), only thing I'd do is namespace the variables too: g:HardMode__lastPos (2nd underscore implying internal use only).

@AdamBrodzinski
Copy link

I agree HardModeHJKL would be great! I was actually coming to open up the same issue lol. Perhaps even two or three quick hjkl's would be allowed? It seems that it takes more keystrokes to move down a few lines without typing 2j or jj

BTW, thanks a ton for this plugin @wikitopian ! I've really enjoyed using it when i'm trying to exercise my vim muscles. The first time with it enabled was almost as painful as my first hour with vim 😄

@ghost
Copy link

ghost commented Mar 18, 2013

I'm currently looking at this and testing it.

Only issue so far is losing visual selection when you hit the limit of repetitive HJKL strokes.

@AdamBrodzinski I'm also looking at implementing a setting with how many HJKL's are allowed, well attempting to

@ghost
Copy link

ghost commented Mar 18, 2013

Ok it's implemented including the config option, can people please test https://github.com/xeross/vim-hardmode/tree/hjkl-repeat

There also seems to be some initialization issue when calling HardMode() which goes away if you change buffers, not sure why that happens.

@ghost
Copy link

ghost commented Mar 19, 2013

Found another bug, switching to insert mode and back does not reset the count.

@AdamBrodzinski
Copy link

@xeross Great!! I'll make some time tomorrow night to dig in and test it out. Kudos!

@frankychung
Copy link

I've been using the hjkl-repeat branch for a few days and it works great (besides the bugs you've already mentioned).

This isn't a bug but a design decision I wanted to bring up: If I set my limit to 1, and hit j, then 10j, it still counts that second j as passing the limit and that second command doesn't go through. I expected the 10 to reset my limit. Of course if it did reset, this allows 1j1j1j but I don't think anyone using this plugin would do that :).

@AdamBrodzinski
Copy link

I found a bug. When you go into insert mode, exit, then try and backspace, backspace fails. It also has this behavior in other buffers that hard mode doesn't work in. I made a quick screencast of this and uploaded it to my dropbox. Unfortunately I couldn't narrate as everyone was asleep but it should be easy to follow with the keyboard clicking =)
https://dl.dropbox.com/u/1407764/github/hardmode_backspace_bug.mov

_edit_ I just read through the source and realized that the backspace is a normal behavior! However, it doesn't flash the easymode warning when you hit backspace.

@gambhiro
Copy link

gambhiro commented Apr 6, 2013

Yes, single hjkl would be great. Relative jumps like 5j would be good to encourage even in hard mode.

Currently trying out hjkl-repeat branch in xeross/vim-hardmode

@ghost
Copy link

ghost commented Apr 6, 2013

My current code is bugged as detailed above, however I do not possess the knowledge to fix this.

@dbakker
Copy link

dbakker commented Apr 6, 2013

You could add au InsertLeave * let g:HardMode_lastType = '' to make HardMode reset on InsertLeave.

With xeross' patch i can do j10j and it works fine (because of the v:count check in the code), are you sure you are using this code frankychung?

@dvcrn
Copy link

dvcrn commented Mar 10, 2016

sadly all the branches mentioned here are gone. Does anyone still have the latest code for this?

@corroded
Copy link

Anyone still following this? :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants