diff --git a/init.lua b/init.lua index cde3649..cb91e47 100644 --- a/init.lua +++ b/init.lua @@ -1,67 +1,69 @@ -if vim.g.vscode then - local vscode = require('vscode') - - vim.g.mapleader = " " - vim.cmd("set clipboard+=unnamedplus") - vim.g.clipboard = vim.g.vscode_clipboard - - local k = function(mode, lhs, rhs) - vim.keymap.set(mode, lhs, rhs, { expr = true }) -- expr is required - end - - k("n", "gf", function() - vscode.action("editor.action.formatDocument") - end) - - k("n", "K", function() - vscode.action("editor.action.showDefinitionPreviewHover") - end) - - k("n", "gD", function() - vscode.action("editor.action.goToImplementation") - end) - - k("n", "ca", function() - vscode.call("editor.action.quickFix") - end) - - k("n", "dd", function() - vscode.call("workbench.actions.view.toggleProblems") - end) - - k("n", "e", function() - vscode.call("workbench.view.explorer") - end) - - k("v", "gc", function() - vscode.call("editor.action.commentLine", { - restore_selection=false - }) - end) - - k("n", "gcc", function() - vscode.call("editor.action.commentLine", { - restore_selection=false - }) - end) - - k("n", "cr", function() - vscode.call("editor.action.rename") - end) -else - local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" - if not (vim.uv or vim.loop).fs_stat(lazypath) then - vim.fn.system({ - "git", - "clone", - "--filter=blob:none", - "https://github.com/folke/lazy.nvim.git", - "--branch=stable", -- latest stable release - lazypath, - }) - end - vim.opt.rtp:prepend(lazypath) - - require("vim-options") - require("lazy").setup("plugins") +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" +if not (vim.uv or vim.loop).fs_stat(lazypath) then + vim.fn.system({ + "git", + "clone", + "--filter=blob:none", + "https://github.com/folke/lazy.nvim.git", + "--branch=stable", -- latest stable release + lazypath, + }) end +vim.opt.rtp:prepend(lazypath) + +require("vim-options") +require("lazy").setup("plugins") + +-- Panes +vim.cmd.set("splitright") +vim.keymap.set("n", "/", function() + vim.cmd.vnew() +end) + +vim.cmd.set("splitbelow") +vim.keymap.set("n", "-", function() + vim.cmd.new() +end) + +vim.api.nvim_set_keymap('n', '', ':wincmd k', { noremap = true, silent = true }); +vim.api.nvim_set_keymap('n', '', ':wincmd h', { noremap = true, silent = true }); +vim.api.nvim_set_keymap('n', '', ':wincmd j', { noremap = true, silent = true }); +vim.api.nvim_set_keymap('n', '', ':wincmd l', { noremap = true, silent = true }); + +vim.api.nvim_set_keymap('n', 'gb', ':bnext', { noremap = true, silent = true }); + +vim.api.nvim_set_keymap('t', '', '', { noremap = true, silent = true }); +vim.api.nvim_create_autocmd('TermOpen', { + group = vim.api.nvim_create_augroup('custom-term-open', { clear = true }), + callback = function() + vim.opt.number = false + vim.opt.relativenumber = false + end, +}); + + +-- Telescope +local builtin = require("telescope.builtin") +vim.keymap.set('n', '', builtin.find_files, {}) +vim.keymap.set('n', 'fg', builtin.live_grep, {}) +vim.keymap.set('n', 'gl', builtin.lsp_references, {}) +vim.keymap.set('n', 'd', builtin.diagnostics, {}) + +-- Formating +vim.keymap.set("n", "gf", vim.lsp.buf.format, {}) + +-- Neotree +vim.keymap.set("n", "", ":Neotree filesystem reveal right toggle", {}) + +-- Neotest +vim.keymap.set("n", "no", require("neotest").output.open, {}) + +-- Lsp Config +vim.keymap.set("n", "K", vim.lsp.buf.hover, {}) +vim.keymap.set("n", "gd", vim.lsp.buf.definition, {}) +vim.keymap.set({ "n", "v" }, "ca", vim.lsp.buf.code_action, {}) +vim.keymap.set("n", "cr", vim.lsp.buf.rename, {}) +vim.keymap.set("n", "K", vim.lsp.buf.hover, {}) +vim.keymap.set("n", "gd", vim.lsp.buf.definition, {}) +vim.keymap.set({ "n", "v" }, "ca", vim.lsp.buf.code_action, {}) +vim.keymap.set("n", "cr", vim.lsp.buf.rename, {}) diff --git a/lazy-lock.json b/lazy-lock.json index d006e89..5efda7e 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -1,4 +1,5 @@ { + "FixCursorHold.nvim": { "branch": "master", "commit": "1900f89dc17c603eec29960f57c00bd9ae696495" }, "LuaSnip": { "branch": "master", "commit": "5a1e39223db9a0498024a77b8441169d260c8c25" }, "catppuccin": { "branch": "main", "commit": "234fc048de931a0e42ebcad675bf6559d75e23df" }, "cmp-nvim-lsp": { "branch": "main", "commit": "bd5a7d6db125d4654b50eeae9f5217f24bb22fd3" }, @@ -9,14 +10,17 @@ "mason-lspconfig.nvim": { "branch": "main", "commit": "d7b5feb6e769e995f7fcf44d92f49f811c51d10c" }, "mason.nvim": { "branch": "main", "commit": "ad7146aa61dcaeb54fa900144d768f040090bff0" }, "neo-tree.nvim": { "branch": "v3.x", "commit": "8cdd6b1940f333c1dd085526a9c45b30fb2dbf50" }, + "neotest": { "branch": "master", "commit": "366175e1e74ff112787f9adbfb072eeaedd2a88e" }, + "neotest-python": { "branch": "master", "commit": "b0d3a861bd85689d8ed73f0590c47963a7eb1bf9" }, "none-ls.nvim": { "branch": "main", "commit": "550197530c12b4838d685cf4e0d5eb4cca8d52c7" }, "nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" }, "nvim-cmp": { "branch": "main", "commit": "106c4bcc053a5da783bf4a9d907b6f22485c2ea0" }, "nvim-lspconfig": { "branch": "master", "commit": "2010fc6ec03e2da552b4886fceb2f7bc0fc2e9c0" }, + "nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" }, "nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" }, "nvim-web-devicons": { "branch": "master", "commit": "8dcb311b0c92d460fac00eac706abd43d94d68af" }, "plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" }, "telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" }, "telescope.nvim": { "branch": "master", "commit": "6312868392331c9c0f22725041f1ec2bef57c751" }, - "trouble.nvim": { "branch": "main", "commit": "bd67efe408d4816e25e8491cc5ad4088e708a69a" } + "tiny-inline-diagnostic.nvim": { "branch": "main", "commit": "63dd87d195f28e01732e121c5ddfc0a74ccff54a" } } diff --git a/lua/plugins/lsp-config.lua b/lua/plugins/lsp-config.lua index fcc2c4f..9b7b019 100644 --- a/lua/plugins/lsp-config.lua +++ b/lua/plugins/lsp-config.lua @@ -17,7 +17,7 @@ return { "lua_ls", "gopls", "html", - "pyright", + "basedpyright", "clangd", "yamlls", "ansiblels", @@ -42,9 +42,5 @@ return { } }) - vim.keymap.set("n", "K", vim.lsp.buf.hover, {}) - vim.keymap.set("n", "gd", vim.lsp.buf.definition, {}) - vim.keymap.set({ "n", "v" }, "ca", vim.lsp.buf.code_action, {}) - vim.keymap.set("n", "cr", vim.lsp.buf.rename, {}) end, } diff --git a/lua/plugins/neotest.lua b/lua/plugins/neotest.lua new file mode 100644 index 0000000..36a04c0 --- /dev/null +++ b/lua/plugins/neotest.lua @@ -0,0 +1,18 @@ +return { + "nvim-neotest/neotest", + dependencies = { + "nvim-neotest/nvim-nio", + "nvim-neotest/neotest-python", + "nvim-lua/plenary.nvim", + "antoinemadec/FixCursorHold.nvim", + "nvim-treesitter/nvim-treesitter" + }, + config = function() + require("neotest").setup({ + adapters = { + require("neotest-python") + } + }) + + end +} diff --git a/lua/plugins/neotree.lua b/lua/plugins/neotree.lua index 9398c1f..b9459a8 100644 --- a/lua/plugins/neotree.lua +++ b/lua/plugins/neotree.lua @@ -30,6 +30,5 @@ return { }, }, }) - vim.keymap.set("n", "", ":Neotree filesystem reveal right toggle", {}) end, } diff --git a/lua/plugins/none-ls.lua b/lua/plugins/none-ls.lua index da2fed3..10d377d 100644 --- a/lua/plugins/none-ls.lua +++ b/lua/plugins/none-ls.lua @@ -10,6 +10,5 @@ return { null_ls.builtins.formatting.black }, }) - vim.keymap.set("n", "gf", vim.lsp.buf.format, {}) end, } diff --git a/lua/plugins/telescope.lua b/lua/plugins/telescope.lua index 89dce4d..41583bb 100644 --- a/lua/plugins/telescope.lua +++ b/lua/plugins/telescope.lua @@ -3,13 +3,6 @@ return { 'nvim-telescope/telescope.nvim', tag = '0.1.6', dependencies = { 'nvim-lua/plenary.nvim' }, - config = function() - local builtin = require("telescope.builtin") - vim.keymap.set('n', '', builtin.find_files, {}) - vim.keymap.set('n', 'fg', builtin.live_grep, {}) - vim.keymap.set('n', 'gl', builtin.lsp_references, {}) - vim.keymap.set('n', 'd', builtin.diagnostics, {}) - end }, { 'nvim-telescope/telescope-ui-select.nvim', diff --git a/lua/plugins/tiny-inline.lua b/lua/plugins/tiny-inline.lua new file mode 100644 index 0000000..1911b48 --- /dev/null +++ b/lua/plugins/tiny-inline.lua @@ -0,0 +1,9 @@ +return { + "rachartier/tiny-inline-diagnostic.nvim", + event = "VeryLazy", + priority = 1000, + config = function() + require("tiny-inline-diagnostic").setup() + vim.diagnostic.config({ virtual_text = false }) -- Disable Neovim's default virtual text diagnostics + end, +} diff --git a/lua/plugins/trouble.lua b/lua/plugins/trouble.lua deleted file mode 100644 index 5f551af..0000000 --- a/lua/plugins/trouble.lua +++ /dev/null @@ -1,11 +0,0 @@ -return { - "folke/trouble.nvim", - opts = {}, - cmd = "Trouble", - keys = { - { - "dd", - "Trouble diagnostics toggle" - } - } -} diff --git a/lua/vim-options.lua b/lua/vim-options.lua index 8c1c3c4..a0ab170 100644 --- a/lua/vim-options.lua +++ b/lua/vim-options.lua @@ -10,19 +10,3 @@ vim.cmd("highlight NonText guibg=none") vim.cmd("highlight Normal ctermbg=none") vim.cmd("highlight NonText ctermbg=none") vim.o.winborder = 'rounded' - -vim.cmd.set("splitright") -vim.keymap.set("n", "/", function() - vim.cmd.vnew() -end) - -vim.cmd.set("splitbelow") -vim.keymap.set("n", "-", function() - vim.cmd.new() -end) - -vim.api.nvim_set_keymap('n', '', ':wincmd k', { noremap = true, silent = true }); -vim.api.nvim_set_keymap('n', '', ':wincmd h', { noremap = true, silent = true }); -vim.api.nvim_set_keymap('n', '', ':wincmd j', { noremap = true, silent = true }); -vim.api.nvim_set_keymap('n', '', ':wincmd l', { noremap = true, silent = true }); -vim.api.nvim_set_keymap('n', 'gb' , ':bnext', { noremap = true, silent = true });