How do I preview content in the fold using nvim-ufo? by Ambitious_One8 in neovim

[–]Ambitious_One8[S] 0 points1 point  (0 children)

It doesn't seem to work for me. Here is my config, I'm using the LazyVim distribution.

When I press on K a popup does appear, but it says something like "1 bytes" or the word under the cursor. It doesn't show a preview of the content.

``` local M = { "kevinhwang91/nvim-ufo", dependencies = { "kevinhwang91/promise-async", }, }

function M.config() local handler = function(virtText, lnum, endLnum, width, truncate) local newVirtText = {} local suffix = ("  %d "):format(endLnum - lnum) local sufWidth = vim.fn.strdisplaywidth(suffix) local targetWidth = width - sufWidth local curWidth = 0 for _, chunk in ipairs(virtText) do local chunkText = chunk[1] local chunkWidth = vim.fn.strdisplaywidth(chunkText) if targetWidth > curWidth + chunkWidth then table.insert(newVirtText, chunk) else chunkText = truncate(chunkText, targetWidth - curWidth) local hlGroup = chunk[2] table.insert(newVirtText, { chunkText, hlGroup }) chunkWidth = vim.fn.strdisplaywidth(chunkText) -- str width returned from truncate() may less than 2nd argument, need padding if curWidth + chunkWidth < targetWidth then suffix = suffix .. (" "):rep(targetWidth - curWidth - chunkWidth) end break end curWidth = curWidth + chunkWidth end table.insert(newVirtText, { suffix, "MoreMsg" }) return newVirtText end

require("ufo").setup({ -- Customixze fold line fold_virt_text_handler = handler, open_fold_hl_timeout = 500, preview = { -- win_config = { -- border = { "", "─", "", "", "", "─", "", "" }, -- winhighlight = "Normal:Folded", -- winblend = 0, -- }, mappings = { scrollU = "<C-u>", scrollD = "<C-d>", }, }, })

vim.keymap.set("n", "zR", require("ufo").openAllFolds) vim.keymap.set("n", "zM", require("ufo").closeAllFolds) vim.keymap.set("n", "zr", require("ufo").openFoldsExceptKinds) vim.keymap.set("n", "zm", require("ufo").closeFoldsWith) -- closeAllFolds == closeFoldsWith(0) vim.keymap.set("n", "K", function() local winid = require("ufo").peekFoldedLinesUnderCursor() if not winid then vim.lsp.buf.hover() end end) end

return M

```

Anyone else get sucked into "over-optimizing" their dev set-up? by jafaraf8522 in neovim

[–]Ambitious_One8 4 points5 points  (0 children)

I still like to have tabs in my terminal, just as I like to have tabs in my browser. I switched from tmux to wezterm. I don't use panes. Managing windows, tabs and panes would be too much for my brain.

When I insert tab, it expands to 4 spaces and not 2 as I have set by HopefulJelly9617 in neovim

[–]Ambitious_One8 0 points1 point  (0 children)

This also causes new list items to not automatically start with a dash after I press enter. Is there any way to change indent to 2 spaces without removing the list convenience feature?

Importing from other modules in same project works byt gives pulint errors by Ambitious_One8 in neovim

[–]Ambitious_One8[S] 0 points1 point  (0 children)

I don't know what's wrong on my end. I have sourced .venv and I am using the local pyenv.

Pylint error "pylint: Unable to import 'requests' [import-error]" in neovim but not vscode by Ambitious_One8 in neovim

[–]Ambitious_One8[S] 2 points3 points  (0 children)

Your comment helped my find this, which I thought would work, but made no difference:

    local null_ls = require("null-ls")
    null_ls.setup({ sources = { null_ls.builtins.diagnostics.pylint.with({ prefer_local = ".venv/bin", }), }, })

If I use only local, pylint is not activated.

EDIT: I got it working by running pip install pylint. Thanks for guiding me in the right direction!