How can I search a fuzzy order in CtrlP - vim

In other editors like sublime, if I search for usermodel it will match the path of models/users.ex, however in CtrlP if I do the same query it will fail. I have to remember to search the path modeluser to make the match.
Is there a way to tweak this so that usermodel or user model would match? I've read the docs and don't see a way but i'm new to it and am not sure if i'm just missing something.

AFAIK CtrlP can't do it but you can try writing your custom matcher (see an example here).
There is also Unite with similar functionality which allows to separate multiple patterns with space to narrow down the candidates. This way user model will match anything containing these two words in any order.

I ended up switching to emacs (spacemacs) with evil mode (gasp) for the improved Elixir support and i'm able to fuzzy search out of order with Helm.

Related

How to make vim show search result list dynamically while :tj SomeSymbol is being typing?

all. I know after generating a tag file, when I use :tj SomeSymbol, I can either jump to the expected location when SomeSymbol is unique within the project, or be given a list to choose. But I want more convenient way.
When I'm typing :tj SomeSymbol, I wish there's a popup menu showing all possible locations as if vim was searching the tag file for the expected symbol. In this way I can choose quickly and conveniently.
The final effect I want may be like what qtcreator gives:
So is there any way to do this ?
There is nothing built-in. Vim's completion popup menu currently can only be used for selecting candidate matches to be inserted into the text; it's not a general-purpose selector / filter. For tags, Vim only offers the selection by number as in the :tselect / :tjump commands. However, some plugins have implemented custom filtering (often in combination with fuzzy matching for easy drill-down into the candidate lists). I still use FuzzyFinder, which (though unmaintained for quite some time) offers (among others) a :FufTag command that lets you interactively select from tag matches.

Is there a one-liner to tell vim/ctags autocompletion to search from the middle of a word?

In vim (in Insert mode, after running exuberant ctags), I am using ctrl-x followed by ctrl-] to bring up a dropdown of various possible words/tokens. It's a great feature.
The problem is that by default, this list starts with a bunch of numeric options and automatically inserts the first numeric option, and if I backspace to get rid of the numbers and start typing a part of a word fresh -- with the idea of searching from the middle of the word -- the autocompletion behavior exits entirely.
I know I could type the first letter of the word that I want, then go from there. But that assumes that I know the first letter of the word, which is not necessarily a given.
For example, if I'm working on a pair-programming project with a friend during a long weekend, I might not remember at any given moment whether he called his method promoteRecordStatus(), updateRecordStatus() or boostRecordStatus(). In this example, I would like to type RecordStatus and get the relevant result, which does not seem to be possible at a glance with the current behavior.
So with that scenario in mind: Is there a simple, vim-native way to tell the editor to start its autocompletion without any assumptions, then search all available tokens for my typed string in all parts of each token?
I will of course consider plugin suggestions helpful, but I would prefer a short, vim-native answer that doesn't require any plugins if possible. Ideally, the configuration could be set using just a line or two.
The built-in completions all require a match at the starting position. In some cases, you could drop separator characters from the 'iskeyword' option (e.g. in Vimscript, drop # to be able to complete individual components from foo#bar#BazFunction()), but this won't work for camelCaseWords at all.
Custom :help complete-functions can implement any completion search, though. To be based on the tags database, it would have to use taglist() as a source, and filter according to the completion base entered before triggering the completion. If you do not anchor this pattern match at the beginning, you have your desired completion.

Vim: How to search for more than one word in the same search?

Is it possible to search within vim for more than one word?
For example:
Let's say i'm inside vim and I press / in order to start a search for a certain word, is it possible to search for more than one word in the same search?
Yes, you can have several branches in a search pattern:
/foo\|bar
See :help \|.
Use the OR operator
/first\|second
If you do this often, my SearchAlternatives plugin may be useful to you.
The plugin provides mappings and commands to add and subtract alternative
branches to the current search pattern. Currently searching for "foo", but
also want to find matches for "bar"? You could type /foo\|bar<CR> or
/<C-R>/\|bar<CR>, but once you want to limit the search to whole \<words\>
(like the * command), and juggle several alternatives, adding and
dropping them as you search, this plugin is quicker than manually editing the
search command-line (which you can still do).

Google-like search info for Emacs

Is there a package/function to search info pages from emacs similarly to web search? I mean you just give few words, and the emacs returns you all the pages with these words. The words can be in any order, maybe use fuzzy match etc., regexp does not help a lot in this case. The similar question is discussed in http://www.emacswiki.org/emacs/SearchNear but I'm not satisfied with the solution. Does anybody know more general software?
Ideally, such kind of search should handle not only info pages, but any source, for example all open buffers.
I think that you may be looking for info-apropos which you can call with M-x info-apropos. This performs a full-text search of the info files and returns a hyperlink list of sections containing the word.
I don't think that it does multiple words like a search engine, but it may get you started.
Anything.el has a configuration for searching Info pages. It's called anything-c-info-pages and looks like it searches for info topics, so it's not exactly what you want, but if you know elisp then you can copy this source and easily modify it to perform full text search instead.
If you don't know Anything then here's an introduction and an other one about creating your own sources for it.
For a more powerful and flexible alternative see Emacs Anything. To fetch it do
git clone git://repo.or.cz/anything-config.git ~/anything-config
in your terminal. Then add the following code snippet to your Emacs configuration file ~/.emacs:
(byte-recompile-directory "~/anything-config")
(add-to-list 'load-path "~/anything-config" t)
(load "~/anything-config/anything.elc")
(load "~/anything-config/anything-config.elc")
Finally run it using M-x anything.
I prefer to bind it to Alt-X by adding the following line to ~/.emacs.:
(global-set-key (kbd "M-X") 'anything)

Preprocessing a word before spell checking in Vim

I use Vim's spell checking to validate texts in Russian. We have letter ё in our alphabet which is often replaced with simple е. So, for example, word ёжик из written as ежик. It is a bad tone actually. Its like using - (hyphen) where — (em-dash) is required, like using "computer" quotes forgetting about existence of „typographic” «quotes», etc.
The bad thing is that spell dictionary for Vim composed out of simplified words with all ёs, replaced with еs. So I always get an error in a word with ё.
So the question, is there any hook I can use that will allow me to normalize a word just before it will be spell checked? Or maybe someone has a better idea? Thanks.
UPDATE
With the hint from #sarnold, I found the solution. One should use ru_yo locale instead of ru_ru if he wants ёёёёё
My first thought when reading your post was to suggest using zg to add the word to the spellfile; after a few weeks you'll have a lot of them. Not ideal, but simple.
:help spell-russian lists several different spelling variations, would one of these help?
I also notice in :help spell.txt that there are options for downloading your own spellfiles from OpenOffice or http://www.a-a-p.org to automate building spellfiles.
I would recommend you to use your own spell checking for vim. Use a method #2 explained here

Resources