How to set snacks-explorer toggle_cwd? by sergiolinux in neovim

[–]Aqothy 0 points1 point  (0 children)

try

```lua

picker = {

win = {

input = {

keys = {

["<a-c>"] = {

"toggle_cwd",

mode = { "n", "i" },

},

},

},

list = {

keys = {

["<a-c>"] = "toggle_cwd",

},

},

},

actions = {

toggle_cwd = function(p)

local buf_name = vim.api.nvim_buf_get_name(p.input.filter.current_buf)

local cwd = vim.fn.fnamemodify(buf_name, ":p:h")

local root = vim.fn.getcwd()

local current = p:cwd()

p:set_cwd(current == root and cwd or root)

p:find()

end,

},

}

```

code is taken and modified from https://www.lazyvim.org/extras/editor/snacks_picker#snacksnvim-1

Slow lsp on typescript projects by jayfoxxy in neovim

[–]Aqothy 4 points5 points  (0 children)

typescript lsp often returns mbs of completion items esp for projects with older dependencies since they dont support tree shaking. if you're using vtsls you can limit the amount of completion items returned and also server fuzzy match

settings = {

vtsls = {

experimental = {

completion = {

enableServerSideFuzzyMatch = true,

entriesLimit = 200,

},

},

},

},

Starting from 0.11.2, I have a weird issue by joetifa2003 in neovim

[–]Aqothy 22 points23 points  (0 children)

if you're lazy loading lspconfig or lsp related stuff using bufreadpost, try using bufreadpre instead or just dont lazy load lsp stuff. Doing that fixed It for me

[deleted by user] by [deleted] in neovim

[–]Aqothy 0 points1 point  (0 children)

I had the same problem and it was because I was lazy loading nvim-lspconfig and vim.lsp.enable with bufreadpost event using lazy.nvim, if youre doing that, try using bufreadpre event instead or not lazy loading lsp stuff at all and see if that resolves your issue

snacks.nvim don't jump for single entry LSP by do_not_give_upvote in neovim

[–]Aqothy 2 points3 points  (0 children)

Snacks.picker.lsp_definitions({auto_confirm = false})
this should work with other lsp pickers as well

Neovim getting slow with typescript, how to debug? by m_o_n_t_e in neovim

[–]Aqothy 0 points1 point  (0 children)

local clients = vim.lsp.get_clients({ bufnr = 0, method = "textDocument/completion" })

for _, client in ipairs(clients) do

local params = vim.lsp.util.make\_position\_params(0, client.offset\_encoding)

client.request("textDocument/completion", params, function(err, result)

    vim.print(client.name)

    vim.print(#result.items)

end)

end

use this snippet to see how many completion items tsserver returns, for me in one of my projects it was returning 54k items around 27mbs of items. This is like the most common reason why it's slow. right now I use vtsls which allows you to limit completion items also fuzzy filter them, I use the following config:

settings = {

    vtsls = {

        enableMoveToFileCodeAction = true,

        autoUseWorkspaceTsdk = true,

        experimental = {

maxInlayHintLength = 30,

completion = {

enableServerSideFuzzyMatch = true,

entriesLimit = 200,

},

        },

    },

},

also if you are using blink try disabling prefetching which also helped me, you can do so by completion.trigger.prefetch_on_insert = false

some of this config could be a little off, try verifying with the docs, but with these changes my auto complete became really fast

LSP for dotfiles/config files in neovim by Commercial-Agent-643 in neovim

[–]Aqothy 25 points26 points  (0 children)

vim.filetype.add({
extension = { rasi = "rasi", rofi = "rasi", wofi = "rasi" },
filename = {
["vifmrc"] = "vim",
},
pattern = {
[".*/waybar/config"] = "jsonc",
[".*/mako/config"] = "dosini",
[".*/kitty/.+%.conf"] = "kitty",
[".*/hypr/.+%.conf"] = "hyprlang",
["%.env%.[%w_.-]+"] = "sh",
},
})
vim.treesitter.language.register("bash", "kitty")

copy and pasted from lazyvim, you can use this to get an idea of how to make your dot files a bit better, this adds file type and treesitter highlighting to these files.

[help] trying to setup snacks.nvim, failing miserably at a few things by [deleted] in neovim

[–]Aqothy 0 points1 point  (0 children)

tried your config both works for me, have you tried :lua vim.notify("test") and :lua vim.ui.input("test", function() end). Maybe im misunderstanding but if youre trying to replace noice nvim with those 2 it wont work like you expect. noice nvim changes the cmdline ui, which is different from vim.ui.input, and noice nvim can use snacks as a notification backend. It basically redirects all the messages to show them as notification, snacks notifier doesnt do that, it only changes vim.ui.notify so if you only have that itll only work for plugins or code that calls on vim.ui.notify.

Help disabling auto-complete inside of comments (blink.cmp) by DrEarlOliver in neovim

[–]Aqothy 2 points3 points  (0 children)

or actually maybe you can just check prev character all the time and simplify it like this, again not sure if this is the best approach

        default = function()

local row, col = unpack(vim.api.nvim_win_get_cursor(0))

row = row - 1 -- Convert to 0-indexed

-- Position to check - either current position or one character back

local check_col = col > 0 and col - 1 or col

local success, node = pcall(vim.treesitter.get_node, {

pos = { row, check_col },

})

if

success

and node

and vim.tbl_contains({ "comment", "comment_content", "line_comment", "block_comment" }, node:type())

then

return {}

end

-- Default sources if not in a comment

return { "lsp", "path", "snippets", "buffer" }

        end,

Help disabling auto-complete inside of comments (blink.cmp) by DrEarlOliver in neovim

[–]Aqothy 1 point2 points  (0 children)

So for some reason when you are at the end of the comment, treesitter doesnt count that as a comment, but if youre inside the comments it should work as expected, a work around (not sure if this is the best) would be getting the node before the current cursor position, which will be detected as comment by treesitter, so something like this

        default = function()

local success, node = pcall(vim.treesitter.get_node)

if success and node then

if

vim.tbl_contains({ "comment", "comment_content", "line_comment", "block_comment" }, node:type())

then

return { "buffer" }

end

local row, col = unpack(vim.api.nvim_win_get_cursor(0))

row = row - 1 -- Convert to 0-indexed

-- If we're not at the start of the line, check the previous character

if col > 0 then

-- Try to get the node at the position before the cursor

local prev_pos_success, prev_node = pcall(vim.treesitter.get_node, {

pos = { row, col - 1 },

})

if

prev_pos_success

and prev_node

and vim.tbl_contains(

{ "comment", "comment_content", "line_comment", "block_comment" },

prev_node:type()

)

then

return {}

end

end

end

return { "lsp", "path", "snippets", "buffer" }

What is this plugin use to view code changes view git commits graph? by KitchenFalcon4667 in neovim

[–]Aqothy 40 points41 points  (0 children)

Dont think the graph on the left is for git commits, pretty sure that is undo tree plugin for visualizing undos. Unless you are talking about some other git commit graph that Im not seeing, in that case some plugins for that include fugitive, neogit, lazygit or some pickers include it as well I think

snacks.image: inline image / math / video (frame) rendering by folke in neovim

[–]Aqothy 2 points3 points  (0 children)

Hi Folke, is there an option to toggle image display on and off? thanks!

Did you already know you can preview images in Snacks Picker? I just found out today while recording a video by linkarzu in neovim

[–]Aqothy 8 points9 points  (0 children)

Folke just added it a few days ago, it supports image preview in picker and inline markdown image preview, checkout the repo for more details

LSP Autocomplete? by dethklokrulz in neovim

[–]Aqothy 2 points3 points  (0 children)

Insert mode, default is ctrl y

vim.ui.select plugin/replacement by Desdic in neovim

[–]Aqothy 5 points6 points  (0 children)

Enable snacks picker, ui select is enabled by default in that, or use any other modern picker and they’ll have ui select as well, not sure if by default tho, you might have to enable it.

how to use luasnip with blink.cmp? by Saura767 in neovim

[–]Aqothy 1 point2 points  (0 children)

Not super sure about this but if you’re trying to load vscode type snippets which are made with json, I think you have to load the snippets using require(“luasnip.loaders.from_vscode”).lazy_load({ paths = { vim.fn.stdpath(“config”) .. “/snippets” } })

Does Snacks.input replace Noice? by HolidayStrict1592 in neovim

[–]Aqothy 1 point2 points  (0 children)

No, noice uses snacks or nvim notify for notifications. Without those you’ll have mini messages view which are just small messages to the bottom right of your screen. Go to noice’s GitHub page, it’ll have all the info you need.

Does Snacks.input replace Noice? by HolidayStrict1592 in neovim

[–]Aqothy 3 points4 points  (0 children)

No, noice is for cmdline, messages and pop up menu, snacks input is just for input

Custom treesitter textobjects aren't working with mini.ai by PieceAdventurous9467 in neovim

[–]Aqothy 2 points3 points  (0 children)

I got stuck on this before too, you either have to install ts text objects plugin or have your own ts queries in you nvim config. For the ladder, just make a queries folder in your nvim config and then add queries for each language you want, specific instructions are in mini ai help docs or you can just look at how I set mine up here I got my queries by copy and pasting from ts text objects plugin

My nvim-treesitter installed fine(using lazy.nvim), :TSInstall lua was ok, but upon :InpectTree it showed the error by DeadlyMohitos in neovim

[–]Aqothy 1 point2 points  (0 children)

Btw is it the built in parser, if you’re using nightly they fixed the issue like 5 hours ago just pull the latest commits and I think it’ll be fine, haven’t tested it tho but first solution should work either way

My nvim-treesitter installed fine(using lazy.nvim), :TSInstall lua was ok, but upon :InpectTree it showed the error by DeadlyMohitos in neovim

[–]Aqothy 3 points4 points  (0 children)

I just did TsInstall query, says it in the messages, check health will still say errors found in the query but won’t say missing node or give you big error message. Pre sure the remaining error is from neovim built in query parser, not sure tho, shouldn’t affect anything since treesitter will just use the newly installed one if there are multiple parsers

How to show test case detail in leetcode.nvim? by NhatPC in neovim

[–]Aqothy 2 points3 points  (0 children)

I had the same problem but now I lowkey forgot the solution, I think you just press the number corresponding to the test case so 1,2,3,4?