magidc / nvim-config

My config for Neovim
81 stars 17 forks source link

can you add File structure code and problem in autocomplete list in neovim #9

Open zicotito2 opened 7 months ago

zicotito2 commented 7 months ago

As you can see in the side screen on the right image

magidc commented 7 months ago

Try space+v+s (View Structure) This will toggle Aerial plugin that does exactly what you want imaxe Also, try space+c+x for a quick navigation on file methods

zicotito2 commented 7 months ago

thanks you for answer sorry i have another questions..

When I write code, the autocomplete list appears

image

When I press tab, it sometimes works and enters the autocomplete list, and sometimes it does not, and it performs two forward spaces. What is the solution to this problem?

https://github.com/magidc/nvim-config/assets/154818059/d67b03cf-3715-493a-b9bd-f05c289dc216

Thank you again. Indeed, your repo is the best after the experience of others

magidc commented 7 months ago

Hi, I am glad to know that you like my configuration :) Regarding the issue of the autocompletion, you caught me with this one. I have notice it some times but I did not manage to find the cause as it is hard to reproduce. I will work on it and will let you know.

magidc commented 7 months ago

On the other hand, nowadays I use Neovim mostly for Rust and for editing configuration files in other languages. For java I switched to Intellij because it is much more capable when comes to refactoring and other features. The key of the efficiency of Vim is to get used to the motions, undertanstanding the text objects, and the philosophy of defining key shortcuts for frequent actions, the effort to get used to it will pay off. Having said this, if by any reason you need to switch to Intellij or VSCode, I have mappings for them that are almost identical to the ones in Neovim. You just need to install Vim plugins (Ideavim for Intellij, Vim plugin for Vscode) and you will have almost the same experience as Neovim (finding in files, debug, edtions, views...). You can find them here: IdeaVim and VsCode Vim

magidc commented 6 months ago

Hi, I suspect that the issue with autocompletion is related with copilot plugin. If you are not using it please remove it from the config and give me feedback is the problem is gone. Thx!

zicotito2 commented 6 months ago

But I didn't actually use the copilot plugin and it was deleted

I think the problem is in the cmp.lua file when modifying TAB

 ["<TAB>"] = cmp.mapping(function(fallback)

For example

 ["<A-x>"] = cmp.mapping(function(fallback)

Here, complete works when you press alt + x But I think keymap like alt + x is not the best shortcut

Can you make two keymaps, for example, tab and another shortcut for example ( <C-n> ) ?

thanks ♥

ahmedna126 commented 6 months ago

Can you make two keymaps, for example, tab and another shortcut for example ( <C-n> ) ?

You can make it like this

        ['<C-n>'] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Insert }),
    ["<TAB>"] = cmp.mapping(function(fallback)
magidc commented 6 months ago

Take a look to the last changes. I really think the TAB issue is related with Copilot integration. I have added a plugin to integrate Copilot with exiting completion system (nvim-cmp). It works adding Copilot as one of its sources from completion together with LSP, snippets, buffer texts... Whether you have Copilot account or not it should work better now as there it not conflict in the usage of TAB key. Take a look and tell me if the problem is gone

zicotito2 commented 5 months ago

Hello Unfortunately the problem still exists

https://github.com/magidc/nvim-config/assets/154818059/5659b05e-e50c-496f-8196-cb124d4bf6d9

But I noticed another thing that tab initially does not work, but when I press ALT +x it will work Notice that I added

     ['<Alt-X>'] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Insert }),

https://github.com/magidc/nvim-config/assets/154818059/f849648c-4cca-4bc8-b49f-5736afce2242

Thank you for your interest♥

magidc commented 1 month ago

Hi, it's me again claiming that Tab issue is solved. The plugin that enables the auto completion menu was configured to use Tab and Alt Tab to navigate through options. The behavior of the tab button was defined in the config of this plugin (nvim-cmp). The logic behind it could cause conflicts with other use cases of Tab, therefore problems may occur. As you can also navigate the auto completion menu with control n/p, or just using arrows like in most of IDEs, the most pragmatic thing to do was to remove it. Apart from the normal use of Tab, it is also used for navigation through snippets fields and Copilot (if you have it). Please give me feedback if the issue occurs again. Thx