Comments (24)
This is related to completeopt
managed by this plugin
I don't have a neat workaround, but this might help:
inoremap <C-X><C-N> <C-X><C-N><C-N>
from nvim-completion-manager.
Maybe I could implement an auto popup completion source wiht this sort of behavior
from nvim-completion-manager.
Thanks. That's a pretty straightforward workaround. I'll give it a try. A completion source that had this sort of behavior would be even more awesome, and would be an improvement on vim's default behavior. The most awesome improvement, though, and I don't even know if this could be implemented, would be to allow this sort of ‘continue completing’ behavior with any source. You would be able, for instance, to complete a word from another tmux window, then keep copying the following words from the other tmux window with (or whatever mapping).
from nvim-completion-manager.
Just a quick update: for some reason, inoremap <C-X><C-N> <C-X><C-N><C-N>
doesn't do what we thought it would.
from nvim-completion-manager.
Hi, I've added a source for this.
Pick a key to map to <Plug>(cm_force_refresh)
imap <c-g> <Plug>(cm_force_refresh)
I also have tab mapping
" smart tab for auto complete
inoremap <expr> <silent> <Tab> pumvisible()?"\<C-n>":"\<TAB>"
inoremap <expr> <silent> <S-TAB> pumvisible()?"\<C-p>":"\<S-TAB>"
<Tab>
for selecting the popup item, <c-g>
for refreshing the popup menu. So the key pressed in this screencast is <TAB><c-g><TAB><c-g>...
from nvim-completion-manager.
This is awesome! But it's unfortunately not working here.
I am running the latest dev version of neovim. My .config/nvim
folder only contains the folders from nvim-completion-manager
and the following minimal init.vim
:
inoremap <expr> <silent> <Tab> pumvisible()?"\<C-n>":"\<TAB>"
inoremap <expr> <silent> <S-TAB> pumvisible()?"\<C-p>":"\<S-TAB>"
imap <c-g> <Plug>(cm_force_refresh)
In a buffer like the following (cursor is |)
something I would like to tell you gentlemen
some|
I get the popup, in pink, then press <tab>
to complete some
into something
, which works, and makes the popup gray, and then I press <c-g>
, but instead of getting the expected result, the only thing that happens is that the popup menu, still only containing the word something
, changes color back pink. Keeping pressing <tab>
and <c-g>
will only keep changing the popup menu from gray to pink to gray to pink and so on.
Do you have any idea of what might be going on?
from nvim-completion-manager.
Try press a space, then <c-g>
to force display of popup menu.
Your first popup comes from keyword of current buffer completion source.
The completion source added for this will be auto triggered after three mached word, then a space character.
Or a single matched word, a space character, then <Plug>(cm_force_refresh)
to force update.
It does not popup for a part of word without previous matched word, which does not make much sense, IMO.
from nvim-completion-manager.
<Plug>(cm_force_refresh)
is not necessary for the auto triggered popup.
I've just pushed some refinement on the popup item, so it should look better.
from nvim-completion-manager.
I think It would be more convinent to have popup for the rest of line like this:
from nvim-completion-manager.
Oh, I see. I wasn't typing <space>
between completing the first word and typing <c-g>
. Thanks once more for sharing this plugin and putting together this source.
from nvim-completion-manager.
This completion source lacks one feature of vanilla <c-x><c-n>
completion, namely, the ability to undestand other non-word characters besides <space>
Using vanilla vim, if my text is as follows (|
is the cursor)
\tikzset{frontier/.style=\bold}
\tik|
I can <c-p><c-x><c-p><c-x><c-p><c-x><c-p><c-x><c-p>
and get
\tikzset{frontier/.style=\bold}
\tikzset{frontier/.style=\bold}|
That is, the vanilla <c-x><c-n>
completion mechanism understands {
, /
, =
and so on as whitespace characters.
from nvim-completion-manager.
@rafaeln
I've pushed an update.
By the way, there's difference between vim's builtin <c-p><c-x><c-p>
and this completion source that I'm not gonna fix.
The builtin key is usually typed at the end of a word, and then the completions completes the next non-word sequence, and the next word.
But the source added here is usually triggered at the beginning of a word, then it completes the word, and the next non-word sequence. IMO, it's more consistent among NCM sources with this behavior.
from nvim-completion-manager.
I actually suspect that NCM's multi-word completion source is an improvement on vanilla vim's <c-x><c-p>
completion mode. Indeed, very often, when I'm using the vanilla feature to complete only the beginning of some code, after I'm done <c-x><c-p>
'ing, I end up having the press <c-w>
once in order to delete the last word vim added and keep only the last whitespace character it added. Using NCM's multi-word completion source, that last step won't be required.
from nvim-completion-manager.
This last commit introduced a bug, though. The picture below shows what it is.
from nvim-completion-manager.
Sorry on that, I've pushed a new fix.
from nvim-completion-manager.
This fixed it!
from nvim-completion-manager.
Just an update, I disabled the auto popup of this feature by default, since the current implementation scans all openning buffer, at every completion calculation.
And the auto popup after 3 previous matching word seems not appropriate for programming languages.
This setting could be overrided, :help cm_sources_override
and the auto_popup
option of the source.
This change does not affect the behavior of <Plug>(cm_force_refresh)
from nvim-completion-manager.
Cool. So, talking about multi-word completion, let me report an inconsistency in behavior.
If in a line the last character before \n
is a non-space non-word characters, such as }
, multi-word completion wraps into the next line (which is also how vanilla vim's multi-word completion behaves). It the last characters before \n is a word character, multi-word completion is restricted to that single line.
Try it on this file:
something they would like to tell you gentlemen
\tikzset{every node/.style=\it}
something they would like to tell you gentlemen}
\tikzset{every node/.style=\it}
from nvim-completion-manager.
This is duplication filtering behavior of current implementation, it simply filters the duplicated word
, which is they
in this case. Normally the highest rank won't be filtered, which is determined by the number of previous match, but here, the two lines have the same rank.
If I change the line order into this, the }
will be completed.
something they would like to tell you gentlemen}
\tikzset{every node/.style=\it}
something they would like to tell you gentlemen
\tikzset{every node/.style=\it}
from nvim-completion-manager.
I think I didn't explain well. Let me try again.
If you have the text (|
is cursor)
something they would like to tell you gentlemen
\tikzset{every node/.style=\it}
other things
something they would like to tell you gentlemen|
And you press <c-g>
, you don't get any more suggestions, because you hit the end of the line.
But if you have the text (|
is cursor)
something they would like to tell you gentlemen
\tikzset{every node/.style=\it}
other things
\tikzset{every node/.style=\it}|
And you press <c-g>
, you get other
, from the next line down:
something they would like to tell you gentlemen
\tikzset{every node/.style=\it}
other things
\tikzset{every node/.style=\it}other|
from nvim-completion-manager.
Now I understand what you mean.
This is kind of intended, becasuse I'm not sure how to refine it to a more proper behavior.
I need some advice.
By the way, It seems impossible for completion result to expand to the next line.
from nvim-completion-manager.
It's not really a bug. It's just inconsistent. I rarely find it useful to wrap completion into the next line, the default vim multi-word completion behavior. But sometimes it's useful. Like if you're completing into a multi-word expression, such as in the example below:
Given the context of the international solidarity
movement, I would state that ...
...
The international|
Where <c-x><c-p><c-x><c-p><c-x><c-p>
would give you
Given the context of the international solidarity
movement, I would state that ...
...
The international solidarity movement|
This kind of line-wrapping completion is possible with vanilla vim multi-word completion, but it isn't possible with NCM's multi-word completion source.
from nvim-completion-manager.
A snippet engine like would be able to expand multiple lines. See this feature supported recently, #36
It is possible, to make the completion item expandable (snippet)
When ultisnips is triggered, it expands the whole line, then jump to the next line.
something they would like to tell you gentlemen
\tikzset{every node/.style=\it}
other things
something they |
press <c-g>
for completion:
something they would like to tell you gentlemen
\tikzset{every node/.style=\it}
other things
something they would|
press ultisnips expand trigger:
something they would like to tell you gentlemen
\tikzset{every node/.style=\it}
other things
something they would like to tell you gentlemen
|
But this does not solve the inconsistent. Since the behavior of <c-g>
is still the same.
from nvim-completion-manager.
I wasn't aware ultisnips was that flexible. I'll go read the documentation. I don't think the inconsistency is a real issue. There's always the workaround of resorting to vim's vanilla multiword completion mechanism whenever the rare occasion arises where I'd like to complete to wrap into the next line.
from nvim-completion-manager.
Related Issues (20)
- Quick question: Using tab to expand whatever is selected in popup menu
- Add support for .tex // Doesn't work for snippets in .tex files HOT 3
- does not autocomplete with some tags
- [Question] Is there somewhere a list of sources defined? HOT 8
- COBOL support HOT 1
- UltiSnips in VISUAL
- Don't show autocompletion popup after navigation keystrokes HOT 20
- how to directly autocompletion when I typed <cr> HOT 1
- Support ‘smart’ filtering of autocomplete suggestons HOT 1
- Overwriting priority for a built-in completer HOT 2
- get “nvim-completion-manager core channel terminated.” everytime i edit a file in terminal env. HOT 7
- c key switches straight into insert mode HOT 3
- very high CPU rate HOT 3
- Disable a source when another is active HOT 2
- Completion not working anymore when using cquery
- Parameter expansion with ultisnips disables semantic clang completion
- How to customize python path for jedi complemention? HOT 1
- Completion shows part of the snippet HOT 1
- Word pattern for "Word from current buffer"
- Error in logger on startup HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nvim-completion-manager.