From acfceb3c65061ffe3bb91d92656139a36fc908c5 Mon Sep 17 00:00:00 2001 From: Eduard Urbach Date: Sun, 3 Mar 2024 17:47:02 +0100 Subject: [PATCH] Updated config --- .config/hypr/environment.conf | 11 +++-- .config/hypr/programs.conf | 2 +- .config/nvim/init.lua | 7 ++-- .config/nvim/lazy-lock.json | 9 ++-- .config/nvim/lua/{config => }/autocmds.lua | 16 +++++-- .config/nvim/lua/boot.lua | 42 ------------------- .config/nvim/lua/disabled/fidget.lua | 11 +++++ .config/nvim/lua/disabled/indent.lua | 15 +++++++ .config/nvim/lua/disabled/lsp-notify.lua | 4 ++ .config/nvim/lua/{config => }/keys.lua | 35 ++++++++-------- .config/nvim/lua/plugins/autopairs.lua | 5 +++ .config/nvim/lua/plugins/flash.lua | 6 ++- .config/nvim/lua/plugins/lsp.lua | 47 ++++++++++++++++++--- .config/nvim/lua/plugins/mini-surround.lua | 18 ++++++++ .config/nvim/lua/plugins/noice.lua | 1 - .config/nvim/lua/plugins/telescope.lua | 16 +++++-- .config/nvim/lua/{config => }/settings.lua | 0 .config/nvim/lua/setup.lua | 49 ++++++++++++++++++++++ 18 files changed, 207 insertions(+), 87 deletions(-) rename .config/nvim/lua/{config => }/autocmds.lua (83%) create mode 100644 .config/nvim/lua/disabled/fidget.lua create mode 100644 .config/nvim/lua/disabled/indent.lua create mode 100644 .config/nvim/lua/disabled/lsp-notify.lua rename .config/nvim/lua/{config => }/keys.lua (70%) create mode 100644 .config/nvim/lua/plugins/autopairs.lua create mode 100644 .config/nvim/lua/plugins/mini-surround.lua rename .config/nvim/lua/{config => }/settings.lua (100%) create mode 100644 .config/nvim/lua/setup.lua diff --git a/.config/hypr/environment.conf b/.config/hypr/environment.conf index cd320ab..2eba51e 100644 --- a/.config/hypr/environment.conf +++ b/.config/hypr/environment.conf @@ -1,7 +1,3 @@ -# Cursor -env = XCURSOR_SIZE,24 -env = WLR_NO_HARDWARE_CURSORS,1 - # Firefox env = MOZ_ENABLE_WAYLAND,1 @@ -25,3 +21,10 @@ env = SSH_AUTH_SOCK,$XDG_RUNTIME_DIR/gcr/ssh # Wayland env = XDG_SESSION_TYPE,wayland env = GDK_BACKEND,wayland + +# Wlroots +env = WLR_NO_HARDWARE_CURSORS,1 +env = WLR_RENDERER,vulkan + +# X11 +env = XCURSOR_SIZE,24 diff --git a/.config/hypr/programs.conf b/.config/hypr/programs.conf index 774f2fc..b1099d2 100644 --- a/.config/hypr/programs.conf +++ b/.config/hypr/programs.conf @@ -5,6 +5,6 @@ $files = nautilus $logout = wlogout $lockscreen = swaylock $menu = pkill fuzzel || fuzzel -$screenshot = grim -g "$(slurp -d)" - | wl-copy +$screenshot = IMG=~/pictures/screenshots/$(date +%Y-%m-%d_%H-%M-%S).png && grim -g "$(slurp -d)" $IMG && wl-copy < $IMG $statusbar = ~/.bin/launch-waybar $terminal = alacritty diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua index 9722fe2..ef75ce4 100644 --- a/.config/nvim/init.lua +++ b/.config/nvim/init.lua @@ -1,4 +1,5 @@ -require("config.settings") +require("settings") require("boot") -require("config.keys") -require("config.autocmds") +require("setup") +require("keys") +require("autocmds") diff --git a/.config/nvim/lazy-lock.json b/.config/nvim/lazy-lock.json index 5fbdb48..61aae20 100644 --- a/.config/nvim/lazy-lock.json +++ b/.config/nvim/lazy-lock.json @@ -4,13 +4,14 @@ "gitsigns.nvim": { "branch": "main", "commit": "2c2463dbd82eddd7dbab881c3a62cfbfbe3c67ae" }, "lazy.nvim": { "branch": "main", "commit": "aedcd79811d491b60d0a6577a9c1701063c2a609" }, "mini.completion": { "branch": "main", "commit": "0cf6c4e257b5e8189ac6b3ffa2064a319c4eb8a8" }, - "neodev.nvim": { "branch": "main", "commit": "84e0290f5600e8b89c0dfcafc864f45496a53400" }, + "mini.surround": { "branch": "main", "commit": "a1b590cc3b676512de507328d6bbab5e43794720" }, "noice.nvim": { "branch": "main", "commit": "bf67d70bd7265d075191e7812d8eb42b9791f737" }, "nui.nvim": { "branch": "main", "commit": "b81333d12f824dbed5eb231c8a4409a290fdd848" }, - "nvim-lspconfig": { "branch": "master", "commit": "9553725789be682ecd945a527ec552e489ea8534" }, + "nvim-autopairs": { "branch": "master", "commit": "c6139ca0d5ad7af129ea6c89cb4c56093f2c034a" }, + "nvim-lspconfig": { "branch": "master", "commit": "c932a56bf25167b1e88d2a1ebe35bb774b41019a" }, "nvim-notify": { "branch": "master", "commit": "5371f4bfc1f6d3adf4fe9d62cd3a9d44356bfd15" }, - "nvim-tree.lua": { "branch": "master", "commit": "d52fdeb0a300ac42b9cfa65ae0600a299f8e8677" }, - "nvim-treesitter": { "branch": "master", "commit": "e3e5ff4ebddcbfa8f5798253ebd1f9b449e8ee69" }, + "nvim-tree.lua": { "branch": "master", "commit": "efafd73efa9bc8c26282aed563ba0f01c7465b06" }, + "nvim-treesitter": { "branch": "master", "commit": "63ca90eaa3ce1cc668add8828a9e3d6728dbbdf1" }, "nvim-web-devicons": { "branch": "master", "commit": "4adea17610d140a99c313e3f79a9dc01825d59ae" }, "onedark.nvim": { "branch": "master", "commit": "1230aaf2a427b2c5b73aba6e4a9a5881d3e69429" }, "plenary.nvim": { "branch": "master", "commit": "4f71c0c4a196ceb656c824a70792f3df3ce6bb6d" }, diff --git a/.config/nvim/lua/config/autocmds.lua b/.config/nvim/lua/autocmds.lua similarity index 83% rename from .config/nvim/lua/config/autocmds.lua rename to .config/nvim/lua/autocmds.lua index af36ba6..45f1bc2 100644 --- a/.config/nvim/lua/config/autocmds.lua +++ b/.config/nvim/lua/autocmds.lua @@ -1,16 +1,24 @@ local on = vim.api.nvim_create_autocmd +on({ "BufNewFile", "BufRead" }, { + pattern = { "*.txt", "*.md" }, + callback = function() + vim.opt_local.wrap = true + vim.opt_local.signcolumn = "no" + end, +}) + on({ "TermOpen", "TermEnter" }, { callback = function() vim.opt_local.signcolumn = "no" end, }) -on({ "BufNewFile", "BufRead" }, { - pattern = { "*.txt", "*.md" }, +on({ "TextYankPost" }, { + desc = "Highlight when copying text", + group = vim.api.nvim_create_augroup("highlight-yank", { clear = true }), callback = function() - vim.opt_local.wrap = true - vim.opt_local.signcolumn = "no" + vim.highlight.on_yank() end, }) diff --git a/.config/nvim/lua/boot.lua b/.config/nvim/lua/boot.lua index 6e71113..e0218fd 100644 --- a/.config/nvim/lua/boot.lua +++ b/.config/nvim/lua/boot.lua @@ -10,45 +10,3 @@ if not vim.loop.fs_stat(lazypath) then }) end vim.opt.rtp:prepend(lazypath) - -require("lazy").setup("plugins", { - defaults = { - lazy = true, - }, - change_detection = { - notify = false - }, - performance = { - rtp = { - disabled_plugins = { - "2html_plugin", - "tohtml", - "getscript", - "getscriptPlugin", - "gzip", - "logipat", - "netrw", - "netrwPlugin", - "netrwSettings", - "netrwFileHandlers", - "matchit", - "tar", - "tarPlugin", - "rrhelper", - "spellfile_plugin", - "vimball", - "vimballPlugin", - "zip", - "zipPlugin", - "tutor", - "rplugin", - "syntax", - "synmenu", - "optwin", - "compiler", - "bugreport", - "ftplugin", - }, - }, - }, -}) diff --git a/.config/nvim/lua/disabled/fidget.lua b/.config/nvim/lua/disabled/fidget.lua new file mode 100644 index 0000000..00a18ac --- /dev/null +++ b/.config/nvim/lua/disabled/fidget.lua @@ -0,0 +1,11 @@ +return { + "j-hui/fidget.nvim", + opts = { + integration = { + ["nvim-tree"] = { + enable = true, + }, + }, + }, + config = true, +} diff --git a/.config/nvim/lua/disabled/indent.lua b/.config/nvim/lua/disabled/indent.lua new file mode 100644 index 0000000..10d362b --- /dev/null +++ b/.config/nvim/lua/disabled/indent.lua @@ -0,0 +1,15 @@ +return { + "lukas-reineke/indent-blankline.nvim", + event = "VeryLazy", + main = "ibl", + opts = { + indent = { + char = "▏", + }, + scope = { + enabled = true, + show_start = false, + }, + }, + config = true, +} diff --git a/.config/nvim/lua/disabled/lsp-notify.lua b/.config/nvim/lua/disabled/lsp-notify.lua new file mode 100644 index 0000000..6f61709 --- /dev/null +++ b/.config/nvim/lua/disabled/lsp-notify.lua @@ -0,0 +1,4 @@ +return { + "mrded/nvim-lsp-notify", + config = true, +} diff --git a/.config/nvim/lua/config/keys.lua b/.config/nvim/lua/keys.lua similarity index 70% rename from .config/nvim/lua/config/keys.lua rename to .config/nvim/lua/keys.lua index 94461cb..c722954 100644 --- a/.config/nvim/lua/config/keys.lua +++ b/.config/nvim/lua/keys.lua @@ -6,20 +6,24 @@ end map("n", ";", ":", "Command mode") map("n", "U", "redo", "Redo") map({ "i", "n" }, "", "noh", "Clear search") -map({ "i", "n", "s", "v" }, "", "w", "Save file") -map("n", "", "^Da", "Rewrite line") -map("i", "", "^Da", "Rewrite line") -map("n", "", "ggVG", "Select all") +map({"n", "v"}, "qq", "qa!", "Quit all") + +-- Editing lines map({ "n", "v" }, "", "^", "Beginning of line") map("i", "", "^i", "Beginning of line") map({ "i", "n", "v" }, "", "", "End of line") -map("n", "qq", "qa!", "Quit all") +map("n", "", "^Da", "Rewrite line") +map("i", "", "^Da", "Rewrite line") +map("v", "", "V", "Select line") +map({"n", "v"}, "", "ggVG", "Select all") -- Editing multiple instances -map("n", "", "*#", "Search word under cursor") -map("n", "", "*#:%s//", "Replace word under cursor") +map("n", "", "*#", "Search word under cursor") +map("v", "", "y/\"N", "Search selection") +map("n", "", "viw", "Select word under cursor") map("v", "", "y/\"N", "Search selection") -map("v", "", "y/\"N:%s//\"", "Replace selection") +map("n", "", "*#:%s///g", "Replace word under cursor") +map("v", "", "y/\"N:%s//\"/g", "Replace selection") -- Increasing and decreasing numbers map("n", "+", "", "Increase number") @@ -29,6 +33,7 @@ map("n", "", "", "Decrease number") -- Buffer management map("n", "", "enew", "New file") +map({ "i", "n", "s", "v" }, "", "w", "Save file") map("n", "", "bd", "Delete buffer") -- Copy and paste @@ -36,8 +41,10 @@ map("v", "", "y") map("n", "", '"+p') -- Indenting -map("v", "<", "", ">gv") +map("n", "", "V>gv") +map("n", "", "V") +map("v", "", ">gv") +map("v", "", "", "v") @@ -55,13 +62,5 @@ 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") -map({ "n", "i" }, "", vim.lsp.buf.hover, "Hover") -map({ "n", "i" }, "", vim.lsp.buf.rename, "Rename") -map({ "n", "i" }, "", vim.lsp.buf.format, "Format") -map("n", "ca", vim.lsp.buf.code_action, "Code action") - -- Package manager map("n", "l", "Lazy", "Lazy") diff --git a/.config/nvim/lua/plugins/autopairs.lua b/.config/nvim/lua/plugins/autopairs.lua new file mode 100644 index 0000000..21a5161 --- /dev/null +++ b/.config/nvim/lua/plugins/autopairs.lua @@ -0,0 +1,5 @@ +return { + "windwp/nvim-autopairs", + event = "InsertEnter", + config = true +} diff --git a/.config/nvim/lua/plugins/flash.lua b/.config/nvim/lua/plugins/flash.lua index 02677fa..2f69412 100644 --- a/.config/nvim/lua/plugins/flash.lua +++ b/.config/nvim/lua/plugins/flash.lua @@ -1,7 +1,9 @@ return { "folke/flash.nvim", + event = { "BufReadPost", "BufNewFile" }, keys = { - { "s", function() require("flash").jump() end, mode = { "n", "x", "o" }, desc = "Flash" }, - { "S", function() require("flash").treesitter() end, mode = { "n", "o", "x" }, desc = "Flash Treesitter" }, + { "s", function() require("flash").jump() end, mode = { "n", "o", "x" }, desc = "Flash" }, + { "S", function() require("flash").treesitter() end, mode = { "n", "o", "x" }, desc = "Flash Treesitter" }, }, + config = true, } diff --git a/.config/nvim/lua/plugins/lsp.lua b/.config/nvim/lua/plugins/lsp.lua index 762954c..4c4dc9b 100644 --- a/.config/nvim/lua/plugins/lsp.lua +++ b/.config/nvim/lua/plugins/lsp.lua @@ -1,9 +1,6 @@ return { "neovim/nvim-lspconfig", event = { "BufReadPre", "BufNewFile" }, - dependencies = { - "folke/neodev.nvim", - }, opts = { servers = { clangd = {}, @@ -12,8 +9,18 @@ return { lua_ls = { settings = { Lua = { + completion = { + callSnippet = "Replace", + }, + runtime = { + version = "LuaJIT", + }, workspace = { checkThirdParty = false, + library = { + "${3rd}/luv/library", + unpack(vim.api.nvim_get_runtime_file("", true)), + }, }, }, }, @@ -21,8 +28,6 @@ return { }, }, config = function(_, opts) - require("neodev").setup() - -- Servers local servers = opts.servers @@ -42,5 +47,37 @@ return { name = "DiagnosticSign" .. name vim.fn.sign_define(name, { text = icon, texthl = name, numhl = "" }) end + + -- Runs when the LSP is attached + vim.api.nvim_create_autocmd("LspAttach", { + group = vim.api.nvim_create_augroup("lsp-attach", { clear = true }), + callback = function(event) + local function map(mode, lhs, rhs, info) + vim.keymap.set(mode, lhs, rhs, { buffer = event.buf, desc = "LSP: " .. info }) + end + + map("n", "gr", require("telescope.builtin").lsp_references, "References") + map("n", "gd", require("telescope.builtin").lsp_definitions, "Definition") + map({ "n", "i" }, "", vim.lsp.buf.hover, "Hover") + map({ "n", "i" }, "", vim.lsp.buf.rename, "Rename") + map({ "n", "i" }, "", vim.lsp.buf.format, "Format") + map("n", "ca", vim.lsp.buf.code_action, "Code action") + + -- Highlight the word your cursor is on + -- local client = vim.lsp.get_client_by_id(event.data.client_id) + -- + -- if client and client.server_capabilities.documentHighlightProvider then + -- vim.api.nvim_create_autocmd({ "CursorHold", "CursorHoldI" }, { + -- buffer = event.buf, + -- callback = vim.lsp.buf.document_highlight, + -- }) + -- + -- vim.api.nvim_create_autocmd({ "CursorMoved", "CursorMovedI" }, { + -- buffer = event.buf, + -- callback = vim.lsp.buf.clear_references, + -- }) + -- end + end, + }) end, } diff --git a/.config/nvim/lua/plugins/mini-surround.lua b/.config/nvim/lua/plugins/mini-surround.lua new file mode 100644 index 0000000..e687abe --- /dev/null +++ b/.config/nvim/lua/plugins/mini-surround.lua @@ -0,0 +1,18 @@ +return { + "echasnovski/mini.surround", + event = { "BufReadPost", "BufNewFile" }, + opts = { + mappings = { + add = 'gsa', + delete = 'gsd', + find = 'gsf', + find_left = 'gsF', + highlight = 'gsh', + replace = 'gsr', + update_n_lines = 'gsn', + suffix_last = '', + suffix_next = '', + }, + }, + config = true, +} diff --git a/.config/nvim/lua/plugins/noice.lua b/.config/nvim/lua/plugins/noice.lua index b4f5eec..b8ce7f6 100644 --- a/.config/nvim/lua/plugins/noice.lua +++ b/.config/nvim/lua/plugins/noice.lua @@ -3,7 +3,6 @@ return { event = "VeryLazy", dependencies = { "MunifTanjim/nui.nvim", - "rcarriga/nvim-notify", }, opts = { lsp = { diff --git a/.config/nvim/lua/plugins/telescope.lua b/.config/nvim/lua/plugins/telescope.lua index 8df02c8..2886b31 100644 --- a/.config/nvim/lua/plugins/telescope.lua +++ b/.config/nvim/lua/plugins/telescope.lua @@ -3,12 +3,17 @@ return { dependencies = { "nvim-lua/plenary.nvim", "nvim-telescope/telescope-project.nvim", + -- "nvim-telescope/telescope-ui-select.nvim", }, keys = { - {"f", "Telescope find_files", desc = "Find files"}, - {"r", "Telescope oldfiles", desc = "Recent files"}, - {"p", "Telescope project", desc = "Projects"}, {"b", "Telescope buffers", desc = "Buffers"}, + {"f", "Telescope find_files", desc = "Find files"}, + {"h", "Telescope help_tags", desc = "Help"}, + {"p", "Telescope project", desc = "Projects"}, + {"r", "Telescope oldfiles", desc = "Recent files"}, + {"w", "Telescope grep_string", desc = "Word"}, + {"ds", "Telescope lsp_document_symbols", desc = "Document symbols"}, + {"ws", "Telescope lsp_dynamic_workspace_symbols", desc = "Workspace symbols"}, }, config = function() require("telescope").setup({ @@ -30,8 +35,13 @@ return { sync_with_nvim_tree = true, theme = "dropdown", }, + -- ["ui-select"] = { + -- require("telescope.themes").get_dropdown(), + -- }, }, }) + require("telescope").load_extension("project") + -- require("telescope").load_extension("ui-select") end, } diff --git a/.config/nvim/lua/config/settings.lua b/.config/nvim/lua/settings.lua similarity index 100% rename from .config/nvim/lua/config/settings.lua rename to .config/nvim/lua/settings.lua diff --git a/.config/nvim/lua/setup.lua b/.config/nvim/lua/setup.lua new file mode 100644 index 0000000..ef6cda1 --- /dev/null +++ b/.config/nvim/lua/setup.lua @@ -0,0 +1,49 @@ +require("lazy").setup("plugins", { + defaults = { + lazy = true, + }, + change_detection = { + notify = false + }, + ui = { + icons = { + ft = "", + lazy = "󰂠 ", + loaded = "", + not_loaded = "", + }, + }, + performance = { + rtp = { + disabled_plugins = { + "2html_plugin", + "tohtml", + "getscript", + "getscriptPlugin", + "gzip", + "logipat", + "netrw", + "netrwPlugin", + "netrwSettings", + "netrwFileHandlers", + "matchit", + "tar", + "tarPlugin", + "rrhelper", + "spellfile_plugin", + "vimball", + "vimballPlugin", + "zip", + "zipPlugin", + "tutor", + "rplugin", + "syntax", + "synmenu", + "optwin", + "compiler", + "bugreport", + "ftplugin", + }, + }, + }, +})