2

I would like to know is it possible (and if yes-how) to switch "profiles" in Neovim: lets say I want to use Neovim for Python - in that case I "activate" some plugins, but when I want to switch to C++ I "activate" another set of plugins. Ideally, I would be able to reload/restart Neovim automatically. Also, there are "common" plugins always active.

I guess, it can be done with symlinks but not sure where to keep "pool" of available plugins. My targets are Linux and macOS.

EDIT: There are no conflicting plugins involved - I would just like to avoid having way too much plugins active at the same time. Main reason actually is that I plan having separate C++ setups: one for work (that uses SVN) and another for my personal projects (GIT).

7
  • 1
    You're probably looking for :help filetype-plugin. Read the documentation (and the referenced help pages) and edit your question when you run into problems.
    – Friedrich
    Commented Oct 1 at 5:55
  • 2
    Could you tell us what are the plugin that are conflicting? Could you elaborate and give us example of plugin that you would like to silent and for what reason. It would help us to propose solutions. Commented Oct 1 at 11:44
  • 1
    @VivianDeSmedt updated question - paragraph added
    – nikoladsp
    Commented Oct 2 at 7:24
  • Do you mean that you would like to have different configuration of the same plugin depending of the project that you are working on. Could you be more specific about the configuration changes (there are some builtin functionalities for some settings that could match your needs). Commented Oct 2 at 10:01
  • 1
    @VivianDeSmedt tbh I am just started reading/trying neovim. I have two major OS to target for "IDE": MACOS and Gentoo Linux, both over SSH. VSCode is horrible but i have to use it atm - its reference search is a disaster on large code base. Primarily I need strong reference/occurrence search. Secondary is switching between GIT/SVN and third one is possibility to customize e.g spaces (2,3 or 4 TABS)
    – nikoladsp
    Commented Oct 2 at 15:48

1 Answer 1

1

Reference Searching

For reference searching I understand that the need is the same for both environments (macOS, Linux).

There are different solutions:

  1. Use a LSP server and an LSP bridge (e.g. coc.nvim)
  2. Use the Vim tag commands (e.g.: :tselect, :tag) that make use of the ctag command.
  3. Use a flavor of grep (e.g. the builtin :vimgrep or the bridge to the :grep command or a Vim plugin like CtrlSF that provides additional supports to rename the references)

The first solution is clearly the more modern and the more accurate. On very large projects it can be relatively slow. I sometime still use the 'legacy' one.

Source Control Integration

You could use the command line operation within Vim with the :!{cmd} that will let you do your source control operation within Vim.

For Git there are numerous plugins to help you in particular the vim-fugitive of Tim Pop.

For Subversion there is the svnj.vim plugin that is quite old (and with which I don't have experience) or his vc.vim successor.

Space tab control

For project specific ways to control indentation (tab vs. space) a common solution is to use the now builtin editorconfig-vim plugin.

With this plugin you can control the way Vim manage the indentation by having a .editorconfig file at the root of your project where the way each language file should be indented.

e.g.: .editorconfig

[*.py]
indent_style = space
indent_size = 4
[*.cpp]
indent_style = tab

Remark: With Vim 9.1 you could just add the packadd! editorconfig instruction in your vimrc file to have the plugin activated.

2
  • How can I auto-restart neovim from neovim? Is this possible (I am planning some lua configuration on the fly)?
    – nikoladsp
    Commented Oct 2 at 16:34
  • I would avoid restarting Neovim from Neovim :-| But if you tell us what kind of lua configuration you are planning to have there could be ways to switch from one type of settings to another without restarting Neovim. Commented Oct 2 at 16:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.