https://github.com/svermeulen/vim-notableft
https://github.com/svermeulen/vim-notableft
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/svermeulen/vim-notableft
- Owner: svermeulen
- Created: 2016-01-06T20:39:37.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2022-01-09T01:21:45.000Z (over 3 years ago)
- Last Synced: 2025-02-26T22:08:43.121Z (3 months ago)
- Language: Vim script
- Size: 84 KB
- Stars: 29
- Watchers: 4
- Forks: 1
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
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 `NotableFt` mappings:
NotableFtRepeatSearchForward
NotableFtRepeatSearchBackward
NotableFtSearchFForward
NotableFtSearchFBackward
NotableFtSearchTForward
NotableFtSearchTBackwardSee the file `NotableFt.vim` for an example of how to map to these.