diff --git a/config/astronvim/lua/user/mappings.lua b/config/astronvim/lua/user/mappings.lua index 0f0c266..329e76b 100644 --- a/config/astronvim/lua/user/mappings.lua +++ b/config/astronvim/lua/user/mappings.lua @@ -3,17 +3,13 @@ return { --Usefull vanilla remaps ["J"] = { "mzJ`z", desc = "Keep cursor in column while joining lines" }, - -- [""] = { "zz", desc = "Keep cursor centered while junping" }, [""] = { "zz", desc = "Keep cursor centered while junping" }, - -- Keep cursor centered while searching ["n"] = { "nzzzv", desc = "Keep cursor centered while searching" }, ["N"] = { "Nzzzv", desc = "Keep cursor centered while searching" }, - ["Q"] = "", - -- Buffers ["H"] = { function() @@ -27,7 +23,6 @@ return { end, desc = "Next buffer", }, - [""] = { "ToggleTerm", desc = "Toggle terminal" }, ["fn"] = false, ["fo"] = false, @@ -36,7 +31,6 @@ return { [""] = false, [""] = false, [""] = false, - [""] = { function() require("dap").terminate() @@ -91,7 +85,6 @@ return { end, desc = "Debugger: clear breakpoint", }, - ["fp"] = { function() require("telescope").extensions.projects.projects() @@ -110,33 +103,28 @@ return { end, desc = "Go to prev diagnostic", }, - ["Ch"] = { function() require("nvim-comment-frame").add_comment() end, desc = "Add a comment frame", }, - ["CH"] = { function() require("nvim-comment-frame").add_multiline_comment() end, desc = "Add a multiline comment frame", }, - ["Cd"] = { function() require("neogen").generate() end, desc = "Generate comment docstring", }, - ["ft"] = { "TodoTrouble", desc = "Search TODOS", }, - ["r"] = { [[:%s/\<\>//gI]], desc = "Search and replace current word", @@ -151,12 +139,10 @@ return { ":s/", desc = "Search and replace", }, - ["p"] = { [["_dP]], desc = "Paste whitout lossing yanked text", }, - -- move selection up and down ["J"] = ":m '>+1gv=gv", ["K"] = ":m '<-2gv=gv", diff --git a/config/nvim/init.lua b/config/nvim/init.lua index ad174bc..b2b8d91 100644 --- a/config/nvim/init.lua +++ b/config/nvim/init.lua @@ -6,14 +6,14 @@ require("aleidk.options") -- Install package manager https://github.com/folke/lazy.nvim local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" if not 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, - }) + 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) @@ -25,6 +25,3 @@ require("lazy").setup("aleidk.plugins") require("aleidk.keymaps") require("aleidk.autocmds") require("aleidk.IDE") - --- The line beneath this is called `modeline`. See `:help modeline` --- vim: ts=2 sts=2 sw=2 et diff --git a/config/nvim/lua/aleidk/keymaps.lua b/config/nvim/lua/aleidk/keymaps.lua index a234a6e..20f4ac0 100644 --- a/config/nvim/lua/aleidk/keymaps.lua +++ b/config/nvim/lua/aleidk/keymaps.lua @@ -1,5 +1,12 @@ -- [[ Basic Keymaps ]] +local function default(desc) + return { + silent = true, + desc = desc, + } +end + -- Keymaps for better default experience -- See `:help vim.keymap.set()` vim.keymap.set({ "n", "v" }, "", "", { silent = true }) @@ -7,3 +14,35 @@ vim.keymap.set({ "n", "v" }, "", "", { silent = true }) -- Remap for dealing with word wrap vim.keymap.set("n", "k", "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true }) vim.keymap.set("n", "j", "v:count == 0 ? 'gj' : 'j'", { expr = true, silent = true }) + +vim.keymap.set("n", "J", "mzJ`z", default("Keep cursor in column while joining lines")) + +vim.keymap.set("n", "", "zz", default("Keep cursor centered while junping")) +vim.keymap.set("n", "", "zz", default("Keep cursor centered while junping")) + +vim.keymap.set("n", "n", "nzzzv", default("Keep cursor centered while searching")) +vim.keymap.set("n", "N", "Nzzzv", default("Keep cursor centered while searching")) + +vim.keymap.set("n", "Q", "", {}) + +vim.keymap.set("n", "lj", function() + vim.diagnostic.goto_next() +end, default("Go to next diagnostic")) +vim.keymap.set("n", "lk", function() + vim.diagnostic.goto_prev() +end, default("Go to prev diagnostic")) + +vim.keymap.set( + "n", + "r", + [[:%s/\<\>//gI]], + default("Search and replace current word") +) + +vim.keymap.set("n", "R", ":%s/", default("Search and replace in the whole file")) +vim.keymap.set("v", "r", ":s/", default("Search and replace in selection")) + +vim.keymap.set("v", "p", [["_dP]], default("Paste whitout lossing yanked text")) + +vim.keymap.set("v", "J", ":m '>+1gv=gv", default("Move selection down")) +vim.keymap.set("v", "K", ":m '<-2gv=gv", default("Move selection up")) diff --git a/config/nvim/lua/aleidk/plugins/heirline.lua b/config/nvim/lua/aleidk/plugins/heirline.lua new file mode 100644 index 0000000..e315e95 --- /dev/null +++ b/config/nvim/lua/aleidk/plugins/heirline.lua @@ -0,0 +1,15 @@ +return { + "rebelot/heirline.nvim", + -- You can optionally lazy-load heirline on UiEnter + -- to make sure all required plugins and colorschemes are loaded before setup + event = "UiEnter", + config = function() + require("heirline").setup({ + statusline = {}, + winbar = {}, + tabline = {}, + statuscolumn = {}, + opts = {}, + }) + end, +} diff --git a/config/nvim/lua/aleidk/plugins/init.lua b/config/nvim/lua/aleidk/plugins/init.lua index fda9c80..dfe6496 100644 --- a/config/nvim/lua/aleidk/plugins/init.lua +++ b/config/nvim/lua/aleidk/plugins/init.lua @@ -18,10 +18,10 @@ return { -- Useful status updates for LSP -- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})` - { "j-hui/fidget.nvim", opts = {} }, + { "j-hui/fidget.nvim", opts = {} }, -- Additional lua configuration, makes nvim stuff amazing! - { "folke/neodev.nvim", opts = {} }, + { "folke/neodev.nvim", opts = {} }, }, }, @@ -48,4 +48,18 @@ return { -- "gc" to comment visual regions/lines { "numToStr/Comment.nvim", opts = {} }, + + { + "famiu/bufdelete.nvim", + config = nil, + keys = { + { + "c", + function() + require("bufdelete").bufdelete(0, true) + end, + desc = "Close buffer", + }, + }, + }, } diff --git a/config/nvim/lua/aleidk/plugins/pretty-fold.lua b/config/nvim/lua/aleidk/plugins/pretty-fold.lua new file mode 100644 index 0000000..280dbfc --- /dev/null +++ b/config/nvim/lua/aleidk/plugins/pretty-fold.lua @@ -0,0 +1,42 @@ +return { + "anuvyklack/pretty-fold.nvim", + config = { + sections = { + left = { + "+", + function() + return string.rep("-", vim.v.foldlevel) + end, + " ", + "content", + " ", + "number_of_folded_lines", + " ", + function() + return string.rep("-", vim.v.foldlevel) + end, + "+", + }, + }, + fill_char = " ", + + -- Possible values: + -- "delete" : Delete all comment signs from the fold string. + -- "spaces" : Replace all comment signs with equal number of spaces. + -- false : Do nothing with comment signs. + process_comment_signs = "delete", + + -- List of patterns that will be removed from content foldtext section. + stop_words = { + "@brief%s*", -- (for C++) Remove '@brief' and all spaces after. + }, + + matchup_patterns = { + { "{", "}" }, + { "%(", ")" }, -- % to escape lua pattern char + { "%[", "]" }, -- % to escape lua pattern char + }, + + ft_ignore = { "neorg" }, + }, +} diff --git a/config/nvim/lua/aleidk/plugins/treesitter.lua b/config/nvim/lua/aleidk/plugins/treesitter.lua index 4f4afc4..2c81784 100644 --- a/config/nvim/lua/aleidk/plugins/treesitter.lua +++ b/config/nvim/lua/aleidk/plugins/treesitter.lua @@ -3,15 +3,17 @@ return { "nvim-treesitter/nvim-treesitter", dependencies = { "nvim-treesitter/nvim-treesitter-textobjects", + "windwp/nvim-ts-autotag", + "JoosepAlviste/nvim-ts-context-commentstring", }, build = ":TSUpdate", opts = { -- Add languages to be installed here that you want installed for treesitter ensure_installed = { "c", "cpp", "go", "lua", "python", "rust", "tsx", "typescript", "vimdoc", "vim" }, -- Autoinstall languages that are not installed. Defaults to false (but you can change for yourself!) - auto_install = false, + auto_install = true, highlight = { enable = true }, - indent = { enable = true, disable = { "python" } }, + indent = { enable = true }, incremental_selection = { enable = true, keymaps = { @@ -65,5 +67,15 @@ return { }, }, }, + autotag = { enable = true }, + context_commentstring = { enable = true, enable_autocmd = false }, }, + config = function(_, opts) + require("nvim-treesitter.configs").setup(opts) + vim.cmd([[ + set foldmethod=expr + set foldexpr=nvim_treesitter#foldexpr() + set nofoldenable + ]]) + end, } diff --git a/config/nvim/lua/aleidk/plugins/trouble.lua b/config/nvim/lua/aleidk/plugins/trouble.lua new file mode 100644 index 0000000..57271e1 --- /dev/null +++ b/config/nvim/lua/aleidk/plugins/trouble.lua @@ -0,0 +1,32 @@ +return { + "folke/trouble.nvim", + -- dependencies = { "kyazdani42/nvim-web-devicons" }, + config = function() + require("trouble").setup({ + mode = "document_diagnostics", + action_keys = { -- key mappings for actions in the trouble list + -- map to {} to remove a mapping, for example: + -- close = {}, + close = "q", -- close the list + cancel = "", -- cancel the preview and get back to your last window / buffer / cursor + refresh = "r", -- manually refresh + jump = { "", "" }, -- jump to the diagnostic or open / close folds + open_split = { "s" }, -- open buffer in new split + open_vsplit = { "v" }, -- open buffer in new vsplit + open_tab = { "t" }, -- open buffer in new tab + jump_close = { "o" }, -- jump to the diagnostic and close the list + toggle_mode = "m", -- toggle between "workspace" and "document" diagnostics mode + toggle_preview = "P", -- toggle auto_preview + hover = "K", -- opens a small popup with the full multiline message + preview = "p", -- preview the diagnostic location + close_folds = { "zM", "zm" }, -- close all folds + open_folds = { "zR", "zr" }, -- open all folds + toggle_fold = { "zA", "za" }, -- toggle fold of current file + previous = "k", -- previous item + next = "j", -- next item + }, + }) + + vim.keymap.set("n", "fd", "TroubleToggle", { silent = true, desc = "Search diagnostics" }) + end, +} diff --git a/config/nvim/lua/aleidk/plugins/ts-node-action.lua b/config/nvim/lua/aleidk/plugins/ts-node-action.lua new file mode 100644 index 0000000..dc55988 --- /dev/null +++ b/config/nvim/lua/aleidk/plugins/ts-node-action.lua @@ -0,0 +1,18 @@ +return { + "ckolkey/ts-node-action", + dependencies = { "nvim-treesitter", "jose-elias-alvarez/null-ls.nvim" }, + config = function() + require("ts-node-action").setup({}) + + vim.keymap.set({ "n" }, "lA", require("ts-node-action").node_action, { desc = "Trigger Node Action" }) + + require("null-ls").register({ + name = "more_actions", + method = { require("null-ls").methods.CODE_ACTION }, + filetypes = { "_all" }, + generator = { + fn = require("ts-node-action").available_actions, + }, + }) + end, +} diff --git a/config/sway/config b/config/sway/config index 7e98d73..71e8ee1 100644 --- a/config/sway/config +++ b/config/sway/config @@ -214,7 +214,7 @@ bar { # When the status_command prints a new line to stdout, swaybar updates. # The default just shows the current date and time. - status_command while date +'%Y-%m-%d %I:%M:%S %p'; do sleep 1; done + status_command while ~/.config/sway/sway-bar.sh; do sleep 1; done colors { statusline #ffffff diff --git a/config/sway/sway-bar.sh b/config/sway/sway-bar.sh new file mode 100755 index 0000000..ffc6ce1 --- /dev/null +++ b/config/sway/sway-bar.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env bash + +# Date +date=$(date "+%a %F %R") + +# Battery +battery=$(cat /sys/class/power_supply/BAT*/capacity) + +# Alsa master volume +volume=$(amixer get Master | grep "Right:" | cut -f 7,8 -d " ") + +# Status bar +echo "Vol: $volume | Bat: ${battery}% | $date" diff --git a/exports/dnf.txt b/exports/dnf.txt index c18cf76..03ba237 100644 --- a/exports/dnf.txt +++ b/exports/dnf.txt @@ -10,5 +10,8 @@ gnome-software neovim nodejs remove-retired-packages +ripgrep +tealdeer tmux +tree-sitter-cli zsh diff --git a/setup/rust b/setup/rust index c276df0..cc9c15b 100644 --- a/setup/rust +++ b/setup/rust @@ -3,7 +3,8 @@ echo -e "\n${BLD}${SUL}${GRN}Setting up ${RED}Rust${GRN}...${RST}\n" if ! command -v cargo >/dev/null; then - curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh fi -cargo install tree-sitter-cli +# installed through package-manager +# cargo install tree-sitter-cli