Git Product home page Git Product logo

clever-f.vim's Introduction

clever-f.vim

Build Status

clever-f.vim extends f, F, t and T mappings for more convenience. Instead of ;, f is available to repeat after you type f{char} or F{char}. F after f{char} and F{char} is also available to undo a jump. t{char} and T{char} are ditto. This extension makes a repeat easier and makes you forget the existence of ;. You can use ; for other key mapping. In addition, this extension provides many convenient features like target character highlighting, smart case matching and so on. If you want to reset the searching character without moving cursor, map <Plug>(clever-f-reset) to your favorite key. At last, you can customize the behavior of the mappings and features.

USAGE

Screen shot

I'll show some examples of usage. _ is the place of cursor, -> is a move of cursor, alphabets above -> is input by keyboard. Note that this is a part of clever-f.vim's features.

f

input:       fh         f         f      e         fo         f
move :  _---------->_------>_---------->_->_---------------->_->_
input:                            F                            F
move :                        _<-----------------------------_<-_
text :  hoge        huga    hoo         hugu                ponyo

f

F

input:        f        Fh       b     f                         Fo
move :  _<----------_<------_<-_<-----------------------------_<-_
input:        F        F          F
move :  _---------->_------>_----------->_
text :  hoge        huga    huyo         hugu                ponyo

F

t

input:       th         t         t      e         to         t
move :  _--------->_------>_---------->_-->_--------------->_->_
input:                            T                            T
move :                         _<-----------------------------__
text :  hoge        huga    hoo         hugu                ponyo

t

CUSTOMIZE

Search a character only in current line

g:clever_f_across_no_line controls to search a character across multi lines or not. Please set it to 1 in your vimrc to search a character only in current line.

Ignore case

g:clever_f_ignore_case controls to make a search case-insensitive or not. Please set it to 1 in your vimrc to ignore case.

Smart case

g:clever_f_smart_case controls make smart case or not. If and only if you type a lower case character, clever-f.vim ignores case. Please set it to 1 in your vimrc to make smart case

Target character highlighting in current line

clever-f.vim highlights the target character you input in current line. The highlight is cleared automatically when the search ends. If you want to change the highlight group, set your favorite highlight group to g:clever_f_mark_char_color.

Below is an example using ta in description of clever-f.vim.

highlight example

Here, ta searches a forward then matches the character before a and Ta searches a backward then matches the character after a. You can see the highlighted target is dynamically changed following the cursor's direction.

Timeout

You can specify the timeout for f, F, t and T mappings. If the interval of these mappings is greater than the one you specified, clever-f.vim resets its state to make you input a new character. This feature is disabled by default. If you want to use this feature, set g:clever_f_timeout_ms to proper value.

Repeat last input

<CR> is easy to type but usually it isn't input as the target character of search. So by default, when you input <CR> as {char}, the previous input is used instead of <CR>. For example, when you previously input fa and then input f<CR>, a will be used as input instead of <CR>. You can specify characters to use previous input by setting g:clever_f_repeat_last_char_inputs. Adding <Tab> may be handy.

Migemo support

In Japanese environment, it is convenient that fa matches ใ‚ in some cases. Originally, this feature is provided by migemo. clever-f can search multibyte Japanese character with f, 'F', 't' and 'T' key mappings. A cmigemo package is NOT required because clever-f includes regex patterns generated by migemo. Set clever_f_use_migemo to 1 to get migemo support.

Fix a direction of search

If you always want to search forward with f and always want to search backward with F, set g:clever_f_fix_key_direction to 1.

input:        F        Fh     b     F                         Fo
move :  _<----------_<------_<-_<-----------------------------_<-_
input:        f        f          f
move :  _---------->_------>_----------->_
text :  hoge        huga    huyo         hugu                ponyo

Show prompt

If you want to show a prompt when you input a character for clever-f, set g:clever_f_show_prompt to 1. The prompt is disposed after a character is input.

Match all signs with one char

Many sign({, (, ", and so on) keys are hard to press. If you want to match ; key to all signs, you can use g:clever_f_chars_match_any_signs. If you set it to ';', f; matches all signs.

input:   f;   f       f      f f       f       f
move :  _-->_--->_--------->_>_>_------------>_>_
text :  hoge.huga( autoloads: %w{ aaa bbb ccc } )

UNSTABLE VERSION

If you want to use the latest version, please use dev branch.

LICENSE

Distributed under MIT License. See doc/clever_f.txt

clever-f.vim's People

Contributors

rhysd avatar thinca avatar kadamski avatar elyscape avatar rbtnn avatar

Watchers

Swaroop avatar

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.