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

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.

Related

How to autocomplete in vim based off partial matching via ctags

Example:
In a file in another directory I have a function defined by the following:
def _generator_function_1(self):
passs
In the file of my current directory, I have typed the following:
def test_generI
where I denotes my cursor position.
I would like to use vim's autocompletion functionality (i.e. via ^n or ^p) to autocomplete the function definition to test_generator_function_1. Is there a way of configuring vim autocompletion to match not based off full-prefixes? Or, is there a way in ctags to generate tags based off keywords instead of full function definitions?
EDIT:
To clarify, I am specifically wondering if keyword-based autocompletion exists. I have autocompletion by tags setting up, so if I typed "_gen", then ^n would complete to give me "_generator_function_1". In my example, however, it is because the string is prefixed by "test" that "test_gener" as the starting typed word does not lead to any autocomplete suggestions. So I am wondering if this can somehow be made possible.
Vim doesn't have "autocompletion functionality". It only has "completion", not "autocompletion". You need a plugin for "autocompletion".
No, there's no way to obtain your desired behavior without some serious vimscripting. See :help complete-functions.

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.

Emacs org-mode: search visible content only, not collapsed?

In Emacs org-mode, I sometimes do sparse tree searches to list only headlines that match a tag.
I would like to be able to search only what is currently visible (matching headlines), not the whole buffer as does Isearch. Is this possible natively or via some package?
Edit:
As per comment, answered in: Make isearch skip folded content in org-mode
Search behavior can be customized using the search-invisible variable, or toggled via M-s i during a search.

Vim Autocomplete Menu Format

When I'm using Autocompletion in Vim, it doesn't just show the words, it shows information to the right of it:
For me it's not important where the matches are coming from (in this case, it's the path to the dictionary file). As you can see, the paths form a block of text that really distracts from the matches...Is there a way to just show the matching words?
I'm using Vim's builtin complete features, no YCM/neocomplcache/...
I'm not aware of any way to turn that off, other than completely turning off the completion popup menu with :set completeopt-=menu; this will insert one candidate after the other on <C-N>, so you're losing the overview altogether.
When you're writing a custom completion (see :help complete-functions), you can influence / suppress the additional information; it's the menu attribute of the returned match objects. So you could in theory re-implement the dictionary completion in Vimscript, but I'd advise against that, because it will be cumbersome and probably also much slower.
So, unless you have a lot of energy to write and submit a patch (e.g. a new option to turn that off, or restrict to a certain length), it's best to accept this as a fact and learn to focus on the first column.

How to merge completion candidates for vim?

I often rely on omni-completion to edit source codes, so my current .vimrc contains following setting to gain quick access to intended candidates:
inoremap <C-f> <C-x><C-o>
Now I find there are many kinds of ins-completions except for omni-completion and become interested to use both tags and file names completions too.
1. Whole lines i_CTRL-X_CTRL-L
2. keywords in the current file i_CTRL-X_CTRL-N
3. keywords in 'dictionary' i_CTRL-X_CTRL-K
4. keywords in 'thesaurus', thesaurus-style i_CTRL-X_CTRL-T
5. keywords in the current and included files i_CTRL-X_CTRL-I
6. tags i_CTRL-X_CTRL-]
7. file names i_CTRL-X_CTRL-F
8. definitions or macros i_CTRL-X_CTRL-D
9. Vim command-line i_CTRL-X_CTRL-V
10. User defined completion i_CTRL-X_CTRL-U
11. omni completion i_CTRL-X_CTRL-O
12. Spelling suggestions i_CTRL-X_s
13. keywords in 'complete' i_CTRL-N*emphasized text*
The question is, how can I list up whole candidates from these specific completion sources on a ins-complete-menu with single command, <C-f>.
Use the default completion (CTRL-N / CTRL-P); its completion sources can be configured via the 'complete' option. Unfortunately, from your list, only tags (not file names) can be (and is by default) included in there. (But don't you know beforehand that you want file completion? I particularly like the many different completion commands because they narrow down the result list, which for me is far more valuable than not having to think about which completion to invoke.)
If you really want an all-encompassing completion, you'd have to implement that yourself as a user-completion, and you'd have to re-implement all the built-in sources, as there currently is no way to programmatically get them.
You should check the plugin neocomplcache. It can acomplish this but the setting may not be trivial.

Resources