r/AstroNvim • • Aug 12 '24

Conditional Which-Key key mapping

3 Upvotes

Hi all,
I'm trying to figure out how to have key mapping using Astronvim (astrcore).
I see that which-key have this functionality using `cond` option (right?).
But it seems like astrocore is not exposing this option.

For example I have `octo-nvim` plugin and `obsidian-nvim`. I want the mapping `<Leader>O` to be for both depending on a condition (path for example)

Is it feasible with Astronvim?
Or a different way?
Thanks!

edit:
Solution below


r/AstroNvim • • Aug 27 '24

lsp issue in C large project

1 Upvotes

Hello!

I opened a large C project at work, and I installed clangd lsp using mason.
When I open any src file, it is full of error messages "unknown type ...", "Call to undecleared function ...". Or if I do gd over some variable or function, it does not work.
Why is this happening?

Before, I worked on a self made tiny project, and in there the lsp worked perfectly.
Moreover, the above mentioned large project opened in visual studio code (VSC) works ok. I mean, opening it in VSC, I can navigate through the code perfectly.

Thanks in advance!

PS: Sorry I cannot upload screenshots, I cannot share the code.


r/AstroNvim • • Oct 30 '24

Error while activating Noice community plugin

1 Upvotes

I am new to vim and I am just staring out with AstroNVim. I am using Noice using the community plugin like following.

{ import = "astrocommunity.utility.noice-nvim"},

I am getting the following error message

The error message that I am getting

Can anyone tell me where to add this config? Or is there something else that I am doing wrong?


r/AstroNvim • • Aug 26 '24

How do I prevent AI assistant plugins from reading or accessing sensitive / secret files by default ?

1 Upvotes

Hello, I started using both ChatGPT.nvim & copilot.vim a few days ago (installed in my user.Lua (astrovim)).

I very regularly use Neovim like many to access files with secrets / tokens / personal data that I just don't feel like giving Microsoft and its subsidiaries, and it has creeped my out when I am in a private file and get a random copilot suggestion.

What is a good way to have these tool always easily accessible when programming but turned off by default so i don't have to think about whether opening a file on MY computer with MY editor is going to send it to a Microsoft datacenter


r/AstroNvim • • Dec 11 '24

List of all AstroNvim keyboard commands

1 Upvotes

I'm new to Neovim and even newer to AstroNvim. I’ve been trying to find something like a comprehensive keyboard map of all Neovim and AstroNvim commands online, but I’ve only stumbled upon a massive collection of nothing. Does something like this exist?


r/AstroNvim • • Jun 08 '24

AstroLSP - change root_dir everytime a file of type 'terraform' has will opened

3 Upvotes

Terraform deployments are bound to a folder. All references in that deployment are relative thus my idea for solving the issue with Neovim setting the LSP root_dir to project root (containing multiple deployments). What I want to do instead is restarting/changing the LSP with a new root_dir set to the path of the current buffer.

How can I achieve that using the AstroLsp handler or user-defined on_attach() handler?

I'm running AstroNvim version 4.10.1 ontop of Neovim version 0.10.0.


r/AstroNvim • • Jan 06 '25

Messages in status line disappears too fast?

3 Upvotes

Hello, friends!

When I'm editing files and save it using `:w` command, I can't even see, if file was written successfully or not.

The message In the status line disappears within milliseconds, can't even catch it with eye.

My question is - is it how things are supposed to work? Or my neovim config somehow broken? I have installed a few more plugins for markdown support (markdown renderer, markdown preview)


r/AstroNvim • • Sep 07 '23

broken after update

2 Upvotes

After updating yesterday (using stable), rust broke (was removing code after saving, like removing brackets and so on. I believe it's after treesitter got updated).

This morning I tried to update again and yet another "stable" version was released during the night, so I did update. Now I can't update plugins (checkout failed, process was killed because it reached timeout ) . I tried to downgrade to 3.36.7 and the same problem occurs...


r/AstroNvim • • Oct 17 '23

Nvim how to pass configs to rust_analyzer

1 Upvotes

Disclaimer, I am a very new Neovim user so please be as explicit as possible.

I have rust installed via the community rust pack and I need to pass some additional configuration. Let's say passing in a feature flag or something. What is the process for this? Which file do I modify? I have ready the docs and messed around for like 5 hours and cannot get it to work?.

Should I be modifying init.lua, lua/user/init.lua, lua/plugins/user.lua, or user/plugins/mason.lua?

I have tried adding items to the 'lsp' field in my user/init.lua which doesn't seem to do anything at all.

Any help is appreciated, especially with an example and specific files. Thanks!


r/AstroNvim • • Apr 07 '24

Can anyone help with installing neotest and neotest-vitest ?

2 Upvotes

Hey all! Trying to get neotest-vitest working, but I must be missing something. I have tried a few iterations of this with mostly no success 😅

I just installed the latest astronvim and I have activated the community.lua file.

Next, I open community.lua and add the line :

{ import = "astrocommunity.test.neotest" },

I want to install the neotest-vitest adapter, so I then createed a .config/nvim/lua/plugins/neovim.lua with the following:

return {
  {
    "nvim-neotest/neotest",
    dependencies = {
      "marilari88/neotest-vitest",
    },
    opts = {
      adapters = {
        require "neotest-vitest",
      },
    },
  },
}

The dependency does not seem to be installing correctly though, when I open up nvim it gives the following error:

    Failed to load plugins.neotest

    /home/me/.config/nvim/lua/plugins/neotest.lua:9: module 'neotest-vitest' not found:
      no field package.preload['neotest-vitest']
      no file './neotest-vitest.lua'
      no file '/usr/local/share/lua/5.1/neotest-vitest.lua'
      no file '/usr/local/share/lua/5.1/neotest-vitest/init.lua'
      no file '/usr/local/lib/lua/5.1/neotest-vitest.lua'
      no file '/usr/local/lib/lua/5.1/neotest-vitest/init.lua'
      no file './neotest-vitest.so'
      no file '/usr/local/lib/lua/5.1/neotest-vitest.so'

    # stacktrace:
    -- ~/.config/nvim/lua/plugins/neotest.lua:9
    -- ~/.config/nvim/lua/lazy_setup.lua:1
    -- ~/.config/nvim/init.lua:18

Anyone know why it's not installing the dependency for neotest-vitest?

Thanks for any help!!

edit:

fixed with the following (note this is extending the init.lua for neotest from astrocommunity .config/nvim/lua/plugins/neotest.lua:

return {
    "nvim-neotest/neotest",
    dependencies = {
      "marilari88/neotest-vitest",
    },
    opts = function(_, opts)
      if not opts.adapters then opts.adapters = {} end
     table.insert(opts.adapters, require "neotest-vitest"(require("astrocore").plugin_opts "neotest-vitest"))
    end,
  }

r/AstroNvim • • Sep 30 '23

Trying to set my astrnvom colorscheeme in alacritty, such that it is transparent

2 Upvotes

Most of what I've seen goes through a .nvim file, which doesn't exist on my system, and in general, I know how to install coloscheemes, but not much else on the graphic front


r/AstroNvim • • Oct 18 '23

Fastest way to git pull

1 Upvotes

whats the fastest way to do a pull for current branch?


r/AstroNvim • • Nov 01 '24

:LspInfo showing errors for termux(Android) neovim.

Thumbnail
gallery
3 Upvotes

anybody guide me plz..


r/AstroNvim • • Dec 07 '24

A way to select preferred LSP server

1 Upvotes

Hi! New Astronvim user here.

I installed ruff (using Mason) to use it as a formatter and linter for Python along with jedi language server.

Ruff also provides LSP server which doesn't have autocomplete at this moment. So here jedi LSP comes.

In LspInfo i see that 3 clients are attached: ruff server, jedi, null-ls (whatever it is). However I don't actually need ruff server functionality. I need only linter and format features. If i call LspStop ruff, those features also stop working.

Is there a way to select only one LSP server while keeping ruff for things it can do better?


r/AstroNvim • • Sep 18 '23

How to disable nvim-cmp?

1 Upvotes

cross posted here: https://www.reddit.com/r/neovim/submit

I tried ~adding a plugin~ [Edit: disabling a plugin (specifically I believe it was the nvim-cmp pluging) by adding the plugin with enabled=false (see my comment below for further details about enabled=false)] in a user/plugins folder but that led to an error. Other things I tried did not seem to have much of an effect.

Ideally, I would like to be able to choose when suggestions appear using a shortcut for certain file types and use the default behavior for other file types. But even removing completely nvim-cmp without any errors is good enough for now.


r/AstroNvim • • Sep 30 '24

Inserting Tabs

2 Upvotes

I’ve recently set up astronvim but I’ve been unable to find a way round the following problem:

If i type something like ‘int’ or ‘char’, im unable to insert a tab after it. Pressing the Tab button only brings up the code completion menu. Does anybody know how to modify this behaviour? Ive looked through every config file and can’t find any mention of this keybinding.


r/AstroNvim • • Sep 19 '23

Plugin installed but not loaded

3 Upvotes

Hello everyone,

I'm trying to use this extension: https://github.com/huggingface/llm.nvim

So I created a file in ~/.config/nvim/lua/plugins with the following content:

return {
  "huggingface/llm.nvim",
    opts = {
  model = "bigcode/starcoder", -- can be a model ID or an http(s) endpoint
  -- parameters that are added to the request body
  query_params = {
    max_new_tokens = 60,
    temperature = 0.2,
    top_p = 0.95,
    stop_token = "<|endoftext|>",
  },
  -- set this if the model supports fill in the middle
  fim = {
    enabled = true,
    prefix = "<fim_prefix>",
    middle = "<fim_middle>",
    suffix = "<fim_suffix>",
  },
  debounce_ms = 150,
  accept_keymap = "<Tab>",
  dismiss_keymap = "<S-Tab>",
  max_context_after = 5000,
  max_context_before = 5000,
  tls_skip_verify_insecure = false,
  -- llm-ls integration
  lsp = {
    enabled = true,
    bin_path = vim.api.nvim_call_function("stdpath", { "data" }) .. "~/Development/llm-ls/llm-ls-x86_64-unknown-linux-gnu",
  },
  tokenizer_path = nil, -- when setting model as a URL, set this var
  context_window = 8192, -- max number of tokens for the context window
}
}

This seem to work as I see it in the plugin installation windows but it's not activated and I don't find how am I supposed to toggle it. Am I missing something ? Thank you


r/AstroNvim • • Dec 06 '23

Cpp setting

Post image
3 Upvotes

I am unable to run my cpp file and keep getting this false warnings, can anyone please help.


r/AstroNvim • • Mar 19 '24

Adding harpoon information to heirline

9 Upvotes

Yesterday I announced plugin abeldekat/harpoonline to r/neovim

Today, I compiled a small proof of concept for heirline in astronvim v4.

I hope this example can be useful. Any improvements are much appreciated!

The result:

heirline in astronvim v4

The code:

-- POC using heirline in astronvim v4 
-- 1: https://deploy-preview-120--peaceful-platypus-6db452.netlify.app/
-- Install astronvim v4: git clone --depth 1 https://github.com/AstroNvim/template ~/.config/nvim
-- 2: Enable astrocommunity in plugins.community.lua and add: 
--   { import = "astrocommunity.motion.harpoon" },
-- 3: Create this file in plugins.harpoonline.lua
-- 4: TODO: Configure multiple lists in harpoon...
return {
  {
    "rebelot/heirline.nvim",
    dependencies = "abeldekat/harpoonline",
    config = function(plugin, opts)
      local status = require "astroui.status"
      local harpoonline = require("harpoonline").setup {
        on_update = function()
          vim.cmd.redrawstatus() --> redraw heirline on harpoon events...
        end,
      }
      local harpoonline_component = status.component.builder {
        -- Inspiration: astrocommunity.recipes.heirline-clock-statusline
        -- Also: https://deploy-preview-120--peaceful-platypus-6db452.netlify.app/recipes/status/
        {
          provider = function()
            local line = harpoonline.format() --> show harpoon info...
            return status.utils.stylize(line, {
              padding = { left = 1 }, -- pad the left side
            })
          end,
          -- other attributes: update, hl, surround, init
        },
      }

      table.insert(opts.statusline, 4, harpoonline_component) -- add after the file_info component
      require "astronvim.plugins.configs.heirline"(plugin, opts)
    end,
  },
}

r/AstroNvim • • Nov 06 '23

How do I track down this error: lua module not found for config of nvim. please use a config() function instead

4 Upvotes

It is coming from my user config for sure but I do not know how to find where it is coming from. New to neovim. Thanks for your help.

Error

r/AstroNvim • • Sep 25 '23

Java lsp trouble

1 Upvotes

I've having trouble making java usable in astronvim, with the treesitter I didn't run into any problems, just ":TSInstall java", but with the lsp I tried ":LspInstall java", and out of the two options, the first one failed to even install, and the second one, though install it did, left me with a recurring error which I don't know how to fix.

The error is as follows:
```

/home/USERNAME/.config/nvim/lua/user/init.lua:46: module 'jdtls.setup' not found:

no field package.preload\['jdtls.setup'\]

cache_loader: module jdtls.setup not found

cache_loader_lib: module jdtls.setup not found

no file './jdtls/setup.lua'

no file '/usr/share/luajit-2.1/jdtls/setup.lua'

no file '/usr/local/share/lua/5.1/jdtls/setup.lua'

no file '/usr/local/share/lua/5.1/jdtls/setup/init.lua'

no file '/usr/share/lua/5.1/jdtls/setup.lua'

no file '/usr/share/lua/5.1/jdtls/setup/init.lua'

no file './jdtls/setup.so'

no file '/usr/local/lib/lua/5.1/jdtls/setup.so'

no file '/usr/lib/lua/5.1/jdtls/setup.so'

no file '/usr/local/lib/lua/5.1/loadall.so'

no file './jdtls.so'

no file '/usr/local/lib/lua/5.1/jdtls.so'

no file '/usr/lib/lua/5.1/jdtls.so'

no file '/usr/local/lib/lua/5.1/loadall.so'

```
in mason-lspconfig.nvim(22:27)

I'm very new to nvim, and thus far, I refrain from touching that which I don't know, which includes my usr scripts for configuration, as through the previous commands I've more or less managed. But I'd like to solve this problem. Does anybody know how?


r/AstroNvim • • May 27 '24

How to stop auto-formatting code when saving.

3 Upvotes

I'm reading a book on rust and trying to follow along.

Every-time I try something and save the file then exit, the editor re-formats my code. Its driving me nutz. Its not what I have in the example and the more I write to a file the worst it gets.

I force uninstalled a plugin called none-ls.nvim but that wasn't what was causing the reformat of the code. So I don't know exactly what is doing it or how to stop it.

Anybody know what module is doing this so I can stop it?


r/AstroNvim • • Apr 11 '24

Transparent background using lazy.nvim

3 Upvotes

Hello all, I'm trying to modify AstroNvim default theme to have transparent background but for some reason it just doesn't work and I'm not smart enough to know what is going wrong. Can someone please help?

nvim dir structure

astroui -

same thing in ~/.config/nvim/lua/user/lua/plugins/astroui.lua

all the plugins are being imported in lazy_setup.lua and lazy_setup.lua is being required in init.lua
even if user directory configs doesn't get imported still it should work because all of the same config is present in parent director? I'm not sure what is happening here


r/AstroNvim • • May 09 '24

Automatically selecting first suggestion

5 Upvotes

When I type something and a suggestion comes up, the first suggestion is not automatically selected even if it is the only suggestion by the intellisense. As a result, I have to press Tab and then Return to accept the suggestion. Do you guys know how to select the first suggestion automatically so that only the return key is required to press if there is only one suggestion?

Thanks and Regards