diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua index 9705ad0..5670a7d 100644 --- a/.config/nvim/init.lua +++ b/.config/nvim/init.lua @@ -1,47 +1,54 @@ -- Basic settings -vim.o.number = true -- Enable line numbers -vim.o.relativenumber = true -- Enable relative line numbers -vim.o.tabstop = 4 -- Number of spaces a tab represents -vim.o.shiftwidth = 4 -- Number of spaces for each indentation -vim.o.expandtab = true -- Convert tabs to spaces -vim.o.smartindent = true -- Automatically indent new lines -vim.o.wrap = false -- Disable line wrapping -vim.o.cursorline = true -- Highlight the current line -vim.o.termguicolors = true -- Enable 24-bit RGB colors +vim.o.number = true -- Enable line numbers +-- vim.o.relativenumber = true -- Enable relative line numbers +vim.o.tabstop = 2 -- Number of spaces a tab represents +vim.o.shiftwidth = 2 -- Number of spaces for each indentation +vim.o.expandtab = true -- Convert tabs to spaces +vim.o.smartindent = true -- Automatically indent new lines +vim.o.wrap = false -- Disable line wrapping +vim.o.cursorline = true -- Highlight the current line +vim.o.termguicolors = true -- Enable 24-bit RGB colors vim.o.clipboard = "unnamedplus" vim.filetype.add({ extension = { svx = "markdown" } }) +vim.opt.listchars = { tab = "\\│\\", nbsp = "␣", trail = "·", extends = "›", precedes = "‹", leadmultispace = "│ " } +vim.opt.list = true require('plugins.nvim-neo-tree') require('plugins.rose-pine') require('plugins.treesitter') require('plugins.conform') require('plugins.lsp') +require('plugins.diffview') +require('plugins.which-key') +require('plugins.codecompanion') vim.cmd('syntax enable') vim.api.nvim_create_user_command( - "Inlay", - function() - vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled()) - end, - { desc = 'Toggles Inlay Hints' } + "Inlay", + function() + vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled()) + end, + { desc = 'Toggles Inlay Hints' } ) vim.api.nvim_create_autocmd('LspAttach', { - callback = function(ev) - local client = vim.lsp.get_client_by_id(ev.data.client_id) - if client and client:supports_method(vim.lsp.protocol.Methods.textDocument_completion) then - vim.opt.completeopt = { 'menu', 'menuone', 'noinsert', 'fuzzy', 'popup' } - vim.lsp.completion.enable(true, client.id, ev.buf, { autotrigger = true }) - vim.keymap.set('i', '', function() - vim.lsp.completion.get() - end) - end - end, + callback = function(ev) + local client = vim.lsp.get_client_by_id(ev.data.client_id) + if client and client:supports_method(vim.lsp.protocol.Methods.textDocument_completion) then + vim.opt.completeopt = { 'menu', 'menuone', 'noinsert', 'fuzzy', 'popup' } + vim.lsp.completion.enable(true, client.id, ev.buf, { autotrigger = true }) + vim.keymap.set('i', '', function() + vim.lsp.completion.get() + end) + end + end, }) vim.diagnostic.config({ - virtual_lines = { - current_line = true, - }, + virtual_lines = { + current_line = true, + }, }) + +vim.cmd.source("~/.config/nvim/.vimrc") diff --git a/.config/nvim/lua/plugins/codecompanion.lua b/.config/nvim/lua/plugins/codecompanion.lua new file mode 100644 index 0000000..45cc3ac --- /dev/null +++ b/.config/nvim/lua/plugins/codecompanion.lua @@ -0,0 +1,14 @@ +vim.pack.add({ { + src = "https://www.github.com/olimorris/codecompanion.nvim", + version = vim.version.range("^19.0.0") +} }) + +-- Somewhere in your config +require("codecompanion").setup({ + interactions = { + chat = { + adapter = "ollama", + model = "qwen2.5-coder:7b " + }, + }, +}) diff --git a/.config/nvim/lua/plugins/conform.lua b/.config/nvim/lua/plugins/conform.lua index 428cdf7..08ef4ac 100644 --- a/.config/nvim/lua/plugins/conform.lua +++ b/.config/nvim/lua/plugins/conform.lua @@ -1,24 +1,26 @@ vim.pack.add({ - 'https://github.com/stevearc/conform.nvim' + 'https://github.com/stevearc/conform.nvim' }) require('conform').setup({ - formatters_by_ft = { - cpp = { "clang-format" }, - python = { "black" } - }, - -- Set default options - default_format_opts = { - lsp_format = "fallback", - }, - -- Set up format-on-save - format_on_save = { timeout_ms = 1000 }, - -- Customize formatters - formatters = { - ['clang-format'] = { - append_args = function(self, ctx) - return { "-style={IndentWidth: 4}" } - end, - }, - }, + formatters_by_ft = { + cpp = { "clang-format" }, + python = { "black" }, + typescript = { "prettier" }, + typescriptreact = { "prettier" }, + }, + -- Set default options + default_format_opts = { + lsp_format = "fallback", + }, + -- Set up format-on-save + format_on_save = { timeout_ms = 10000 }, + -- Customize formatters + formatters = { + -- ['clang-format'] = { + -- append_args = function(self, ctx) + -- return { "-style={IndentWidth: 4}" } + -- end, + -- }, + }, }) diff --git a/.config/nvim/lua/plugins/diffview.lua b/.config/nvim/lua/plugins/diffview.lua new file mode 100644 index 0000000..6248f37 --- /dev/null +++ b/.config/nvim/lua/plugins/diffview.lua @@ -0,0 +1,6 @@ +vim.pack.add({ + 'https://github.com/sindrets/diffview.nvim', +}) + +require('diffview').setup({ +}) diff --git a/.config/nvim/lua/plugins/lsp.lua b/.config/nvim/lua/plugins/lsp.lua index 1a71aa0..b990dfe 100644 --- a/.config/nvim/lua/plugins/lsp.lua +++ b/.config/nvim/lua/plugins/lsp.lua @@ -1,25 +1,29 @@ vim.pack.add({ - 'https://github.com/neovim/nvim-lspconfig', - 'https://github.com/mason-org/mason.nvim', - 'https://github.com/mason-org/mason-lspconfig.nvim', + 'https://github.com/neovim/nvim-lspconfig', + 'https://github.com/mason-org/mason.nvim', + 'https://github.com/mason-org/mason-lspconfig.nvim', }) require('mason').setup({ - ui = { - icons = { - package_installed = "✓", - package_pending = "➜", - package_uninstalled = "✗" - } + ui = { + icons = { + package_installed = "✓", + package_pending = "➜", + package_uninstalled = "✗" } + } }) require('mason-lspconfig').setup({ - ensure_installed = { - "svelte", - "clangd", - "ts_ls", - "pyright", - "lua_ls" - }, - automatic_enable = true, + ensure_installed = { + "svelte", + "clangd", + "ts_ls", + "pyright", + "lua_ls" + }, + automatic_enable = true, +}) +vim.lsp.config('svelte', { + -- capabilities = svelte_lsp_capabilities, + filetypes = { "svelte" }, }) diff --git a/.config/nvim/lua/plugins/treesitter.lua b/.config/nvim/lua/plugins/treesitter.lua index 2c65ae2..0909d9b 100644 --- a/.config/nvim/lua/plugins/treesitter.lua +++ b/.config/nvim/lua/plugins/treesitter.lua @@ -1,11 +1,18 @@ vim.pack.add({ - 'https://github.com/nvim-treesitter/nvim-treesitter' + 'https://github.com/nvim-treesitter/nvim-treesitter' }) -require('nvim-treesitter').setup({}) -require('nvim-treesitter').install( {'lua','rust', 'javascript', 'zig', "c","typescript", "cpp","haskell","svelte","python", "vim", "vimdoc", "html" }) +require('nvim-treesitter').setup({ + highlight = { + enable = true + }, +}) +require('nvim-treesitter').install({ 'lua', 'rust', 'javascript', 'zig', "c", "typescript", "cpp", "haskell", "svelte", + "python", "vim", "vimdoc", "html", "wgsl" }) vim.api.nvim_create_autocmd('FileType', { - pattern = { 'python', 'lua' }, - callback = function() vim.treesitter.start() end, + callback = function(args) + pcall(vim.treesitter.start, args.buf) + end, }) +vim.filetype.add({ extension = { wgsl = "wgsl" } }) diff --git a/.config/nvim/lua/plugins/which-key.lua b/.config/nvim/lua/plugins/which-key.lua new file mode 100644 index 0000000..7c74a25 --- /dev/null +++ b/.config/nvim/lua/plugins/which-key.lua @@ -0,0 +1,7 @@ +vim.pack.add({ + 'https://github.com/folke/which-key.nvim', +}) + +require("which-key").setup({ + +})