diff --git a/.config/nvim/lazy-lock.json b/.config/nvim/lazy-lock.json index f8be995..0fcf2a2 100644 --- a/.config/nvim/lazy-lock.json +++ b/.config/nvim/lazy-lock.json @@ -1,20 +1,20 @@ { "Comment.nvim": { "branch": "master", "commit": "0236521ea582747b58869cb72f70ccfa967d2e89" }, - "cmp-nvim-lsp": { "branch": "main", "commit": "5af77f54de1b16c34b23cba810150689a3a90312" }, "flash.nvim": { "branch": "main", "commit": "48817af25f51c0590653bbc290866e4890fe1cbe" }, "gitsigns.nvim": { "branch": "main", "commit": "c5ff7628e19a47ec14d3657294cc074ecae27b99" }, "lazy.nvim": { "branch": "main", "commit": "28126922c9b54e35a192ac415788f202c3944c9f" }, - "neodev.nvim": { "branch": "main", "commit": "aaeb44589cab39c2545a328661af355622d68479" }, + "mini.completion": { "branch": "main", "commit": "3469773c1280a962bff89c06278007e8aaa30eb5" }, + "multiple-cursors.nvim": { "branch": "main", "commit": "9f41d2991f36e3558a83760fba8eb94529c68ea6" }, + "neodev.nvim": { "branch": "main", "commit": "5bbbeda6a9c672f314c95ca47a8b495cf6de17f9" }, "noice.nvim": { "branch": "main", "commit": "92433164e2f7118d4122c7674c3834d9511722ba" }, "nui.nvim": { "branch": "main", "commit": "35da9ca1de0fc4dda96c2e214d93d363c145f418" }, - "nvim-cmp": { "branch": "main", "commit": "538e37ba87284942c1d76ed38dd497e54e65b891" }, "nvim-lspconfig": { "branch": "master", "commit": "8917d2c830e04bf944a699b8c41f097621283828" }, "nvim-notify": { "branch": "master", "commit": "80b67b265530632505193553d05127ae7fe09ddd" }, "nvim-tree.lua": { "branch": "master", "commit": "7bdb220d0fe604a77361e92cdbc7af1b8a412126" }, - "nvim-treesitter": { "branch": "master", "commit": "e0420e73c9cf4a9fe49d576be313718831a3822d" }, + "nvim-treesitter": { "branch": "master", "commit": "97997c928bb038457f49343ffa5304d931545584" }, "nvim-web-devicons": { "branch": "master", "commit": "140edfcf25093e8b321d13e154cbce89ee868ca0" }, - "onedark.nvim": { "branch": "master", "commit": "dc3bad0121298f89b50aaff8599d1946e07eb4c2" }, + "onedark.nvim": { "branch": "master", "commit": "14e5de43cf1ff761c280d1ff5b9980897f5b46c7" }, "plenary.nvim": { "branch": "master", "commit": "663246936325062427597964d81d30eaa42ab1e4" }, "telescope-project.nvim": { "branch": "master", "commit": "1aaf16580a614601a7f7077d9639aeb457dc5559" }, - "telescope.nvim": { "branch": "master", "commit": "0902bb39ebaf76e655addc65130eb79b29abe6d2" } + "telescope.nvim": { "branch": "master", "commit": "20efb3864903fb854a85faf57513ffd80582275b" } } \ No newline at end of file diff --git a/.config/nvim/lua/config/autocmds.lua b/.config/nvim/lua/config/autocmds.lua index 51cb11b..22dd1c6 100644 --- a/.config/nvim/lua/config/autocmds.lua +++ b/.config/nvim/lua/config/autocmds.lua @@ -13,3 +13,23 @@ on({ "BufNewFile", "BufRead" }, { vim.opt_local.signcolumn = "no" end, }) + +on({ "VimEnter" }, { + callback = function() + -- Switch to root directory of the project + local root_patterns = { ".git", "go.mod", "init.lua" } + local root_dir = vim.fs.dirname(vim.fs.find(root_patterns, { upward = true })[1]) + + if root_dir then + vim.api.nvim_set_current_dir(root_dir) + end + + -- Open file explorer if we have enough space + local files = require("nvim-tree.api") + local width = vim.go.columns + + if width > 120 then + files.tree.toggle({ focus = false }) + end + end, +}) diff --git a/.config/nvim/lua/config/keys.lua b/.config/nvim/lua/config/keys.lua index a5a2902..06a14a0 100644 --- a/.config/nvim/lua/config/keys.lua +++ b/.config/nvim/lua/config/keys.lua @@ -8,8 +8,6 @@ map("n", "qq", "qa!", "Quit all") map("n", "U", "redo", "Redo") map({ "i", "n" }, "", "noh", "Clear search") map({ "i", "n", "s", "v" }, "", "w", "Save file") -map("n", "", "bd", "Delete buffer") -map("n", "", "enew", "New File") map("n", "", "^Da", "Rewrite line") map("i", "", "^Da", "Rewrite line") map("n", "", "ggVG", "Select all") @@ -18,10 +16,34 @@ map({ "n", "v" }, "", "^", "Beginning of line") map("i", "", "^i", "Beginning of line") map({ "i", "n", "v" }, "", "", "End of line") +-- Buffer management +map("n", "", "enew", "New file") +map("n", "", "bd", "Delete buffer") + +-- Copy and paste +map("v", "", "y") +map("n", "", '"+p') + -- Indenting map("v", "<", "", ">gv") +-- Shift arrow selection +map("n", "", "v") +map("n", "", "v") +map("n", "", "v") +map("n", "", "v") + +map("v", "", "") +map("v", "", "") +map("v", "", "") +map("v", "", "") + +map("i", "", "v") +map("i", "", "v") +map("i", "", "v") +map("i", "", "v") + -- LSP map("n", "gr", vim.lsp.buf.references, "References") map("n", "gd", vim.lsp.buf.definition, "Definition") diff --git a/.config/nvim/lua/config/settings.lua b/.config/nvim/lua/config/settings.lua index 01947d2..503c926 100644 --- a/.config/nvim/lua/config/settings.lua +++ b/.config/nvim/lua/config/settings.lua @@ -11,6 +11,7 @@ local opt = vim.opt opt.autoindent = true opt.autowrite = false opt.clipboard = "unnamedplus" +opt.completeopt = "menu,menuone,noinsert" opt.conceallevel = 0 opt.cursorline = true opt.cursorlineopt = "number" @@ -18,11 +19,12 @@ opt.expandtab = false opt.grepformat = "%f:%l:%c:%m" opt.grepprg = "rg --grep" opt.ignorecase = false +opt.linespace = 0 opt.mouse = "a" opt.ruler = false opt.sessionoptions = { "buffers", "curdir", "tabpages", "winsize" } opt.shiftwidth = 4 -opt.shortmess:append "sCFI" +opt.shortmess:append "scCFI" opt.showmode = false opt.showtabline = 0 opt.smartindent = true @@ -35,7 +37,9 @@ opt.termguicolors = true opt.undofile = true opt.undolevels = 10000 opt.updatetime = 250 +opt.virtualedit = "onemore" opt.wildmode = "longest:full,full" +opt.winblend = 10 opt.wrap = false -- UI @@ -45,3 +49,10 @@ opt.number = true opt.relativenumber = false opt.signcolumn = "number" opt.statusline = "%{repeat('─',winwidth('.'))}" + +-- Neovide +if g.neovide then + g.neovide_fullscreen = true + g.neovide_transparency = 0.9 + vim.o.guifont = "UbuntuMono Nerd Font:h20" +end diff --git a/.config/nvim/lua/plugins/cmp.lua b/.config/nvim/lua/disabled/cmp.lua similarity index 100% rename from .config/nvim/lua/plugins/cmp.lua rename to .config/nvim/lua/disabled/cmp.lua diff --git a/.config/nvim/lua/plugins/comment.lua b/.config/nvim/lua/plugins/comment.lua index 4c66ce9..b21a3d2 100644 --- a/.config/nvim/lua/plugins/comment.lua +++ b/.config/nvim/lua/plugins/comment.lua @@ -1,8 +1,17 @@ return { "numToStr/Comment.nvim", keys = { - {"", "lua require('Comment.api').toggle.linewise.current()", desc = "Toggle comment"}, - {"", "lua require('Comment.api').toggle.linewise(vim.fn.visualmode())", mode = "v", desc = "Toggle comment"}, + { + "", + "lua require('Comment.api').toggle.linewise.current()", + desc = "Toggle comment", + }, + { + "", + "lua require('Comment.api').toggle.linewise(vim.fn.visualmode())", + mode = "v", + desc = "Toggle comment", + }, }, config = true, opts = { diff --git a/.config/nvim/lua/plugins/mini-complete.lua b/.config/nvim/lua/plugins/mini-complete.lua new file mode 100644 index 0000000..698d0e6 --- /dev/null +++ b/.config/nvim/lua/plugins/mini-complete.lua @@ -0,0 +1,8 @@ +return { + "echasnovski/mini.completion", + event = "InsertEnter", + opts = { + set_vim_settings = false, + }, + config = true, +} diff --git a/.config/nvim/lua/plugins/multi-cursor.lua b/.config/nvim/lua/plugins/multi-cursor.lua new file mode 100644 index 0000000..71016ca --- /dev/null +++ b/.config/nvim/lua/plugins/multi-cursor.lua @@ -0,0 +1,14 @@ +return { + "brenton-leighton/multiple-cursors.nvim", + event = "VeryLazy", + keys = { + {"", "MultipleCursorsAddDown", mode = {"n", "i"}}, + {"", "MultipleCursorsAddDown"}, + {"", "MultipleCursorsAddUp", mode = {"n", "i"}}, + {"", "MultipleCursorsAddUp"}, + {"", "MultipleCursorsMouseAddDelete", mode = {"n", "i"}}, + {"a", "MultipleCursorsAddBySearch", mode = {"n", "x"}}, + {"A", "MultipleCursorsAddBySearchV", mode = {"n", "x"}}, + }, + config = true, +} diff --git a/.config/nvim/lua/plugins/onedark.lua b/.config/nvim/lua/plugins/onedark.lua index 33b1b5a..31a1e7b 100644 --- a/.config/nvim/lua/plugins/onedark.lua +++ b/.config/nvim/lua/plugins/onedark.lua @@ -4,7 +4,7 @@ return { priority = 1000, opts = { style = "dark", - transparent = true, + --transparent = true, term_colors = true, highlights = { ["StatusLine"] = {fg = "$bg3", bg = "Normal"}, diff --git a/.config/nvim/lua/plugins/telescope.lua b/.config/nvim/lua/plugins/telescope.lua index f16d640..d5a5665 100644 --- a/.config/nvim/lua/plugins/telescope.lua +++ b/.config/nvim/lua/plugins/telescope.lua @@ -12,6 +12,14 @@ return { }, config = function() require("telescope").setup({ + defaults = { + mappings = { + i = { + [""] = require("telescope.actions").close, + }, + }, + winblend = 10, + }, extensions = { project = { base_dirs = { diff --git a/.config/nvim/lua/plugins/tree.lua b/.config/nvim/lua/plugins/tree.lua index 6834f3c..59cb284 100644 --- a/.config/nvim/lua/plugins/tree.lua +++ b/.config/nvim/lua/plugins/tree.lua @@ -1,3 +1,34 @@ +local function on_attach(bufnr) + local api = require("nvim-tree.api") + + -- default mappings + api.config.mappings.default_on_attach(bufnr) + + local function opts(desc) + return { desc = "nvim-tree: " .. desc, buffer = bufnr, noremap = true, silent = true, nowait = true } + end + + -- navigation + vim.keymap.set("n", "", api.tree.change_root_to_parent, opts("Up")) + vim.keymap.set("n", "", api.tree.change_root_to_node, opts("Enter")) + + -- open folders with a single click + vim.keymap.set("n", "", function() + vim.defer_fn(function () + local win = vim.api.nvim_get_current_win() + local view = require("nvim-tree.view") + if view.get_winnr() ~= win then return end + + api.node.open.edit() + api.tree.focus() + -- local node = api.tree.get_node_under_cursor() + -- if node.nodes ~= nil then + -- api.node.open.edit() + -- end + end, 10) + end, opts("Open folder/file")) +end + return { "nvim-tree/nvim-tree.lua", event = "VeryLazy", @@ -14,6 +45,7 @@ return { filters = { dotfiles = false, }, + on_attach = on_attach, renderer = { root_folder_label = false, highlight_git = true, diff --git a/.config/vscode/settings.json b/.config/vscode/settings.json index 90257fc..aedc7b1 100644 --- a/.config/vscode/settings.json +++ b/.config/vscode/settings.json @@ -29,6 +29,7 @@ "godot_tools.gdscript_lsp_server_port": 6005, "godot_tools.editor_path": "/usr/bin/godot", "security.workspace.trust.enabled": false, + "svelte.enable-ts-plugin": true, "telemetry.telemetryLevel": "off", "window.menuBarVisibility": "hidden", "window.zoomLevel": 1, @@ -39,5 +40,5 @@ "workbench.iconTheme": "material-icon-theme", "workbench.layoutControl.enabled": false, "workbench.startupEditor": "none", - "workbench.statusBar.visible": false + "workbench.statusBar.visible": false, }