diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua index dcea49d..0ae196d 100644 --- a/.config/nvim/init.lua +++ b/.config/nvim/init.lua @@ -8,16 +8,15 @@ vim.opt.relativenumber = false vim.opt.number = true local builtin = require("telescope.builtin") -vim.keymap.set("n", "ff", builtin.find_files, {}) -vim.keymap.set("n", "fg", builtin.live_grep, {}) -vim.keymap.set("n", "fb", builtin.buffers, {}) -vim.keymap.set("n", "fh", builtin.help_tags, {}) +vim.keymap.set("n", "ff", builtin.find_files, { desc = "Find files" }) +vim.keymap.set("n", "fg", builtin.live_grep, { desc = "Live grep files" }) +vim.keymap.set("n", "fb", builtin.buffers, { desc = "Find buffers" }) +vim.keymap.set("n", "fh", builtin.help_tags, { desc = "Help tags" }) vim.keymap.set("n", "F", function() require("conform").format({ async = true }) -end, {}) - -vim.keymap.set("n", "n", ":BufferLineCycleNext", {}) -vim.keymap.set("n", "b", ":BufferLineCyclePrev", {}) -vim.keymap.set("n", "q", ":bd", {}) +end, { desc = "Format file" }) +vim.keymap.set("n", "n", ":BufferLineCycleNext", { desc = "Go to the next buffer" }) +vim.keymap.set("n", "b", ":BufferLineCyclePrev", { desc = "Go to the previous buffer" }) +vim.keymap.set("n", "q", ":bd", { desc = "Close current buffer" }) diff --git a/.config/nvim/lua/config/lazy.lua b/.config/nvim/lua/config/lazy.lua index d64da43..1dc7176 100644 --- a/.config/nvim/lua/config/lazy.lua +++ b/.config/nvim/lua/config/lazy.lua @@ -1,17 +1,17 @@ -- Bootstrap lazy.nvim local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" if not (vim.uv or vim.loop).fs_stat(lazypath) then - local lazyrepo = "https://github.com/folke/lazy.nvim.git" - local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath }) - if vim.v.shell_error ~= 0 then - vim.api.nvim_echo({ - { "Failed to clone lazy.nvim:\n", "ErrorMsg" }, - { out, "WarningMsg" }, - { "\nPress any key to exit..." }, - }, true, {}) - vim.fn.getchar() - os.exit(1) - end + local lazyrepo = "https://github.com/folke/lazy.nvim.git" + local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath }) + if vim.v.shell_error ~= 0 then + vim.api.nvim_echo({ + { "Failed to clone lazy.nvim:\n", "ErrorMsg" }, + { out, "WarningMsg" }, + { "\nPress any key to exit..." }, + }, true, {}) + vim.fn.getchar() + os.exit(1) + end end vim.opt.rtp:prepend(lazypath) @@ -23,14 +23,13 @@ vim.g.maplocalleader = "\\" -- Setup lazy.nvim require("lazy").setup({ - spec = { - -- import your plugins - { import = "plugins" }, - }, - -- Configure any other settings here. See the documentation for more details. - -- colorscheme that will be used when installing plugins. - install = { colorscheme = { "catppuccin-mocha" } }, - -- automatically check for plugin updates - checker = { enabled = true }, + spec = { + -- import your plugins + { import = "plugins" }, + }, + -- Configure any other settings here. See the documentation for more details. + -- colorscheme that will be used when installing plugins. + install = { colorscheme = { "catppuccin-mocha" } }, + -- automatically check for plugin updates + checker = { enabled = true }, }) - diff --git a/.config/nvim/lua/plugins/blink.lua b/.config/nvim/lua/plugins/blink.lua index fa4eb08..4eb828c 100644 --- a/.config/nvim/lua/plugins/blink.lua +++ b/.config/nvim/lua/plugins/blink.lua @@ -1,54 +1,53 @@ return { - 'saghen/blink.cmp', - -- optional: provides snippets for the snippet source - --dependencies = { 'rafamadriz/friendly-snippets' }, + "saghen/blink.cmp", + -- optional: provides snippets for the snippet source + --dependencies = { 'rafamadriz/friendly-snippets' }, - -- use a release tag to download pre-built binaries - version = '1.*', - -- AND/OR build from source, requires nightly: https://rust-lang.github.io/rustup/concepts/channels.html#working-with-nightly-rust - -- build = 'cargo build --release', - -- If you use nix, you can build from source using latest nightly rust with: - -- build = 'nix run .#build-plugin', + -- use a release tag to download pre-built binaries + version = "1.*", + -- AND/OR build from source, requires nightly: https://rust-lang.github.io/rustup/concepts/channels.html#working-with-nightly-rust + -- build = 'cargo build --release', + -- If you use nix, you can build from source using latest nightly rust with: + -- build = 'nix run .#build-plugin', - ---@module 'blink.cmp' - ---@type blink.cmp.Config - opts = { - -- 'default' (recommended) for mappings similar to built-in completions (C-y to accept) - -- 'super-tab' for mappings similar to vscode (tab to accept) - -- 'enter' for enter to accept - -- 'none' for no mappings - -- - -- All presets have the following mappings: - -- C-space: Open menu or open docs if already open - -- C-n/C-p or Up/Down: Select next/previous item - -- C-e: Hide menu - -- C-k: Toggle signature help (if signature.enabled = true) - -- - -- See :h blink-cmp-config-keymap for defining your own keymap - keymap = { preset = 'super-tab' }, + ---@module 'blink.cmp' + ---@type blink.cmp.Config + opts = { + -- 'default' (recommended) for mappings similar to built-in completions (C-y to accept) + -- 'super-tab' for mappings similar to vscode (tab to accept) + -- 'enter' for enter to accept + -- 'none' for no mappings + -- + -- All presets have the following mappings: + -- C-space: Open menu or open docs if already open + -- C-n/C-p or Up/Down: Select next/previous item + -- C-e: Hide menu + -- C-k: Toggle signature help (if signature.enabled = true) + -- + -- See :h blink-cmp-config-keymap for defining your own keymap + keymap = { preset = "super-tab" }, - appearance = { - -- 'mono' (default) for 'Nerd Font Mono' or 'normal' for 'Nerd Font' - -- Adjusts spacing to ensure icons are aligned - nerd_font_variant = 'mono' - }, + appearance = { + -- 'mono' (default) for 'Nerd Font Mono' or 'normal' for 'Nerd Font' + -- Adjusts spacing to ensure icons are aligned + nerd_font_variant = "mono", + }, - -- (Default) Only show the documentation popup when manually triggered - completion = { documentation = { auto_show = false } }, + -- (Default) Only show the documentation popup when manually triggered + completion = { documentation = { auto_show = false } }, - -- Default list of enabled providers defined so that you can extend it - -- elsewhere in your config, without redefining it, due to `opts_extend` - sources = { - default = { 'lsp', 'path', 'snippets', 'buffer' }, - }, + -- Default list of enabled providers defined so that you can extend it + -- elsewhere in your config, without redefining it, due to `opts_extend` + sources = { + default = { "lsp", "path", "snippets", "buffer" }, + }, - -- (Default) Rust fuzzy matcher for typo resistance and significantly better performance - -- You may use a lua implementation instead by using `implementation = "lua"` or fallback to the lua implementation, - -- when the Rust fuzzy matcher is not available, by using `implementation = "prefer_rust"` - -- - -- See the fuzzy documentation for more information - fuzzy = { implementation = "prefer_rust_with_warning" } - }, - opts_extend = { "sources.default" } + -- (Default) Rust fuzzy matcher for typo resistance and significantly better performance + -- You may use a lua implementation instead by using `implementation = "lua"` or fallback to the lua implementation, + -- when the Rust fuzzy matcher is not available, by using `implementation = "prefer_rust"` + -- + -- See the fuzzy documentation for more information + fuzzy = { implementation = "prefer_rust_with_warning" }, + }, + opts_extend = { "sources.default" }, } - diff --git a/.config/nvim/lua/plugins/bufferline.lua b/.config/nvim/lua/plugins/bufferline.lua index 7893ca1..9036375 100644 --- a/.config/nvim/lua/plugins/bufferline.lua +++ b/.config/nvim/lua/plugins/bufferline.lua @@ -8,12 +8,11 @@ return { diagnostics = "nvim_lsp", always_show_bufferline = true, separator_style = "slant", - + show_buffer_close_icons = false, buffer_close_icon = "X", - - modified_icon = "U", - } - } -} + modified_icon = "U", + }, + }, +} diff --git a/.config/nvim/lua/plugins/catppuccin.lua b/.config/nvim/lua/plugins/catppuccin.lua index 0ab2808..56e933d 100644 --- a/.config/nvim/lua/plugins/catppuccin.lua +++ b/.config/nvim/lua/plugins/catppuccin.lua @@ -6,4 +6,3 @@ return { vim.cmd([[colorscheme catppuccin-macchiato]]) end, } - diff --git a/.config/nvim/lua/plugins/conform.lua b/.config/nvim/lua/plugins/conform.lua index d056f1a..ab9e8c8 100644 --- a/.config/nvim/lua/plugins/conform.lua +++ b/.config/nvim/lua/plugins/conform.lua @@ -3,7 +3,8 @@ return { opts = { formatters_by_ft = { python = { "black" }, - c = { "clang-format" } + c = { "clang-format" }, + lua = { "stylua" }, }, }, } diff --git a/.config/nvim/lua/plugins/nvim-lsp.lua b/.config/nvim/lua/plugins/nvim-lsp.lua index 73792f7..640a8f8 100644 --- a/.config/nvim/lua/plugins/nvim-lsp.lua +++ b/.config/nvim/lua/plugins/nvim-lsp.lua @@ -1,21 +1,18 @@ return { - 'neovim/nvim-lspconfig', - dependencies = { 'saghen/blink.cmp' }, - - -- example using `opts` for defining servers - opts = { - servers = { - clangd = {}, - } - }, - config = function(_, opts) - local lspconfig = require('lspconfig') - for server, config in pairs(opts.servers) do - -- passing config.capabilities to blink.cmp merges with the capabilities in your - -- `opts[server].capabilities, if you've defined it - config.capabilities = require('blink.cmp').get_lsp_capabilities(config.capabilities) - lspconfig[server].setup(config) - end - end + "neovim/nvim-lspconfig", + dependencies = { "saghen/blink.cmp" }, + opts = { + servers = { + clangd = {}, + }, + }, + config = function(_, opts) + local lspconfig = require("lspconfig") + for server, config in pairs(opts.servers) do + -- passing config.capabilities to blink.cmp merges with the capabilities in your + -- `opts[server].capabilities, if you've defined it + config.capabilities = require("blink.cmp").get_lsp_capabilities(config.capabilities) + lspconfig[server].setup(config) + end + end, } - diff --git a/.config/nvim/lua/plugins/nvim-treesitter.lua b/.config/nvim/lua/plugins/nvim-treesitter.lua index b9079df..bae2172 100644 --- a/.config/nvim/lua/plugins/nvim-treesitter.lua +++ b/.config/nvim/lua/plugins/nvim-treesitter.lua @@ -1,15 +1,14 @@ return { - "nvim-treesitter/nvim-treesitter", - build = ":TSUpdate", - config = function () - local configs = require("nvim-treesitter.configs") + "nvim-treesitter/nvim-treesitter", + build = ":TSUpdate", + config = function() + local configs = require("nvim-treesitter.configs") - configs.setup({ - ensure_installed = { "c", "lua", "vim", "vimdoc" }, - sync_install = false, - highlight = { enable = true }, - indent = { enable = true }, - }) - end + configs.setup({ + ensure_installed = { "c", "lua", "vim", "vimdoc" }, + sync_install = false, + highlight = { enable = true }, + indent = { enable = true }, + }) + end, } - diff --git a/.config/nvim/lua/plugins/telescope.lua b/.config/nvim/lua/plugins/telescope.lua index 03f4051..7d8b92f 100644 --- a/.config/nvim/lua/plugins/telescope.lua +++ b/.config/nvim/lua/plugins/telescope.lua @@ -1,5 +1,5 @@ return { "nvim-telescope/telescope.nvim", tag = "0.1.8", - dependencies = { "nvim-lua/plenary.nvim" } + dependencies = { "nvim-lua/plenary.nvim" }, } diff --git a/.config/nvim/lua/plugins/which-key.lua b/.config/nvim/lua/plugins/which-key.lua new file mode 100644 index 0000000..30d556e --- /dev/null +++ b/.config/nvim/lua/plugins/which-key.lua @@ -0,0 +1,10 @@ +return { + "folke/which-key.nvim", + event = "VeryLazy", + opts = { + -- your configuration comes here + -- or leave it empty to use the default settings + -- refer to the configuration section below + }, + keys = {}, +} diff --git a/README.md b/README.md index a48eee9..42f13c5 100644 --- a/README.md +++ b/README.md @@ -7,19 +7,12 @@ My personal dotfiles! ## Requirements - [ripgrep](https://github.com/BurntSushi/ripgrep) - clangd +- stylua + - Optional ## Installation Just copy the folders under `.config` in your `$HOME/.config/`. ## Keybindings -The leader key is the `Space`. - -`ff` - Find files -`fg` - Live grep -`fb` - Show buffers -`fh` - Help tags -`F` - Format file (only works with C files) -`q` - Quit buffer -`n` - Next buffer -`b` - Previous buffer +The leader key is the `Space`. Press it to show all the keybindings.