feat(nvim): More leader mappings and text objects

This commit is contained in:
js0ny 2025-01-12 22:36:49 +00:00
parent aeec1ce5c7
commit 073c60f07d
17 changed files with 264 additions and 130 deletions

View file

@ -0,0 +1,38 @@
return {
"stevearc/conform.nvim",
event = { "BufWritePre" },
cmd = { "ConformInfo" },
-- This will provide type hinting with LuaLS
---@module "conform"
---@type conform.setupOpts
opts = {
-- Define your formatters
formatters_by_ft = {
lua = { "stylua" },
python = { "isort", "black" },
javascript = { "prettierd", "prettier", stop_after_first = true },
},
-- Set default options
default_format_opts = {
lsp_format = "fallback",
},
-- Set up format-on-save
format_on_save = function(bufnr)
-- Disable with a global or buffer-local variable
if vim.g.disable_autoformat or vim.b[bufnr].disable_autoformat then
return
end
return { timeout_ms = 500, lsp_format = "fallback" }
end,
-- Customize formatters
formatters = {
shfmt = {
prepend_args = { "-i", "2" },
},
},
},
init = function()
-- If you want the formatexpr, here is the place to set it
vim.o.formatexpr = "v:lua.require'conform'.formatexpr()"
end,
}

View file

@ -31,6 +31,22 @@ return {
on_attach = my_on_attach,
sync_root_with_cwd = true,
respect_buf_cwd = true,
disable_netrw = true,
renderer = {
icons = {
glyphs = {
git = { -- https://github.com/nvim-neo-tree/neo-tree.nvim/blob/main/doc/neo-tree.txt#L1077C1-L1077C29
unmerged = "",
renamed = "",
deleted = "",
untracked = "",
ignored = "",
unstaged = "󰄱",
staged = "",
},
},
},
},
})
end,
}

View file

@ -3,6 +3,17 @@ return {
config = function()
require("telescope").setup({
defaults = {
prompt_prefix = "",
selection_caret = " ",
entry_prefix = " ",
layout_config = { -- https://github.com/NvChad/NvChad/blob/v2.5/lua/nvchad/configs/telescope.lua
horizontal = {
prompt_position = "top",
preview_width = 0.55,
},
width = 0.87,
height = 0.80,
},
mappings = {
n = {
["n"] = "move_selection_next",
@ -11,6 +22,7 @@ return {
["r"] = "preview_scrolling_down",
["a"] = "preview_scrolling_left",
["s"] = "preview_scrolling_right",
["q"] = require("telescope.actions").close,
},
},
},