summaryrefslogtreecommitdiff
path: root/.config/nvim
diff options
context:
space:
mode:
Diffstat (limited to '.config/nvim')
-rw-r--r--.config/nvim/.stylua.toml3
-rw-r--r--.config/nvim/README.md7
-rw-r--r--.config/nvim/init.lua18
-rw-r--r--.config/nvim/lazy-lock.json24
-rw-r--r--.config/nvim/lua/options.lua13
-rw-r--r--.config/nvim/lua/plugins/catppuccin.lua19
-rw-r--r--.config/nvim/lua/plugins/cmp.lua95
-rw-r--r--.config/nvim/lua/plugins/editor.lua4
-rw-r--r--.config/nvim/lua/plugins/git.lua27
-rw-r--r--.config/nvim/lua/plugins/lsp.lua64
-rw-r--r--.config/nvim/lua/plugins/telescope.lua17
-rw-r--r--.config/nvim/lua/plugins/treesitter.lua35
-rw-r--r--.config/nvim/lua/plugins/which-key.lua9
13 files changed, 335 insertions, 0 deletions
diff --git a/.config/nvim/.stylua.toml b/.config/nvim/.stylua.toml
new file mode 100644
index 0000000..6cb677e
--- /dev/null
+++ b/.config/nvim/.stylua.toml
@@ -0,0 +1,3 @@
+line_endings = "Unix"
+quote_style = "ForceSingle"
+call_parentheses = "Always"
diff --git a/.config/nvim/README.md b/.config/nvim/README.md
new file mode 100644
index 0000000..63f50b4
--- /dev/null
+++ b/.config/nvim/README.md
@@ -0,0 +1,7 @@
+# Neovim Config
+
+## Credits
+
+- [Winston](https://github.com/nekowinston) for his excellent [config](https://github.com/nekowinston/dotfiles/tree/main/home/apps/neovim)
+- [Lazyvim](https://lazyvim.org)
+
diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua
new file mode 100644
index 0000000..f6f4491
--- /dev/null
+++ b/.config/nvim/init.lua
@@ -0,0 +1,18 @@
+local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
+if not vim.loop.fs_stat(lazypath) then
+ vim.fn.system({
+ "git",
+ "clone",
+ "--filter=blob:none",
+ "https://github.com/folke/lazy.nvim.git",
+ "--branch=stable",
+ lazypath,
+ })
+end
+vim.opt.rtp:prepend(lazypath)
+
+require("options")
+
+require("lazy").setup("plugins", {
+ install = { colorscheme = { "catppuccin" } },
+})
diff --git a/.config/nvim/lazy-lock.json b/.config/nvim/lazy-lock.json
new file mode 100644
index 0000000..e72ad5d
--- /dev/null
+++ b/.config/nvim/lazy-lock.json
@@ -0,0 +1,24 @@
+{
+ "LuaSnip": { "branch": "master", "commit": "2c08f32a570c07b8130144813266e21393da80d3" },
+ "catppuccin": { "branch": "main", "commit": "65bf0b16f57a3db70d6a93ac68882dd9a31d0565" },
+ "cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
+ "cmp-cmdline": { "branch": "main", "commit": "d250c63aa13ead745e3a40f61fdd3470efde3923" },
+ "cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" },
+ "cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
+ "cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" },
+ "diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" },
+ "export-colorscheme.nvim": { "branch": "master", "commit": "805bc285c9ba0e6da5c7c08fc89734f19d72e473" },
+ "flexoki": { "branch": "main", "commit": "975654bce67514114db89373539621cff42befb5" },
+ "friendly-snippets": { "branch": "main", "commit": "de8fce94985873666bd9712ea3e49ee17aadb1ed" },
+ "lazy.nvim": { "branch": "main", "commit": "cf8ecc2c5e4332760431a33534240b0cbc6680ab" },
+ "neogit": { "branch": "master", "commit": "001f43f50d9589d837cec59004fd92486ab06870" },
+ "nvim-cmp": { "branch": "main", "commit": "29fb4854573355792df9e156cb779f0d31308796" },
+ "nvim-lspconfig": { "branch": "master", "commit": "59a6766cbf32c7e4cf3ed685ccad7ffe1dde8c40" },
+ "nvim-surround": { "branch": "main", "commit": "dca2e998ff26681ee422b92c6ed39b3d2908d8a9" },
+ "nvim-treesitter": { "branch": "master", "commit": "39016abc99853c3e9d70f1bec7e2fa661b9a81bf" },
+ "nvim-web-devicons": { "branch": "master", "commit": "19d257cf889f79f4022163c3fbb5e08639077bd8" },
+ "plenary.nvim": { "branch": "master", "commit": "2d9b06177a975543726ce5c73fca176cedbffe9d" },
+ "telescope.nvim": { "branch": "master", "commit": "85922dde3767e01d42a08e750a773effbffaea3e" },
+ "vim-buftabline": { "branch": "master", "commit": "73b9ef5dcb6cdf6488bc88adb382f20bc3e3262a" },
+ "which-key.nvim": { "branch": "main", "commit": "8badb359f7ab8711e2575ef75dfe6fbbd87e4821" }
+}
diff --git a/.config/nvim/lua/options.lua b/.config/nvim/lua/options.lua
new file mode 100644
index 0000000..bd14907
--- /dev/null
+++ b/.config/nvim/lua/options.lua
@@ -0,0 +1,13 @@
+vim.o.number = true
+vim.o.relativenumber = true
+vim.o.timeout = true
+vim.o.timeoutlen = 300
+vim.o.softtabstop = 0
+
+vim.o.laststatus = 2
+vim.o.statusline = "%f %y%h%w%m%r%=%l:%c %P"
+
+vim.g.mapleader = " "
+vim.g.maplocalleader = " "
+
+vim.api.nvim_set_keymap('n', '\\', ':noh<cr>', {})
diff --git a/.config/nvim/lua/plugins/catppuccin.lua b/.config/nvim/lua/plugins/catppuccin.lua
new file mode 100644
index 0000000..155f929
--- /dev/null
+++ b/.config/nvim/lua/plugins/catppuccin.lua
@@ -0,0 +1,19 @@
+return {
+ { "jpe90/export-colorscheme.nvim", name = "export-colorscheme.nvim" },
+ { "kepano/flexoki-neovim", name = "flexoki" },
+ {
+ "catppuccin/nvim",
+ name = "catppuccin",
+ priority = 1000,
+ config = function()
+ require("catppuccin").setup({
+ flavour = "mocha",
+ integrations = {
+ neogit = true,
+ which_key = true,
+ },
+ })
+ vim.cmd.colorscheme("catppuccin")
+ end,
+ },
+}
diff --git a/.config/nvim/lua/plugins/cmp.lua b/.config/nvim/lua/plugins/cmp.lua
new file mode 100644
index 0000000..fc897eb
--- /dev/null
+++ b/.config/nvim/lua/plugins/cmp.lua
@@ -0,0 +1,95 @@
+return {
+ {
+ "hrsh7th/nvim-cmp",
+ dependencies = {
+ "hrsh7th/cmp-buffer",
+ "hrsh7th/cmp-path",
+ "nvim-lua/plenary.nvim",
+ "hrsh7th/cmp-nvim-lsp",
+ "saadparwaiz1/cmp_luasnip",
+ {
+ "L3MON4D3/LuaSnip",
+ dependencies = { "rafamadriz/friendly-snippets" },
+ config = function()
+ require("luasnip.loaders.from_vscode").lazy_load()
+ end,
+ },
+ },
+ event = "InsertEnter",
+ config = function()
+ local cmp = require("cmp")
+ local luasnip = require("luasnip")
+
+ cmp.setup({
+ mapping = cmp.mapping.preset.insert({
+ ["<C-b>"] = cmp.mapping.scroll_docs(-4),
+ ["<C-f>"] = cmp.mapping.scroll_docs(4),
+ ["<C-Space>"] = cmp.mapping.complete(),
+ ["<C-e>"] = cmp.mapping.abort(),
+ ["<CR>"] = cmp.mapping.confirm({ select = true }),
+ ["<Tab>"] = cmp.mapping(function(fallback)
+ if cmp.visible() then
+ cmp.select_next_item()
+ elseif luasnip.expand_or_jumpable() then
+ luasnip.expand_or_jump()
+ else
+ fallback()
+ end
+ end, { "i", "s" }),
+ ["<S-Tab>"] = cmp.mapping(function(fallback)
+ if cmp.visible() then
+ cmp.select_prev_item()
+ elseif luasnip.jumpable(-1) then
+ luasnip.jump(-1)
+ else
+ fallback()
+ end
+ end, { "i", "s" }),
+ }),
+ snippet = {
+ expand = function(args)
+ luasnip.lsp_expand(args.body)
+ end
+ },
+ sources = cmp.config.sources({
+ { name = "luasnip" },
+ { name = "nvim_lsp" },
+ { name = "path" },
+ }, {
+ { name = "buffer" },
+ }),
+ })
+ end,
+ },
+ {
+ "hrsh7th/cmp-cmdline",
+ dependencies = {
+ "hrsh7th/nvim-cmp",
+ "hrsh7th/cmp-buffer",
+ "hrsh7th/cmp-path",
+ },
+ event = "CmdlineEnter",
+ config = function()
+ local cmp = require("cmp")
+ cmp.setup.cmdline({ "/", "?" }, {
+ mapping = cmp.mapping.preset.cmdline(),
+ sources = cmp.config.sources({
+ { name = "buffer" },
+ }),
+ })
+ cmp.setup.cmdline(":", {
+ mapping = cmp.mapping.preset.cmdline(),
+ sources = cmp.config.sources({
+ { name = "path" },
+ }, {
+ {
+ name = "cmdline",
+ option = {
+ ignore_cmds = { "Man", "!" },
+ },
+ },
+ })
+ })
+ end,
+ },
+}
diff --git a/.config/nvim/lua/plugins/editor.lua b/.config/nvim/lua/plugins/editor.lua
new file mode 100644
index 0000000..7004143
--- /dev/null
+++ b/.config/nvim/lua/plugins/editor.lua
@@ -0,0 +1,4 @@
+return {
+ { "ap/vim-buftabline", event = "VeryLazy" },
+ { "kylechui/nvim-surround", event = "VeryLazy", opts = {} },
+}
diff --git a/.config/nvim/lua/plugins/git.lua b/.config/nvim/lua/plugins/git.lua
new file mode 100644
index 0000000..a435df7
--- /dev/null
+++ b/.config/nvim/lua/plugins/git.lua
@@ -0,0 +1,27 @@
+return {
+ {
+ "sindrets/diffview.nvim",
+ cmd = {
+ "DiffviewLog",
+ "DiffviewOpen",
+ "DiffviewClose",
+ "DiffviewRefresh",
+ "DiffviewFocusFiles",
+ "DiffviewFileHistory",
+ "DiffviewToggleFiles",
+ },
+ },
+ {
+ "NeogitOrg/neogit",
+ dependencies = {
+ "nvim-lua/plenary.nvim",
+ "sindrets/diffview.nvim",
+ },
+ cmd = "Neogit",
+ opts = {
+ integrations = {
+ diffview = true,
+ },
+ },
+ },
+}
diff --git a/.config/nvim/lua/plugins/lsp.lua b/.config/nvim/lua/plugins/lsp.lua
new file mode 100644
index 0000000..7a67265
--- /dev/null
+++ b/.config/nvim/lua/plugins/lsp.lua
@@ -0,0 +1,64 @@
+return {
+ {
+ "neovim/nvim-lspconfig",
+ dependencies = {
+ "hrsh7th/cmp-nvim-lsp",
+ },
+ event = { "BufReadPre", "BufNewFile" },
+ config = function()
+ local lspconfig = require("lspconfig")
+ local capabilities = require("cmp_nvim_lsp").default_capabilities()
+ local common = {
+ capabilities = capabilities,
+ }
+
+ local lsps = {
+ "gopls",
+ "lua_ls",
+ "pylsp",
+ "ts_ls",
+ "cssls",
+ "html",
+ }
+
+ for _, lsp in ipairs(lsps) do
+ lspconfig[lsp].setup(common)
+ end
+
+ local wk = require("which-key")
+ wk.register({
+ { "[d", vim.diagnostic.goto_prev, desc = "Previous diagnostic" },
+ { "]d", vim.diagnostic.goto_next, desc = "Next diagnostic" },
+ })
+
+ vim.api.nvim_create_autocmd("LspAttach", {
+ group = vim.api.nvim_create_augroup("UserLspConfig", {}),
+ callback = function(ev)
+ wk.register({
+ { "gD", vim.lsp.buf.declaration, desc = "Go to declaration" },
+ { "gd", vim.lsp.buf.definition, desc = "Go to definition" },
+ { "gr", vim.lsp.buf.references, desc = "Go to references" },
+ { "gi", vim.lsp.buf.implementation, desc = "Go to implementation" },
+ { "K", vim.lsp.buf.hover, desc = "Show LSP hover info" },
+ { "<C-k>", vim.lsp.buf.signature_help, desc = "Show signature help" },
+ { "<leader>D", vim.lsp.buf.type_definition, desc = "Type definition" },
+ { "<leader>rn", vim.lsp.buf.rename, desc = "Rename" },
+ { "<leader>ca", vim.lsp.buf.code_action, desc = "Code action" },
+ { "<leader>F", function() vim.lsp.buf.format({ async = true }) end, desc = "Format buffer" },
+ ["<leader>w"] = {
+ name = "+LSP workspace",
+ a = { vim.lsp.buf.add_workspace_folder, "Add workspace folder" },
+ r = { vim.lsp.buf.remove_workspace_folder, "Remove workspace folder" },
+ l = {
+ function()
+ print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
+ end,
+ "List workspace folders",
+ },
+ },
+ }, {buffer=ev.buf})
+ end,
+ })
+ end,
+ },
+}
diff --git a/.config/nvim/lua/plugins/telescope.lua b/.config/nvim/lua/plugins/telescope.lua
new file mode 100644
index 0000000..8dfcce3
--- /dev/null
+++ b/.config/nvim/lua/plugins/telescope.lua
@@ -0,0 +1,17 @@
+return {
+ {
+ "nvim-telescope/telescope.nvim",
+ dependencies = {
+ "nvim-lua/plenary.nvim",
+ "nvim-tree/nvim-web-devicons",
+ },
+ keys = {
+ { "<leader>ff", "<cmd>Telescope find_files<cr>", desc = "Find files" },
+ { "<leader>fF", "<cmd>Telescope git_files<cr>", desc = "Find git files" },
+ { "<leader>fg", "<cmd>Telescope live_grep<cr>", desc = "Live grep" },
+ { "<leader>fb", "<cmd>Telescope buffers<cr>", desc = "Find buffers" },
+ { "<leader>fh", "<cmd>Telescope help_tags<cr>", desc = "Help tags" },
+ },
+ cmd = "Telescope",
+ },
+}
diff --git a/.config/nvim/lua/plugins/treesitter.lua b/.config/nvim/lua/plugins/treesitter.lua
new file mode 100644
index 0000000..fe48d9f
--- /dev/null
+++ b/.config/nvim/lua/plugins/treesitter.lua
@@ -0,0 +1,35 @@
+return {
+ {
+ "nvim-treesitter/nvim-treesitter",
+ event = { "BufReadPre", "BufNewFile" },
+ config = function()
+ require("nvim-treesitter.configs").setup({
+ auto_install = true,
+ ensure_installed = {
+ "bash",
+ "clojure",
+ "css",
+ "html",
+ "ini",
+ "javascript",
+ "json",
+ "kotlin",
+ "lua",
+ "markdown",
+ "perl",
+ "python",
+ "regex",
+ "rust",
+ "scss",
+ "sql",
+ "svelte",
+ "toml",
+ "tsx",
+ "typescript",
+ "yaml",
+ },
+ highlight = { enable = true },
+ })
+ end,
+ },
+}
diff --git a/.config/nvim/lua/plugins/which-key.lua b/.config/nvim/lua/plugins/which-key.lua
new file mode 100644
index 0000000..f636915
--- /dev/null
+++ b/.config/nvim/lua/plugins/which-key.lua
@@ -0,0 +1,9 @@
+return {
+ "folke/which-key.nvim",
+ event = "VeryLazy",
+ config = function()
+ require("which-key").register({
+ { "<leader>f", group = "Telescope" },
+ })
+ end,
+}