From 8a30fffd64595955b8b50d6e84bbb698d289997b Mon Sep 17 00:00:00 2001 From: insects Date: Thu, 10 Apr 2025 18:09:58 +0200 Subject: [PATCH] nvim: styles, keybindings, etc --- dot_config/nvim/init.lua | 1 + dot_config/nvim/lua/plugins/base.lua | 45 +++++++++++++++++++++-- dot_config/nvim/lua/plugins/telescope.lua | 41 ++++++++++++--------- dot_config/nvim/lua/settings.lua | 18 +++++++++ dot_config/nvim/stylua.toml | 3 ++ 5 files changed, 87 insertions(+), 21 deletions(-) create mode 100644 dot_config/nvim/lua/settings.lua create mode 100644 dot_config/nvim/stylua.toml diff --git a/dot_config/nvim/init.lua b/dot_config/nvim/init.lua index 55b8979..c6b0eb8 100644 --- a/dot_config/nvim/init.lua +++ b/dot_config/nvim/init.lua @@ -1 +1,2 @@ +require("settings") require("config.lazy") diff --git a/dot_config/nvim/lua/plugins/base.lua b/dot_config/nvim/lua/plugins/base.lua index f406319..e9e2511 100644 --- a/dot_config/nvim/lua/plugins/base.lua +++ b/dot_config/nvim/lua/plugins/base.lua @@ -11,9 +11,46 @@ return { dashboard = { enabled = true }, indent = { enabled = true, animate = { enabled = false } }, input = { enabled = true }, - lazygit = { enabled = true }, + lazygit = { enabled = true, configure = true }, + picker = { enabled = true }, quickfile = { enabled = true }, - statuscolumn = { enabled = true } - } - } + statuscolumn = { enabled = true }, + }, + keys = { + { + "gg", + function() + require("snacks").lazygit() + end, + desc = "Open LazyGit", + }, + }, + }, + { + "stevearc/conform.nvim", + opts = { + formatters_by_ft = { + lua = { "stylua" }, + }, + format_on_save = { + timeout_ms = 500, + lsp_format = "fallback", + }, + }, + }, + { + "zapling/mason-conform.nvim", + depends = { + "williamboman/mason.nvim", + "stevearc/conform.nvim", + }, + opts = {}, + }, + { + "mrjones2014/legendary.nvim", + priority = 999, + opts = { + extensions = { lazy_nvim = true }, + }, + }, } diff --git a/dot_config/nvim/lua/plugins/telescope.lua b/dot_config/nvim/lua/plugins/telescope.lua index 70b18ad..9cbbc73 100644 --- a/dot_config/nvim/lua/plugins/telescope.lua +++ b/dot_config/nvim/lua/plugins/telescope.lua @@ -1,30 +1,37 @@ -- Telescope, and other file picker-related plugins return { -{ + { "nvim-telescope/telescope.nvim", config = function() local telescope = require("telescope") - telescope.setup() + telescope.setup({}) telescope.load_extension("chezmoi") - end + end, + keys = { + { + "", + "Telescope find_files", + desc = "Find files", + }, + }, }, { "xvzc/chezmoi.nvim", config = function() - require("chezmoi").setup { - -- Treat all files in my chezmoi source directory as source files - vim.api.nvim_create_autocmd({ "BufRead", "BufNewFile" }, { - pattern = { os.getenv("HOME") .. "/.local/share/chezmoi/*" }, - callback = function(evt) - local bufnr = evt.buf - local edit_watch = function() - require("chezmoi.commands.__edit").watch(bufnr) - end - vim.schedule(edit_watch) - end - }) - } - end + require("chezmoi").setup({ + -- Treat all files in my chezmoi source directory as source files + vim.api.nvim_create_autocmd({ "BufRead", "BufNewFile" }, { + pattern = { os.getenv("HOME") .. "/.local/share/chezmoi/*" }, + callback = function(evt) + local bufnr = evt.buf + local edit_watch = function() + require("chezmoi.commands.__edit").watch(bufnr) + end + vim.schedule(edit_watch) + end, + }), + }) + end, }, } diff --git a/dot_config/nvim/lua/settings.lua b/dot_config/nvim/lua/settings.lua new file mode 100644 index 0000000..487cd41 --- /dev/null +++ b/dot_config/nvim/lua/settings.lua @@ -0,0 +1,18 @@ +local o = vim.opt + +o.number = true -- line numbers +o.clipboard = "unnamedplus" -- use the clipboard register +o.syntax = "on" -- syntaxxxx +o.autoindent = true -- keep indents from prev line +o.cursorline = true -- highlight bg of current line +o.expandtab = true -- in insert, handle correctly +o.shiftwidth = 2 -- 2 spaces +o.tabstop = 2 -- 2-wide tabs +o.encoding = "UTF-8" -- obligatory +o.ruler = true -- show location of cursor +o.mouse = "a" -- enable mouse on all modes +o.title = true -- update the window title +o.wildmenu = true -- get wild +o.showmatch = true -- jump to matching bracket +o.splitright = true -- split right +o.splitbelow = true -- split below diff --git a/dot_config/nvim/stylua.toml b/dot_config/nvim/stylua.toml new file mode 100644 index 0000000..0f90030 --- /dev/null +++ b/dot_config/nvim/stylua.toml @@ -0,0 +1,3 @@ +indent_type = "Spaces" +indent_width = 2 +column_width = 120