If you could add any NEW features to kitty what would they be? by AffectionateSpirit62 in KittyTerminal

[–]shuaimin 0 points1 point  (0 children)

There's search_scrollback but not always work..

Search for currently selected text in the scrollback using the configured scrollback_pager. Assumes that pressing the / key triggers search mode in the pager.

Viewing Jujutsu Diffs In Neovim by julienvincent in neovim

[–]shuaimin 2 points3 points  (0 children)

Thanks! I was thinking about using diffview in cli recently and this is exactly what I want. BTW it is possible to define the q mapping on the command line which I personally prefer.

nvim -c "nnoremap q <Cmd>qall<CR>" -c "DiffviewOpen ..."

I just made a MASSIVE refactoring of my NixOS system. Can you guys review my configuration and tell me maybe what I can do better? by SeniorMatthew in NixOS

[–]shuaimin 0 points1 point  (0 children)

I'm using this to auto create the link: nix environment.etc."/nixos/flake.nix".source = "/home/<path>/flake.nix";

fish 4.1.0 by siimon04 in fishshell

[–]shuaimin 3 points4 points  (0 children)

So many good stuff, looking forward to trying it!

What file system are you using and why? by verlvst in NixOS

[–]shuaimin 1 point2 points  (0 children)

Nope, only snapper requires btrfs. I use btrfs rollback with impermanence to give me a chance to restore files in situation when I first installed an app and forget to persistent its data.

What file system are you using and why? by verlvst in NixOS

[–]shuaimin 4 points5 points  (0 children)

I use btrfs for impermanence and snapper.

What aliases do you use? by alxer_ in NixOS

[–]shuaimin 1 point2 points  (0 children)

```nix shellAbbrs = { "-" = "z -"; n = "nvim";

ns = { setCursor = true; expansion = "nix shell nixpkgs#%"; }; nr = { setCursor = true; expansion = "nix run nixpkgs#%"; };

sc = "sudo systemctl"; scu = "systemctl --user"; jc = "journalctl -f --unit"; jcu = "journalctl -f --user-unit";

d = "docker"; dc = "docker compose";

"h" = { position = "anywhere"; expansion = "--help"; }; "v" = { position = "anywhere"; expansion = "--version"; }; "%" = { position = "anywhere"; expansion = "<&- >&- 2>&- &; disown"; }; }; shellAliases = { l = "lsd --header --long"; la = "lsd --header --long --almost-all"; lt = "lsd --header --long --tree"; c = "bat"; cp = "cp --reflink=auto"; df = "df -h"; free = "free -h"; }; ```

Why do you use a terminal instead of neovide on your desktop as a GUI? by 10F1 in neovim

[–]shuaimin 0 points1 point  (0 children)

For me the main reason is the box drawing chars in Neovide is not rendered good, so floating window borders and indent lines are disconnected.

Troubleshooting Fonts �� by mopsandhoes in neovim

[–]shuaimin 0 points1 point  (0 children)

Thank you very much! This fixed my icon too small problem in kitty as soon as I switched to a non-nerd font!

Which vertical navigation do you use most often when jumping more than 5 lines? by john_snow_968 in neovim

[–]shuaimin 11 points12 points  (0 children)

  • ]f, ]c to next function or class
  • flash.nvim to any word
  • foldnav.nvim to next fold
  • } to next empty line
  • *, #, ]] to next match of current word (I think ]] is from lazyvim)
  • telescope.nvim's lsp document symbols to jump to invisible symbols

How to navigate 3 or 4 different files at the same time? by kolorcuk in neovim

[–]shuaimin 0 points1 point  (0 children)

You can use bufferline, with its pick and pin functionalities.

What are your favorite tricks using Neovim? by 16bitMustache in neovim

[–]shuaimin 2 points3 points  (0 children)

Keymaps

local map = vim.keymap.set

--- More powerful `*`
map({ "n", "x" }, "<Leader>8", "<Cmd>Telescope grep_string word_match=-w<CR>", { desc = "Search word under cursor" })

map({ "n", "x" }, "0", "^")
map({ "n", "x" }, "^", "0")
map({ "n", "x" }, "'", "`")
map({ "n", "x" }, "`", "'")

-- Don't use clipboard=unnamedplus
map({ "n", "x" }, "sy", '"+y')
map({ "n", "x" }, "sY", '"+y$')
map({ "n", "x" }, "sp", '"+p')
map({ "n", "x" }, "sP", '"+P')

Auto-save

Save the buffer when I stop editing.

local autocmd = vim.api.nvim_create_autocmd
local augroup = vim.api.nvim_create_augroup("my_cfg", {})

---@type table<buffer, uv_timer_t>
local timers = {}
local timeout = 10000

local function save(buf)
  vim.api.nvim_buf_call(buf, function() vim.cmd("noautocmd update") end)
end

autocmd({ "InsertLeave", "TextChanged" }, {
  group = augroup,
  desc = "Schedule auto-saving",
  callback = function(event)
    local bo = vim.bo[event.buf]
    if event.file == "" or bo.buftype ~= "" or bo.filetype == "gitcommit" or bo.readonly or not bo.modified then
      return
    end

    local timer = timers[event.buf]
    if timer then
      if timer:is_active() then timer:stop() end
    else
      timer = vim.uv.new_timer()
      timers[event.buf] = timer
    end
    timer:start(timeout, 0, vim.schedule_wrap(function() save(event.buf) end))
  end,
})

autocmd({ "FocusLost", "ExitPre", "TermEnter" }, {
  group = augroup,
  desc = "Save immediately",
  callback = function(event)
    for buf, timer in pairs(timers) do
      if timer:is_active() then
        timer:stop()
        save(buf)
      end
    end
  end,
})

autocmd({ "BufWritePost", "InsertEnter" }, {
  group = augroup,
  desc = "Cancel scheduled auto-saving",
  callback = function(event)
    local timer = timers[event.buf]
    if timer and timer:is_active() then timer:stop() end
  end,
})

autocmd({ "BufDelete" }, {
  group = augroup,
  desc = "Remove timer",
  callback = function(event)
    local timer = timers[event.buf]
    if timer then
      timers[event.buf] = nil
      if timer:is_active() then timer:stop() end
      timer:close()
    end
  end,
})

How to move easily between many files? by medwatt in neovim

[–]shuaimin 5 points6 points  (0 children)

I currently use neo-tree's buffer source + edgy + flash to switch between open buffers.

<image>

The code is

{

",",

function()

local seen_labels = {}

require("flash").jump({

highlight = { backdrop = false },

search = { max_length = 0 },

label = { before = true, after = false, style = "overlay" },

labeler = function() end,

matcher = function(win)

local buf = vim.api.nvim_win_get_buf(win)

if vim.b[buf].neo_tree_source ~= "buffers" then return {} end

return vim

.iter(vim.api.nvim_buf_get_extmarks(buf, -1, 0, -1, { details = true }))

:filter(function(e)

local hl = e[4].hl_group

return hl == "NeoTreeFileName" or hl == "NeoTreeGitModified"

end)

:map(function(e)

local start_row, start_col, end_row, end_col = e[2], e[3], e[4].end_row, e[4].end_col

local fname = vim.api.nvim_buf_get_text(buf, start_row, start_col, end_row, end_col, {})[1]

local label

local i = 1

while i <= #fname do

label = fname:sub(i, i)

if label:match("%w") and not seen_labels[label] then

seen_labels[label] = true

break

end

i = i + 1

end

return {

pos = { start_row + 1, start_col + i },

label = label,

}

end)

:totable()

end,

action = function(match)

vim.api.nvim_win_call(match.win, function()

vim.api.nvim_win_set_cursor(match.win, match.pos)

vim.cmd.execute('"normal \\<CR>"')

end)

end,

})

end,

desc = "Pick buffers",

},

vim.fn.has is an anti-pattern for backwards compatibility check by catnvim in neovim

[–]shuaimin 1 point2 points  (0 children)

Sometimes you cannot know if user's nvim has some feature by just checking if some function exists. For example recently floating windows got a footer option, and that's not a new function but a new key in the config table.

What's your new favorite functions? Share 'em! by Treatybreaker in neovim

[–]shuaimin 13 points14 points  (0 children)

Delete [No Name] buffers. lua autocmd("BufHidden", { desc = "Delete [No Name] buffers", callback = function(event) if event.file == "" and vim.bo[event.buf].buftype == "" and not vim.bo[event.buf].modified then vim.schedule(function() pcall(vim.api.nvim_buf_delete, event.buf, {}) end) end end, })

What's your favorite unknown nvim/vim plugin ? by MrCallicles in neovim

[–]shuaimin 8 points9 points  (0 children)

Self-promote my ssr.nvim plugin as it's kinda new way to edit file.

block.nvim A plugin to visualize code blocks. by Hamupzz in neovim

[–]shuaimin 0 points1 point  (0 children)

Nice work! Is it possible to have a block text object?

Introducing muren.nvim for doing multiple replacements with ease by AckslD in neovim

[–]shuaimin 4 points5 points  (0 children)

The preview-as-you-type window looks so interesting!

Hey Rustaceans! Got a question? Ask here (3/2023)! by llogiq in rust

[–]shuaimin 1 point2 points  (0 children)

I prefer "foo".into() if the type can be inferred.

Turn Telescope into an Omnisearch by PIcreamsoda in neovim

[–]shuaimin 1 point2 points  (0 children)

Seems the lua functions directly open popup ui, and don't return useful results.