GithubHelp home page GithubHelp logo

vim-notableft's Introduction

vim-NotableFt

This plugin changes the behaviour of the f, F, t, T, ; and , commands to only match on characters that are considered 'notable'. This includes:

  • The 'humps' of camel case words
  • The beginning and end of words
  • Any non-word characters like . , : ( !

Note that these rules only apply when the given search character is lower case. This is because while this behaviour is what you want almost all the time, sometimes you still want to be able to search for characters that are not 'notable'. You can do this using upper case search.

For example, given this line:

this is a test line

With your cursor at the beginning, if you search fi, your cursor will move to the word 'is' (^ represents cursor)

this ^s a test line

Whereas, if you search fI instead, your cursor will move to:

th^s is a test line

This plugin also adds the following behaviour:

  • Multiline - Can search across multiple lines or continue searching across multiple lines using ; and , keys
  • Highlighting - Highlights all matching characters on current line, previous matching line, and next matching line
  • Allows repeating t and T commands using ; or , commands
  • Changes the way t and T repeat to be consistent. If you start with t, then repeat with ;, then go back with ,, you'll be at the same place (which is not the case with normal vim)

It's also worth noting that it only adds the new position to the jumplist if you've changed lines

Search Direction

By default, NotableFt will preserve Vim's behaviour of searching left-to-right with ; after using f, and searching right-to-left with ; when using t. However, it also includes an alternative approach, which uses fixed directions for the ; and , keys. So if that's something you want to use instead, you can enable it by including the following in your .vimrc:

let g:NotableFtUseFixedDirection = 1

In other words, when this option is enabled, the ; key will always go left-to-right, and the , key will always go right-to-left.

Key Customization

If you have remapped any of the f/F/t/T/;/, keys you can still use the plugin without changing it, by including the following in your .vimrc:

let g:NotableFtUseDefaults = 0

With this set, NotableFT will not remap anything. You can then remap whatever keys you want to the following <plug>NotableFt mappings:

<plug>NotableFtRepeatSearchForward
<plug>NotableFtRepeatSearchBackward
<plug>NotableFtSearchFForward
<plug>NotableFtSearchFBackward
<plug>NotableFtSearchTForward
<plug>NotableFtSearchTBackward

See the file NotableFt.vim for an example of how to map to these.

vim-notableft's People

Contributors

bitdeli-chef avatar svermeulen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

jonohrt

vim-notableft's Issues

Behavior of ; after F or T

I'm really liking this plugin ... the only thing I'm having trouble adjusting to is the behavior of ; after hitting F or T. Following the native behavior of Vim, it seems like ; should move to the next match backwards instead of the next match forward after hitting F or T.

Thanks for sharing this plugin with the community.

Don't hijack the search

Using this plugin replaces my current search query and turns on search highlighting when I use it. The user's search settings shouldn't be modified during the use of this plugin.

Add flag to disable multi line mode, and disable by default

It's jarring to hit fi and then lose my cursor as it jumps down 20 lines unexpectedly. If there's no match on the current line, by default, the cursor shouldn't be moved. I think that multiline search would make more sense as an opt-in behavior.

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.