From c8f927f4dcf268f39c6571144198cbfec7121969 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moritz=20B=C3=B6hme?= Date: Thu, 23 Feb 2023 13:34:59 +0100 Subject: [PATCH] nvim: add smartcolumn --- flake.lock | 17 ++++++++ flake.nix | 6 +++ modules/programs/hyprland/config.nix | 58 +++++++++++++++++----------- modules/programs/nvim/default.nix | 7 ++++ modules/programs/nvim/init.lua | 10 +++-- 5 files changed, 72 insertions(+), 26 deletions(-) diff --git a/flake.lock b/flake.lock index cbc747d..6a627ca 100644 --- a/flake.lock +++ b/flake.lock @@ -775,6 +775,7 @@ "nixpkgs": "nixpkgs_8", "nvim-treesitter-textsubjects": "nvim-treesitter-textsubjects", "pre-commit-hooks": "pre-commit-hooks_3", + "smartcolumn-nvim": "smartcolumn-nvim", "stable": "stable", "utils": "utils_2" } @@ -804,6 +805,22 @@ "type": "github" } }, + "smartcolumn-nvim": { + "flake": false, + "locked": { + "lastModified": 1677125264, + "narHash": "sha256-Om0t759e6JYwcg6V+HdJk59h2yVt9kPLwGBMKNnP8AA=", + "owner": "m4xshen", + "repo": "smartcolumn.nvim", + "rev": "1202b0741b87b0815bdc6fc6ebacb2df9e6628ee", + "type": "github" + }, + "original": { + "owner": "m4xshen", + "repo": "smartcolumn.nvim", + "type": "github" + } + }, "stable": { "locked": { "lastModified": 1676817468, diff --git a/flake.nix b/flake.nix index 6127709..ab36e1a 100644 --- a/flake.nix +++ b/flake.nix @@ -61,6 +61,12 @@ url = "github:RRethy/nvim-treesitter-textsubjects"; flake = false; }; + + smartcolumn-nvim = { + url = "github:m4xshen/smartcolumn.nvim"; + flake = false; + }; + }; outputs = diff --git a/modules/programs/hyprland/config.nix b/modules/programs/hyprland/config.nix index a06a252..732aa27 100644 --- a/modules/programs/hyprland/config.nix +++ b/modules/programs/hyprland/config.nix @@ -146,26 +146,32 @@ in $windowMod = ALT # Example binds, see https://wiki.hyprland.org/Configuring/Binds/ for more - bind = $mainMod, D, exec, hyprctl keyword general:layout dwindle - bind = $mainMod, E, exec, emacsclient -c -a emacs - bind = $mainMod, F, togglefloating, - bind = $mainMod SHIFT, F, fullscreen, - bind = $mainMod, M, exec, hyprctl keyword general:layout master - bind = $mainMod, P, pseudo, # dwindle - bind = $mainMod, Q, killactive, - bind = $mainMod, R, exec, rofi -show combi - bind = $mainMod, C, exec, rofi -show calc -modi calc -no-show-match -no-sort | wl-copy - bind = $mainMod, B, exec, rofi-bluetooth - bind = $mainMod, RETURN, exec, kitty - bind = $mainMod, T, togglesplit, # dwindle - bind = , XF86AudioLowerVolume, exec, pamixer -d 5 - bind = , XF86AudioMute, exec, pamixer -t - bind = , XF86AudioNext, exec, playerctl -p "spotifyd,firefox" next - bind = , XF86AudioPlay, exec, playerctl -p "spotifyd,firefox" play-pause - bind = , XF86AudioPrev, exec, playerctl -p "spotifyd,firefox" previous - bind = , XF86AudioRaiseVolume, exec, pamixer -i 5 - bind = , XF86MonBrightnessDown, exec, brightnessctl s 10%- - bind = , XF86MonBrightnessUp, exec, brightnessctl s 10%+ + + # Window binds + bind = $mainMod , F , togglefloating , + bind = $mainMod , P , pseudo , + bind = $mainMod , Q , killactive , + bind = $mainMod , T , togglesplit , + bind = $mainMod SHIFT , F , fullscreen , + + # Program binds + bind = $mainMod , B , exec , rofi-bluetooth + bind = $mainMod , C , exec , rofi -show calc -modi calc -no-show-match -no-sort | wl-copy + bind = $mainMod , D , exec , hyprctl keyword general:layout dwindle + bind = $mainMod , E , exec , emacsclient -c -a emacs + bind = $mainMod , M , exec , hyprctl keyword general:layout master + bind = $mainMod , R , exec , rofi -show combi + bind = $mainMod , RETURN , exec , kitty + + # XF86 keys + bind = , XF86AudioLowerVolume , exec , pamixer -d 5 + bind = , XF86AudioRaiseVolume , exec , pamixer -i 5 + bind = , XF86AudioMute , exec , pamixer -t + bind = , XF86AudioNext , exec , playerctl -p "spotifyd,firefox" next + bind = , XF86AudioPlay , exec , playerctl -p "spotifyd,firefox" play-pause + bind = , XF86AudioPrev , exec , playerctl -p "spotifyd,firefox" previous + bind = , XF86MonBrightnessDown , exec , brightnessctl s 10%- + bind = , XF86MonBrightnessUp , exec , brightnessctl s 10%+ # Move focus with mainMod + hjkl bind = $mainMod, H, movefocus, l @@ -173,11 +179,17 @@ in bind = $mainMod, K, movefocus, u bind = $mainMod, J, movefocus, d - # Change current active window size with mainMod + hjkl + # Change current active window size with mainMod + SHIFT + hjkl bind = $mainMod SHIFT, H, resizeactive, -10 0 - bind = $mainMod SHIFT, L, resizeactive, 10 0 - bind = $mainMod SHIFT, K, resizeactive, 0 -10 bind = $mainMod SHIFT, J, resizeactive, 0 10 + bind = $mainMod SHIFT, K, resizeactive, 0 -10 + bind = $mainMod SHIFT, L, resizeactive, 10 0 + + # Move current active window with mainMod + ALT + hjkl + bind = $mainMod ALT, H, movewindow, l + bind = $mainMod ALT, J, movewindow, d + bind = $mainMod ALT, K, movewindow, u + bind = $mainMod ALT, L, movewindow, r # Switch workspaces with mainMod + [0-9] bind = $mainMod, 1, workspace, 1 diff --git a/modules/programs/nvim/default.nix b/modules/programs/nvim/default.nix index 96d64ec..b903a7c 100644 --- a/modules/programs/nvim/default.nix +++ b/modules/programs/nvim/default.nix @@ -22,6 +22,12 @@ let version = mkVersionInput inputs.nvim-treesitter-textsubjects; src = inputs.nvim-treesitter-textsubjects; }; + + smartcolumn-nvim = pkgs.vimUtils.buildVimPluginFrom2Nix { + pname = "smartcolumn-nvim"; + version = mkVersionInput inputs.smartcolumn-nvim; + src = inputs.smartcolumn-nvim; + }; in { options.my.programs.vim = { @@ -83,6 +89,7 @@ in nvim-web-devicons # for dashboard-nvim orgmode plenary-nvim # for telescope, neogit + smartcolumn-nvim telescope-nvim vim-lion which-key-nvim diff --git a/modules/programs/nvim/init.lua b/modules/programs/nvim/init.lua index 96737a7..92ebceb 100644 --- a/modules/programs/nvim/init.lua +++ b/modules/programs/nvim/init.lua @@ -100,8 +100,8 @@ cmp.setup({ formatting = { format = lspkind.cmp_format({ mode = "symbol", -- show only symbol annotations - maxwidth = 50, -- prevent the popup from showing more than provided characters (e.g 50 will not show more than 50 characters) - ellipsis_char = "...", -- when popup menu exceed maxwidth, the truncated part would show ellipsis_char instead (must define maxwidth first) + maxwidth = 50, -- prevent the popup from showing more than provided characters + ellipsis_char = "...", -- when popup menu exceed maxwidth, the truncated part would show ellipsis_char instead symbol_map = { Copilot = "", }, @@ -118,7 +118,7 @@ cmp.setup({ [""] = cmp.mapping.scroll_docs(4), [""] = cmp.mapping.complete(), [""] = cmp.mapping.abort(), - [""] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. + [""] = cmp.mapping.confirm({ select = true }), [""] = cmp.mapping(function(fallback) if cmp.visible() then cmp.select_next_item() @@ -447,3 +447,7 @@ require("nvim-tree").setup() wk.register({ t = { "NvimTreeFindFileToggle", "nvim tree" }, }, { prefix = "t", silent = true }) + +require("smartcolumn").setup({ + colorcolumn = 120, +})