GithubHelp home page GithubHelp logo

justinmk / vim-sneak Goto Github PK

View Code? Open in Web Editor NEW
3.2K 24.0 88.0 748 KB

The missing motion for Vim :athletic_shoe:

Home Page: http://www.vim.org/scripts/script.php?script_id=4809

License: MIT License

Makefile 2.74% Vim Script 94.81% Lua 2.45%
vim neovim nvim plugin motion navigation viml neovim-plugin vim-plugin

vim-sneak's Issues

Restore cursor position after cancelling streak-mode

If you enter streak mode, press Tab, then exit without making a selection, the cursor stays at the position you tabbed to.

It would be more intuitive if the cursor jumped back to the original position before entering streak mode.

Make the streak-mode coexist with the default mode

Instead of overriding the default mode with let g:sneak#streak = 1, I prefer to be able to use the streak-mode along with the normal mode. I would like to use mappings starting with <leader>s in the streak-mode.

support for "1 character search"

Hi justin,
thx for your great plugin!

Is it possible to also search for just 1 character? For example when I type fs and <Enter> it jumps to s

Best regards

Strange mapping. s not mapped in normal mode

I have just those mappings on s'es.

x  s             <Plug>VSneakForward
        Last set from ~/Code/dotfiles/vim/bundle/vim-sneak/plugin/sneak.vim
n  sk            :SplitjoinJoin<CR>
        Last set from ~/.vimrc
n  sj            :SplitjoinSplit<CR>
        Last set from ~/.vimrc  
x  S             <Plug>VSurround
        Last set from ~/Code/dotfiles/vim/bundle/surround.vim/plugin/surround.vim
n  S             <Plug>SneakBackward
        Last set from ~/Code/dotfiles/vim/bundle/vim-sneak/plugin/sneak.vim

Backwards streak-mode?

Maybe i am too stupid or maybe this is not implemented - if i activate streak mode and type sea to find my leaders in .vimrc - I can jump to them with the asdfjkl-movements (which is friggin great, btw). Typing Sea does not go into streak-mode, it just provides me the highlights and I can jump to them with ; and ,
What am I doing wrong?

A very great plugin nonetheless!

netrw mapping

optional netrw mapping (instead of netrw's "sort")

streak-mode multibyte highlighting

sneak basic mode works fine with all multibyte situations so far.

however, streak-mode has the same issue that easymotion has or had: easymotion/vim-easymotion#28

Target labels are offset or missing completely. To test, try a streak-mode search for ïo (on a Mac, option-o + o) in the following text:

foo æfïooæ ïoòôõïo ïofoo fooïo ïoïo

Another test case (#47):

абв

Another thing to keep in mind with sneak basic mode:

  • use strwidth() instead of len() (vim-7.3 only)

see also: easymotion/vim-easymotion#60

indentLine char is highlighted as match

I also use indentLine pluging, I am using this char:

        let g:indentLine_char = '¦'

so if I have a block that is showing that char, when I seach for something with s, the indentLine char is also highlitghted as if it was another match, for example here I did 'sol':
http://i.imgur.com/LJJTkS4.png

I guess this is not on purpose?

thanks

keymap option is ignored

sneak.vim doesn't respect the keymap option. Vanilla f and t do respect it. To reproduce:

  1. :set keymap=bulgarian-phonetic (or any other non-english keymap, I guess)
  2. enter абв (no english letters)
  3. fb goes to letter б (б is entered with key b) -- this is expected, just shows that f respects the keymap
  4. fbw says not found: bw -- at this point, I would expect the cursor to be placed on бв (бв is entered with keys bw)

I guess this has to do with the fact that s starts command mode, where the keymap is ignored by vim.

BTW Great plugin!

provide option to ignore concealed characters

A search may fail even though the visible text appears to be a match, because the actual text contains a concealed character that prevents the match. Maybe Sneak can provide an option to match only visible/non-concealed text.

sc<CR> should jump to the `c` at the end of a line, etc.

moved from here: #40 (comment)


let sc<CR> jump to the c at the end of a line. Similarly, s<CR>c can also jump to c at the beginning of a line, while s<CR> to repeat the previous jump can be replaced by s<BS>.
In the meanwhile, I see that <CR> is a non-printable character, so I have doubts if this is possible.

eliminate unnecessary <Plug>VFoo mappings

given the following

nnoremap <Plug>SneakForward ...
xnoremap <Plug>SneakForward ...

... xmap <Plug>SneakForward will map correctly to the second one. So there's no need for separate <Plug>VSneakForward. This simplifies the configuration experience.

toggle for sneak as case sensitive or smart case

Using sneak all morning (again, I can't say enough about how superb it is, it really improves medium distance movement) I think it would improve if it used smart case.

Shift is a whole extra key! And in 95% of cases I get where I want in one jump!

Make f iterate through search results if pressed immediatly after use

Wow. This is a fantastic plugin.

One feature I would really love is the way 'f' is used to repeat immediately after a motion, a la rhysd/clever-f.vim, especially because I've remapped ; to : in normal mode to make entering commands 50% easier.

Arguments for this:

  • the chance that I want to do a second character sneak immediately after completing one seem small
  • the f key is index finger, and much more agile for me than the pinky or ring finger
  • frees up ; (with a recommendation to remap :, making command mode more accessible)

Would this be possible? Maybe crib from clever-f?

Sneak forward and back at the same time

This discussion at /r/vim about easy-motion got me thinking that the decision of the direction to move could be better made after seeing the matches.

The OP used, call EasyMotion#F(0, 0) to do a direct search. Would this be possible to do with vim-sneak.

Something like a, SneakAny which searches with both SneakForward and SneakBackward. The matches highlight, and SneakNext and SneakProvious work as currently.

sneak next with ; remapped

I have the following bindings in my .vimrc

let mapleader=","
nnoremap ; :
nnoremap : ;

When after using s{char}{char}, pressing : (nor ; ...of course) does not work move to the next instance. I've also tried binding : to SneakNext and VSneakNext, neither of which work. What am I doing incorrectly?

Custom Highlighting

I can't change the highlighting of matches as described in the docs. Placing any of the lines:
hi SneakPluginTarget ctermbg=none ctermfg=green
hi SneakPluginScope ctermbg=none ctermfg=blue
hi link SneakPluginTarget Comment
hi link SneakPluginScope Comment

In either my vimrc or my colorscheme file has no effect.

cannot repeat dZab (backwards operation)

dZab (backwards delete operation) must be invoked twice with the same search ("ab"), at the same cursor position, in order for . to repeat the operation. Seems like b:changedtick is not being updated the same way as it is with forward-operations like dzab. Very odd.

vim-sneak becomes disabled after sneaking and then doing a visual select till

I am very much enjoying the plugin, but I have found that it stops working frequently. This evening I have been able to reproduce actions that seem to disable the sneak plugin.

Steps To Reproduce:

  • Sneak to a specific location in a line
  • Do a visual select until a character vtl for example to select until the letter l.
  • Vim-sneak no longer works

Let me know if I can provide any additional information.

Breaks f;

abcde abcde abcde abcde
abcde abcde abcde abcde
abcde abcde abcde abcde
  • fe;;
  • sbc;;
  • fe;;
    • ; goes to bc instead of e

Error when mapleader is not set

After I removed set mapleader from my vimrc, vim-sneak complains about mapleader being undefined:

 ~ LANG=C vim
Error detected while processing /home/rav/.vim/bundle/vim-sneak/plugin/sneak.vim:
line  277:
E121: Undefined variable: mapleader
E15: Invalid expression: mapleader ==# ','
line  288:
E121: Undefined variable: mapleader
E15: Invalid expression: mapleader ==# ','
Press ENTER or type command to continue

Conflicts with 'maxbrunsfeld/vim-yankstack'

I have vim-yankstack

Bundle 'maxbrunsfeld/vim-yankstack'
set winaltkeys=no
call yankstack#setup()
Bundle 'justinmk/vim-sneak'
nnoremap f :Sneak!         1<cr>
nnoremap F :SneakBackward! 1<cr>
xnoremap f <esc>:<c-u>SneakV!         1<cr>
xnoremap F <esc>:<c-u>SneakVBackward! 1<cr>

However, even ensuring that Sneak is kept after vim-yankstack, the s binding is taken over by vim-yankstack.

I know this might be more of a vim-yankstack issue but if you have any suggestions (probably initialize default mappings explicitly?)

An option to use ; instead of <enter> for "1 character search"

It would be nice to have ";" instead of enter for terminating input while sneaking for 1 character.
It is easier to reach and is consistent with default meaning of ;
So, whenever you want to proceed to the next occurrence, you don't need move your hand.
The only drawback is losing possibility to sneak for 2 char search if the last char is ;

Backwards sneaking persists past f/F/t/T

Sometimes, after sneaking backwards, then using f/F/t/T, directions on ;/, will not correspond to the latter.

For instance, consider the file:

quux quuux quuuux
| <- cursor here

Sneaking vertically with 30Sux will put you at the last ux on the line. Then, fx will move you to the x. However, ; will move you backwards from there, instead of forwards, repeating the fx. Also, 5Sux will move you to the first ux. Then Fq will move backwards to the beginning of the line. But ; will move you forward to subsequent qs. , behaves opposite of ; in these examples.

Regular backwards sneaking seems to have the same effects. Doing a forward sneak resets the situation, I think.

multi-line f with ; and , or \ support

You mentioned that this plugin should replace all the other f enhancement plugins, however, there is one feature I can't seem to get which vim-fangingtastic provides (the two plugins seem incompatible), and that is multi line f, with support for ; and , or \ and I guess possibly with highlighting as well.

I could map f to SneakForward, however I would rather just be able to enter a single character and it work over multi-lines for f, and stick with s for 2 characters.

Sorry if I've missed the explanation somewhere :).

Thanks

Tom

'cz{char}{char}' consumes char to left of cursor

Great plugin!

Little quirk, when doing change to sneak target, the character to the left of cursor is consumed. Often a space, but doesn't seem to matter. Doesn't happen on dz{char}{char}:

" start, cursor between pipes --------
abc|d|ef ghijkl

" after 'czgh' ----------------
ab|ghijkl

"f" stops taking amount when plugin is enabled.

Steps to reproduce:
2f. on a line that had two dots after the cursor.

This seems to affect at least keys fFtT.

When I press one of the keys listed in the topic, the number is dropped and <number>f. becomes just f..

streak-mode: ctrl-c causes weird state

Not sure if anything can be done about this (maybe a sanity check). If user hits <C-c> during streak-mode, highlighting thereafter "masks" every match, even basic-mode matches.

E216: No such event

I have just installed spf13 and I receive the following error upon initializing vim:

Error detected while processing /home/flyer/.spf13-vim-3/.vim/bundle/vim-sneak/plugin/sneak.vim:
line  338:
E216: No such event: netrw autocmd SneakPluginNetrw CursorMoved <buffer> call <sid>map_netrw_key('s') | call <sid>map_netrw_key('S') | autocmd! SneakPluginNetrw * <buffer>
Press ENTER or type command to continue

I am running on Fedora 19,

vim-X11.x86_64                         2:7.4.027-2.fc19                @updates 
vim-common.x86_64                      2:7.4.027-2.fc19                @updates 
vim-enhanced.x86_64                    2:7.4.027-2.fc19                @updates 
vim-filesystem.x86_64                  2:7.4.027-2.fc19                @updates 
vim-minimal.x86_64                     2:7.4.027-2.fc19                @updates

However, on my 32-bit laptop with the same OS, everything works fine.

Access to vim-sneak's modes with autocmds, SneakEnter, SneakLeave

I have mapped vim-sneak to f instead of the default s as I've grown to accustomed to the s and particularly S.

Unfortunately my <leader> and <localleader> are comma and semicolon. (Dvorak layout), so I can't use the comma and semicolon to navigate between the matches. And if I map n and N to vim-sneak I lose the /search navigation!

Looking for an alternate approach, I noticed that you have a way to come out of sneak-mode when you turn off highlighting. If you could add a couple of user autocmds like SneakEnter and SneakLeave, it would be possible to remap the navigation keys on demand, and restore to their defaults for /search.

This isn't a bug per-se, rather an enhancement. :)

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.