Note that there are some explanatory texts on larger screens.

plurals
  1. POinternal code-completion in vim
    primarykey
    data
    text
    <p>There's a completion type that isn't listed in the vim help files (notably: insert.txt), but which I instinctively feel the need for rather often. Let's say I have the words "Awesome" and "SuperCrazyAwesome" in my file. I find an instance of Awesome that should really be SuperCrazyAwesome, so I hop to the beginning of the word, enter insert mode, and then must type "SuperCrazy".</p> <p>I feel I should be able to type "S", creating "SCrazy", and then simply hit a completion hotkey or two to have it find what's to the left of the cursor ("S"), what's to the right ("Crazy"), regex this against all words in the file ("/S\w*Crazy/"), and provide me with a completion popup menu of choices, or just do the replace if there's only one match.</p> <p>I'd like to use the actual completion system for this. There exists a "user defined" completion which uses a function, and has a good example in the helps for replacing from a given list. However, I can't seem to track down many particulars that I'd need to make this happen, including:</p> <ol> <li>How do I get a list of all words in the file from a vim function?</li> <li>Can I list words from all buffers (with filenames), as vim's complete does?</li> <li>How do I, in insert mode, get the text in the word before/after the cursor?</li> <li>Can completion replace the entire word, and not just up to the cursor?</li> </ol> <p>I've been at this for a couple of hours now. I keep hitting dead ends, like <a href="https://stackoverflow.com/questions/1228100/substituting-zero-width-match-in-vim-script">this one</a>, which introduced me to \%# for matching with the cursor position, which doesn't seem to work for me. For instance, a search for \w*\%# returns only the first character of the word I'm on, regardless of where I'm in it. The \%# doesn't seem to anchor.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload