From e3054f843f7ed05d7bc94a905f36af18676a8fd2 Mon Sep 17 00:00:00 2001 From: cln6 Date: Sun, 5 Jul 2026 13:54:24 +0000 Subject: [PATCH] a --- README.md | 1 + init.lua | 9 +++ lua/config/keybinds.lua | 8 +++ lua/config/options.lua | 30 ++++++++++ lua/config/test.nix | 0 lua/plugins/catppuccin.lua | 3 + lua/plugins/lsp.lua | 87 +++++++++++++++++++++++++++ lua/plugins/lualine.lua | 10 ++++ lua/plugins/nvim-tree.lua | 36 ++++++++++++ lua/plugins/other-plugins.lua | 9 +++ lua/plugins/telescope.lua | 11 ++++ lua/plugins/treesitter.lua | 19 ++++++ nvim-pack-lock.json | 108 ++++++++++++++++++++++++++++++++++ 13 files changed, 331 insertions(+) create mode 100644 README.md create mode 100644 init.lua create mode 100644 lua/config/keybinds.lua create mode 100644 lua/config/options.lua create mode 100644 lua/config/test.nix create mode 100644 lua/plugins/catppuccin.lua create mode 100644 lua/plugins/lsp.lua create mode 100644 lua/plugins/lualine.lua create mode 100644 lua/plugins/nvim-tree.lua create mode 100644 lua/plugins/other-plugins.lua create mode 100644 lua/plugins/telescope.lua create mode 100644 lua/plugins/treesitter.lua create mode 100644 nvim-pack-lock.json diff --git a/README.md b/README.md new file mode 100644 index 0000000..f18afe9 --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +My neovim configuration files, work in progress this is just a temporary repo diff --git a/init.lua b/init.lua new file mode 100644 index 0000000..2d32bbd --- /dev/null +++ b/init.lua @@ -0,0 +1,9 @@ +require("config.options") +require("config.keybinds") +require("plugins.telescope") +require("plugins.catppuccin") +require("plugins.lualine") +require("plugins.treesitter") +require("plugins.lsp") +require("plugins.nvim-tree") +require("plugins.other-plugins") diff --git a/lua/config/keybinds.lua b/lua/config/keybinds.lua new file mode 100644 index 0000000..b8382fd --- /dev/null +++ b/lua/config/keybinds.lua @@ -0,0 +1,8 @@ +-- Keybinds +vim.g.mapleader = " " + +-- Source +vim.keymap.set("n", "", vim.cmd.so) + +-- Navigation +vim.keymap.set("n", "q", "l") diff --git a/lua/config/options.lua b/lua/config/options.lua new file mode 100644 index 0000000..913402a --- /dev/null +++ b/lua/config/options.lua @@ -0,0 +1,30 @@ +-- vim.options by default +local set = vim.opt + +-- indentation related +set.shiftwidth = 4 +set.tabstop = 4 +set.autoindent = true +set.expandtab = true + +-- line numbers +set.number = true + +-- appearance +set.ignorecase = true +set.smartcase = true +set.cursorline = true +set.updatetime = 50 + +-- searching +set.ignorecase = true +set.smartcase = true +set.incsearch = true + +-- clipboard +set.clipboard:append("unnamedplus") + +-- undo dir +set.swapfile = false +set.backup = false +set.undofile = true diff --git a/lua/config/test.nix b/lua/config/test.nix new file mode 100644 index 0000000..e69de29 diff --git a/lua/plugins/catppuccin.lua b/lua/plugins/catppuccin.lua new file mode 100644 index 0000000..2b46808 --- /dev/null +++ b/lua/plugins/catppuccin.lua @@ -0,0 +1,3 @@ +vim.pack.add { { src = "https://github.com/catppuccin/nvim", name = "catppuccin" } } +vim.cmd.colorscheme "catppuccin-mocha" +-- vim.api.nvim_set_hl(0, "Normal", { bg = "none" }) diff --git a/lua/plugins/lsp.lua b/lua/plugins/lsp.lua new file mode 100644 index 0000000..af4d18f --- /dev/null +++ b/lua/plugins/lsp.lua @@ -0,0 +1,87 @@ +vim.pack.add({ + 'https://github.com/neovim/nvim-lspconfig', + -- Autocompletion + 'https://github.com/hrsh7th/cmp-nvim-lsp', + 'https://github.com/hrsh7th/cmp-buffer', + 'https://github.com/hrsh7th/cmp-path', + 'https://github.com/hrsh7th/cmp-cmdline', + 'https://github.com/hrsh7th/nvim-cmp', + -- Snippets + 'https://github.com/hrsh7th/cmp-vsnip', + 'https://github.com/hrsh7th/vim-vsnip', + 'https://github.com/L3MON4D3/LuaSnip', + 'https://github.com/saadparwaizl/cmp_luasnip', + -- github + 'https://github.com/petertriho/cmp-git' +}) + +-- Set up nvim-cmp. +local cmp = require 'cmp' + +cmp.setup({ + snippet = { + -- REQUIRED - you must specify a snippet engine + expand = function(args) + vim.fn["vsnip#anonymous"](args.body) -- For `vsnip` users. + require('luasnip').lsp_expand(args.body) -- For `luasnip` users. + vim.snippet.expand(args.body) -- For native neovim snippets (Neovim v0.10+) + end, + }, + window = { + completion = cmp.config.window.bordered(), + documentation = cmp.config.window.bordered(), + }, + mapping = cmp.mapping.preset.insert({ + [''] = cmp.mapping.scroll_docs(-4), + [''] = cmp.mapping.scroll_docs(4), + [''] = cmp.mapping.complete(), + [''] = cmp.mapping.abort(), + [''] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. + }), + sources = cmp.config.sources({ + { name = 'nvim_lsp' }, + { name = 'luasnip' }, -- For luasnip users. + }, { + { name = 'buffer' }, + }) +}) + +cmp.setup.filetype('gitcommit', { + sources = cmp.config.sources({ + { name = 'git' }, + }, { + { name = 'buffer' }, + }) +}) +require("cmp_git").setup() + +-- Use buffer source for `/` and `?` (if you enabled `native_menu`, this won't work anymore). +cmp.setup.cmdline({ '/', '?' }, { + mapping = cmp.mapping.preset.cmdline(), + sources = { + { name = 'buffer' } + } +}) + +-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore). +cmp.setup.cmdline(':', { + mapping = cmp.mapping.preset.cmdline(), + sources = cmp.config.sources({ + { name = 'path' } + }, { + { name = 'cmdline' } + }), + matching = { disallow_symbol_nonprefix_matching = false } +}) + +-- Set up lspconfig. +local capabilities = require('cmp_nvim_lsp').default_capabilities() +vim.lsp.config('lua_ls', { + capabilities = capabilities +}) +vim.lsp.config('nixd', { + cmd = { "nixd" }, + filetypes = { "nix" }, + capabilities = capabilities +}) +vim.lsp.enable({ "lua_ls", "nixd" }) diff --git a/lua/plugins/lualine.lua b/lua/plugins/lualine.lua new file mode 100644 index 0000000..114aa24 --- /dev/null +++ b/lua/plugins/lualine.lua @@ -0,0 +1,10 @@ +vim.pack.add({ + 'https://github.com/nvim-tree/nvim-web-devicons', + 'https://github.com/nvim-lualine/lualine.nvim' +}) +require('lualine').setup { + options = { + theme = 'catppuccin-mocha', + icons_enabled = true + } +} diff --git a/lua/plugins/nvim-tree.lua b/lua/plugins/nvim-tree.lua new file mode 100644 index 0000000..1d0174a --- /dev/null +++ b/lua/plugins/nvim-tree.lua @@ -0,0 +1,36 @@ +vim.pack.add({ + { src = 'https://github.com/nvim-tree/nvim-web-devicons' }, -- optional + { src = 'https://github.com/nvim-tree/nvim-tree.lua' }, +}) + + -- disable netrw at the very start of your init.lua + vim.g.loaded_netrw = 1 + vim.g.loaded_netrwPlugin = 1 + + -- optionally enable 24-bit colour + vim.opt.termguicolors = true + + -- empty setup using defaults + require("nvim-tree").setup() + + -- OR setup with a config + + ---@type nvim_tree.config + local config = { + sort = { + sorter = "case_sensitive", + }, + view = { + width = 30, + }, + renderer = { + group_empty = true, + }, + filters = { + dotfiles = true, + }, + } + require("nvim-tree").setup(config) + +vim.keymap.set("n", "e", vim.cmd.NvimTreeFocus) +vim.keymap.set("n", "q", vim.cmd.NvimTreeCollapse) diff --git a/lua/plugins/other-plugins.lua b/lua/plugins/other-plugins.lua new file mode 100644 index 0000000..963eaf7 --- /dev/null +++ b/lua/plugins/other-plugins.lua @@ -0,0 +1,9 @@ +vim.pack.add ({ + 'https://github.com/ojroques/vim-oscyank', -- Shared ssh clipboard + 'https://github.com/tpope/vim-fugitive', -- Git plugin + 'https://github.com/brenoprata10/nvim-highlight-colors' -- Shows CSS colors when editing files +}) + +-- CSS colors +vim.opt.termguicolors = true +require('nvim-highlight-colors').setup({}) diff --git a/lua/plugins/telescope.lua b/lua/plugins/telescope.lua new file mode 100644 index 0000000..3833912 --- /dev/null +++ b/lua/plugins/telescope.lua @@ -0,0 +1,11 @@ +vim.pack.add({ + 'https://github.com/nvim-telescope/telescope.nvim', + 'https://github.com/nvim-lua/plenary.nvim', + 'https://github.com/nvim-telescope/telescope-fzf-native.nvim', + 'https://github.com/nvim-tree/nvim-web-devicons' +}) +local builtin = require('telescope.builtin') +vim.keymap.set('n', 'ff', builtin.find_files, { desc = 'Telescope find files' }) +vim.keymap.set('n', 'fg', builtin.live_grep, { desc = 'Telescope live grep' }) +vim.keymap.set('n', 'fb', builtin.buffers, { desc = 'Telescope buffers' }) +vim.keymap.set('n', 'fh', builtin.help_tags, { desc = 'Telescope help tags' }) diff --git a/lua/plugins/treesitter.lua b/lua/plugins/treesitter.lua new file mode 100644 index 0000000..fc704d2 --- /dev/null +++ b/lua/plugins/treesitter.lua @@ -0,0 +1,19 @@ +vim.pack.add ({ + 'https://github.com/nvim-treesitter/nvim-treesitter' +}) + +require('nvim-treesitter').setup { + -- Directory to install parsers and queries to (prepended to `runtimepath` to have priority) + install_dir = vim.fn.stdpath('data') .. '/site' +} +-- Required parsers and queries +require('nvim-treesitter').install { 'lua', 'nix', 'javascript', 'html', 'css', 'c', 'cpp', 'python', 'kdl', 'markdown' } + +-- Syntax highlighting +vim.api.nvim_create_autocmd('FileType', { + pattern = { 'lua', 'nix', 'javascript', 'html', 'css', 'c', 'cpp', 'python', 'kdl', 'markdown' }, + callback = function() vim.treesitter.start() end, +}) + +-- Auto indentation +vim.bo.indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()" diff --git a/nvim-pack-lock.json b/nvim-pack-lock.json new file mode 100644 index 0000000..cad1b2b --- /dev/null +++ b/nvim-pack-lock.json @@ -0,0 +1,108 @@ +{ + "plugins": { + "LuaSnip": { + "rev": "0abc8f390b278c3b4aabc4c004ac8a088b65cf24", + "src": "https://github.com/L3MON4D3/LuaSnip" + }, + "blink.cmp": { + "rev": "9dcb1f3a9164f10c8950a790aace576f2e89dc78", + "src": "https://github.com/Saghen/blink.cmp" + }, + "blink.lib": { + "rev": "5876dd95deeb70aadbe9f1c0b7117a135061cdac", + "src": "https://github.com/Saghen/blink.lib" + }, + "catppuccin": { + "rev": "e068ab5f8261f23f6f71ffd8791ae40315b77b9c", + "src": "https://github.com/catppuccin/nvim" + }, + "cmp-buffer": { + "rev": "b74fab3656eea9de20a9b8116afa3cfc4ec09657", + "src": "https://github.com/hrsh7th/cmp-buffer" + }, + "cmp-cmdline": { + "rev": "d126061b624e0af6c3a556428712dd4d4194ec6d", + "src": "https://github.com/hrsh7th/cmp-cmdline" + }, + "cmp-git": { + "rev": "e645f69b93eede43fb644bb1a0b1db3eef1108a3", + "src": "https://github.com/petertriho/cmp-git" + }, + "cmp-nvim-lsp": { + "rev": "cbc7b02bb99fae35cb42f514762b89b5126651ef", + "src": "https://github.com/hrsh7th/cmp-nvim-lsp" + }, + "cmp-path": { + "rev": "c642487086dbd9a93160e1679a1327be111cbc25", + "src": "https://github.com/hrsh7th/cmp-path" + }, + "cmp-vsnip": { + "rev": "989a8a73c44e926199bfd05fa7a516d51f2d2752", + "src": "https://github.com/hrsh7th/cmp-vsnip" + }, + "cmp_luasnip": { + "rev": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90", + "src": "https://github.com/saadparwaiz1/cmp_luasnip" + }, + "fd": { + "rev": "fb1486f210885ae663338ebfab4e70210abc4809", + "src": "https://github.com/sharkdp/fd" + }, + "friendly-snippets": { + "rev": "6cd7280adead7f586db6fccbd15d2cac7e2188b9", + "src": "https://github.com/rafamadriz/friendly-snippets" + }, + "lualine.nvim": { + "rev": "221ce6b2d999187044529f49da6554a92f740a96", + "src": "https://github.com/nvim-lualine/lualine.nvim" + }, + "nvim-cmp": { + "rev": "a1d504892f2bc56c2e79b65c6faded2fd21f3eca", + "src": "https://github.com/hrsh7th/nvim-cmp" + }, + "nvim-highlight-colors": { + "rev": "e4c7af0211866162d999ce0bdd6a029302e19139", + "src": "https://github.com/brenoprata10/nvim-highlight-colors" + }, + "nvim-lspconfig": { + "rev": "d224a1920728ba129880efc700d4a0180ac4ecbb", + "src": "https://github.com/neovim/nvim-lspconfig" + }, + "nvim-tree.lua": { + "rev": "7ff7040bf6c246671eb55cb1727de4fd9f92a106", + "src": "https://github.com/nvim-tree/nvim-tree.lua" + }, + "nvim-treesitter": { + "rev": "4916d6592ede8c07973490d9322f187e07dfefac", + "src": "https://github.com/nvim-treesitter/nvim-treesitter" + }, + "nvim-web-devicons": { + "rev": "dad71387de386a946b123079d0e53f23028f3abd", + "src": "https://github.com/nvim-tree/nvim-web-devicons" + }, + "plenary.nvim": { + "rev": "74b06c6c75e4eeb3108ec01852001636d85a932b", + "src": "https://github.com/nvim-lua/plenary.nvim" + }, + "telescope-fzf-native.nvim": { + "rev": "b25b749b9db64d375d782094e2b9dce53ad53a40", + "src": "https://github.com/nvim-telescope/telescope-fzf-native.nvim" + }, + "telescope.nvim": { + "rev": "427b576c16792edad01a92b89721d923c19ad60f", + "src": "https://github.com/nvim-telescope/telescope.nvim" + }, + "vim-fugitive": { + "rev": "3b753cf8c6a4dcde6edee8827d464ba9b8c4a6f0", + "src": "https://github.com/tpope/vim-fugitive" + }, + "vim-oscyank": { + "rev": "d67d76b2f19b868b70a1cf33a779d71dc092cb30", + "src": "https://github.com/ojroques/vim-oscyank" + }, + "vim-vsnip": { + "rev": "9bcfabea653abdcdac584283b5097c3f8760abaa", + "src": "https://github.com/hrsh7th/vim-vsnip" + } + } +}