justinmk / vim-sneak Goto Github PK
View Code? Open in Web Editor NEWThe missing motion for Vim :athletic_shoe:
Home Page: http://www.vim.org/scripts/script.php?script_id=4809
License: MIT License
The missing motion for Vim :athletic_shoe:
Home Page: http://www.vim.org/scripts/script.php?script_id=4809
License: MIT License
If a file does not have a newline at the end, matches on the last line are not highlighted.
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.
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.
if user maps sneak to f
, don't make them let g:sneak#nextprev_f = 0
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
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
Need to see whether this setting needs to be accounted-for.
let sel_save = &selection
let &selection = "inclusive"
see :help g@
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!
optional netrw mapping (instead of netrw's "sort")
Hey justin,
I am using the "ignore-case" option, but when typing fsn
only the sn
characters get highlighted, not Sn
or SN
Best regards
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:
see also: easymotion/vim-easymotion#60
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
sneak.vim doesn't respect the keymap option. Vanilla f
and t
do respect it. To reproduce:
:set keymap=bulgarian-phonetic
(or any other non-english keymap, I guess)абв
(no english letters)fb
goes to letter б
(б
is entered with key b
) -- this is expected, just shows that f
respects the keymapfbw
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!
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.
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.
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.
handle case where hi Cursor
=> "cleared"
currently only off-screen matches above/below the window are discounted, but matches left/right of the window still invoke streak-mode.
when start vim, ;
can't repeat f
only after I used s
, then ;
worked for f
again.
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!
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:
Would this be possible? Maybe crib from clever-f?
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.
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?
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.
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.
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:
vtl
for example to select until the letter l.Let me know if I can provide any additional information.
abcde abcde abcde abcde
abcde abcde abcde abcde
abcde abcde abcde abcde
fe;;
sbc;;
fe;;
;
goes to bc
instead of e
This kind of works, but it doesn't support repeat:
onoremap f :Sneak! 1<cr>
onoremap F :SneakBackward! 1<cr>
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
Occasionally sneak may add to the jumplist on repeat-motion.
see also: http://www.reddit.com/r/vim/comments/1o9xwq/sneakvim_vertical_motion_for_vim_solved/ccr4dfp
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?)
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 ;
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.
Document g:sneak#target_labels
and add it to the s:opt
dictionary.
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
Some guy on reddit asked for compatibility with vim-space - but wanted to preserve his irl identity 👍 So I'm asking this to save his anonymity.
The vertical scope highlight block and the matches are calculated by the actual text, not the visible ("virtual") columns.
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
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.
.
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.
operator-pending mode should not wrap around the buffer
something related to dynamically unmapping and/or feedkeys() appears to break macros that use f
or t
after invoking sneak.
detect if surround is installed and add operator support for surround
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.
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. :)
But they should.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.