diff --git a/flake.nix b/flake.nix
index 0b1ee37..6f27e42 100644
--- a/flake.nix
+++ b/flake.nix
@@ -15,8 +15,8 @@
t.url = "github:jdonszelmann/t-rs";
kitty-search = {
- url = "github:trygveaa/kitty-kitten-search";
- flake = false;
+ url = "github:trygveaa/kitty-kitten-search";
+ flake = false;
};
};
@@ -39,27 +39,29 @@
} // {
inherit (args) extraSpecialArgs;
});
- in flake-utils.lib.eachDefaultSystem (system: rec {
- formatter = legacyPackages.nixfmt-classic;
- legacyPackages = pkgsForSystem system;
- pkgs = legacyPackages;
- devShells.default = pkgs.mkShell {
- buildInputs = with pkgs; [
- (pkgs.writeShellScriptBin "fast-repl" ''
- source /etc/set-environment
- nix repl --file "${./.}/repl.nix" $@
- '')
+ in
+ flake-utils.lib.eachDefaultSystem
+ (system: rec {
+ formatter = legacyPackages.nixfmt-classic;
+ legacyPackages = pkgsForSystem system;
+ pkgs = legacyPackages;
+ devShells.default = pkgs.mkShell {
+ buildInputs = with pkgs; [
+ (pkgs.writeShellScriptBin "fast-repl" ''
+ source /etc/set-environment
+ nix repl --file "${./.}/repl.nix" $@
+ '')
- (pkgs.writeShellScriptBin "apply-home" ''
- nix run .#home-manager -- switch --flake .#$@
- '')
+ (pkgs.writeShellScriptBin "apply-home" ''
+ nix run .#home-manager -- switch --flake .#$@
+ '')
- (pkgs.writeShellScriptBin "apply" ''
- apply-home $(hostname -f)
- '')
- ];
- };
- }) // {
+ (pkgs.writeShellScriptBin "apply" ''
+ apply-home $(hostname -f)
+ '')
+ ];
+ };
+ }) // {
homeConfigurations = {
kili = mkHomeConfiguration (import ./hosts/kili/home.nix) {
diff --git a/hosts/kili/home.nix b/hosts/kili/home.nix
index a0dcd35..bc775ff 100644
--- a/hosts/kili/home.nix
+++ b/hosts/kili/home.nix
@@ -8,6 +8,7 @@
../../programs/zsh
../../programs/kanata
../../programs/kitty
+ ../../programs/tmux
];
# use the system-installed version of kitty on arch
diff --git a/programs/kanata/cfg.kbd b/programs/kanata/cfg.kbd
index fbd998c..9c6ecf2 100644
--- a/programs/kanata/cfg.kbd
+++ b/programs/kanata/cfg.kbd
@@ -16,15 +16,16 @@
grv 1 2 3 4 5 6 7 8 9 0 - = bspc
tab q w e r t y u i o p [ ] \
@cap a s d f g h j k l ; ' ret
- lsft z x c v b n m , . / rsft
+ @lst z x c v b n m , . / rsft
lctl lmet lalt spc ralt rctl
)
(defalias
- esc (tap-hold 200 800 esc caps)
+ esc (tap-hold 800 800 esc caps)
cap (tap-dance 300 (esc C-k esc))
qwr (layer-switch qwerty)
+ lst (tap-hold-release 200 200 C-k lsft)
)
diff --git a/programs/kitty/default.nix b/programs/kitty/default.nix
index ed8fc41..75d46e6 100644
--- a/programs/kitty/default.nix
+++ b/programs/kitty/default.nix
@@ -31,10 +31,12 @@
keybindings = {
"ctrl+f" = "launch --location=hsplit --allow-remote-control kitty +kitten ${inputs.kitty-search}/search.py @active-kitty-window-id";
- "ctrl+r" = "load_config_file";
+ "ctrl+alt+r" = "load_config_file";
+ "ctrl+shift+r" = "no_op";
"ctrl+EQUAL" = "change_font_size all +2.0";
"ctrl+minus" = "change_font_size all -2.0";
"ctrl+0" = "change_font_size all 0";
+ "ctrl+/" = "send_text all \x1b[47;5u";
};
};
}
diff --git a/programs/nvim/config.lua b/programs/nvim/config.lua
index 9d8e77e..0c7f518 100644
--- a/programs/nvim/config.lua
+++ b/programs/nvim/config.lua
@@ -19,7 +19,10 @@ vim.filetype.add({
require("onedark").setup {
style = "deep",
highlights = {
- ["@comment"] = {fg = '#77B767'}
+ ["@lsp.type.comment"] = {fg = '#77B767'},
+ ["@comment.documentation.rust"] = {fg = '#77B767'},
+ ["@comment.documentation"] = {fg = '#77B767'},
+ ["@comment"] = {fg = '#426639'}
}
}
require("onedark").load()
@@ -68,10 +71,14 @@ local opts = { noremap = true, silent = true }
local builtin = require('telescope.builtin')
-- comment
-vim.keymap.set("n", "", ":lua require('Comment.api').toggle.linewise.current() j", opts)
-vim.keymap.set("v", "", ":lua require('Comment.api').toggle.linewise.current() j", opts)
+vim.keymap.set("n", "c", ":lua require('Comment.api').toggle.linewise.current() j", { remap = true })
+vim.keymap.set("v", "c", ":lua require('Comment.api').toggle.linewise.current() j", { remap = true })
--- indent and dedent using tab/shift-tab
+
+vim.keymap.set("n", "", ":lua require('Comment.api').toggle.linewise.current() j", { remap = true })
+vim.keymap.set("v", "", ":lua require('Comment.api').toggle.linewise.current() j", { remap = true })
+
+-- indent and dedent using tab/shift-ta
vim.keymap.set("n", "", ">>_")
vim.keymap.set("n", "", "<<_")
vim.keymap.set("i", "", "")
@@ -85,7 +92,7 @@ vim.keymap.set('n', 'gt', builtin.lsp_type_definitions, {})
-- format on wq and x and replace X, W and Q with x, w and q
vim.cmd [[cabbrev wq execute "Format sync" wq]]
-vim.cmd [[cabbrev x execute "Format sync" x]# ]]
+vim.cmd [[cabbrev x execute "Format sync" x]]
vim.cmd [[cnoreabbrev W w]]
vim.cmd [[cnoreabbrev X execute "Format sync" x]]
vim.cmd [[cnoreabbrev Q q]]
@@ -94,14 +101,21 @@ vim.cmd [[nnoremap ; :]]
local builtin = require('telescope.builtin')
vim.keymap.set('n', 's', "vertical sb", {})
-vim.keymap.set('n', 'f', builtin.find_files, {})
-vim.keymap.set('n', '', builtin.live_grep, {})
+vim.keymap.set('n', '', builtin.find_files, {})
+vim.keymap.set('n', 'f', builtin.live_grep, {})
vim.keymap.set('n', 'h', builtin.search_history, {})
vim.keymap.set('n', 'd', "Telescope diagnostics bufnr=0", {})
vim.keymap.set('n', 'ad', builtin.diagnostics, {})
+vim.keymap.set('n', 'em', "RustLsp expandMacro")
vim.keymap.set("n", "]d", vim.diagnostic.goto_next)
vim.keymap.set("n", "[d", vim.diagnostic.goto_prev)
+vim.keymap.set("n", "x", require("telescope.builtin").resume, {
+ noremap = true,
+ silent = true,
+ desc = "Resume",
+})
+
local gitsigns = require('gitsigns')
vim.keymap.set('n', 'gr', gitsigns.reset_hunk)
vim.keymap.set('n', 'gd', gitsigns.diffthis)
@@ -221,3 +235,10 @@ vim.cmd([[
filetype plugin indent on
]])
+
+-- multicursor
+vim.g.VM_default_mappings = 1
+vim.g.VM_reselect_first = 1
+vim.g.VM_notify_previously_selected = 1
+vim.g.VM_theme = "iceblue"
+
diff --git a/programs/nvim/default.nix b/programs/nvim/default.nix
index 5d09471..5efec20 100644
--- a/programs/nvim/default.nix
+++ b/programs/nvim/default.nix
@@ -62,6 +62,7 @@ in
nixGrammars = true;
ensureInstalled = "all";
};
+ rainbow-delimiters.enable = true;
surround.enable = true;
cmp-nvim-lsp.enable = true;
lsp-format.enable = true;
@@ -240,7 +241,6 @@ in
};
};
-
lsp = {
enable = true;
@@ -260,6 +260,7 @@ in
};
};
};
+
clangd = {
enable = true;
filetypes = [ "c" "cpp" "objc" "objcpp" ];
@@ -281,10 +282,10 @@ in
enable = true;
filetypes = [ "python" ];
};
- taplo = {
- enable = true;
- filetypes = [ "toml" ];
- };
+ # taplo = {
+ # enable = true;
+ # filetypes = [ "toml" ];
+ # };
bashls = {
enable = true;
@@ -306,8 +307,8 @@ in
keymaps = {
lspBuf = {
- "fmt" = "format";
- "h" = "hover";
+ ";" = "format";
+ "gh" = "hover";
};
};
};
@@ -338,6 +339,20 @@ in
enable = true;
diagnostics = "nvim_lsp";
};
+
+
+ none-ls = {
+ enable = true;
+ sources = {
+ formatting.nixpkgs_fmt.enable = true;
+ code_actions.statix.enable = true;
+ diagnostics = {
+ statix.enable = true;
+ deadnix.enable = true;
+ };
+ };
+ };
+ nix.enable = true;
};
extraPlugins = with pkgs.vimPlugins; [
onedark-nvim
@@ -352,13 +367,14 @@ in
render-markdown
otter
vim-astro
- nvim-web-devicons
+ nvim-web-devicons
+ vim-visual-multi
];
extraConfigLua = ''
- require("render-markdown").setup {
- latex_converter = '${pkgs.python312Packages.pylatexenc}/bin/latex2text',
- }
+ require("render-markdown").setup {
+ latex_converter = '${pkgs.python312Packages.pylatexenc}/bin/latex2text',
+ }
'' + (builtins.readFile ./config.lua);
opts = {
diff --git a/programs/tmux/default.nix b/programs/tmux/default.nix
new file mode 100644
index 0000000..5fc194c
--- /dev/null
+++ b/programs/tmux/default.nix
@@ -0,0 +1,96 @@
+{ pkgs, ... }: {
+ programs.tmux = {
+ enable = true;
+ mouse = true;
+ clock24 = true;
+
+ shortcut = "k";
+
+ extraConfig = ''
+ # unbind every single normal keybinding
+ unbind-key -a
+
+ set -g set-titles on
+ set -s escape-time 0
+
+ set-window-option -g mode-keys vi
+
+ # clipboard stuff
+ bind -T copy-mode-vi v send-keys -X begin-selection
+ bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel
+ bind v copy-mode
+ bind p paste-buffer -p
+ set -s set-clipboard on
+
+ # get back normal terminal emulator bindings
+ bind-key -n S-PPage copy-mode -u
+ bind-key -T copy-mode -n S-NPage send-keys -X page-down
+
+ # don't scroll to end when copying with mouse
+ bind-key -T copy-mode MouseDragEnd1Pane send-keys -X copy-pipe
+ bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe
+ bind-key -T copy-mode DoubleClick1Pane select-pane \; send-keys -X select-word \; run-shell -d 0.3 \; send-keys -X copy-pipe
+ bind-key -T copy-mode TripleClick1Pane select-pane \; send-keys -X select-line \; run-shell -d 0.3 \; send-keys -X copy-pipe
+ bind-key -T copy-mode-vi DoubleClick1Pane select-pane \; send-keys -X select-word \; run-shell -d 0.3 \; send-keys -X copy-pipe
+ bind-key -T copy-mode-vi TripleClick1Pane select-pane \; send-keys -X select-line \; run-shell -d 0.3 \; send-keys -X copy-pipe
+
+ # window control
+ bind t new-window -c "#{pane_current_path}"
+ bind-key Tab next-window
+ bind-key BTab previous-window
+ set -g automatic-rename-format "#{?#{==:#{pane_current_path},$HOME},~,#{b:pane_current_path}} (#{pane_current_command})"
+ set -g renumber-windows on
+ bind-key Q confirm-before -p "kill-window #W? (y/n)" kill-window
+ bind A last-window
+
+ bind-key 1 select-window -t :0
+ bind-key 2 select-window -t :1
+ bind-key 3 select-window -t :2
+ bind-key 4 select-window -t :3
+ bind-key 5 select-window -t :4
+ bind-key 6 select-window -t :5
+ bind-key 7 select-window -t :6
+ bind-key 8 select-window -t :7
+ bind-key 9 select-window -t :8
+ bind-key 0 select-window -t :9
+
+ # pane control
+ bind h select-pane -L
+ bind j select-pane -S
+ bind k select-pane -U
+ bind l select-pane -R
+ bind L split-window -h -c "#{pane_current_path}"
+ bind J split-window -v -c "#{pane_current_path}"
+ bind H split-window -h -b -c "#{pane_current_path}"
+ bind K split-window -v -b -c "#{pane_current_path}"
+ bind x swap-pane -D
+ bind -r a select-pane -l
+ bind-key q confirm-before -p "kill-pane #P? (y/n)" kill-pane
+
+ bind-key o choose-tree -wZ
+ bind-key O choose-tree -sZ
+
+ # get back command mode and some other basics...
+ bind : command-prompt
+ bind r source-file ~/.config/tmux/tmux.conf \; display "config reloaded"
+ bind-key ? list-keys
+
+ # Scroll oin man etc
+ tmux_commands_with_legacy_scroll="nano less more man git"
+
+ bind-key -T root WheelUpPane \
+ if-shell -Ft= '#{?mouse_any_flag,1,#{pane_in_mode}}' \
+ 'send -Mt=' \
+ 'if-shell -t= "#{?alternate_on,true,false} || echo \"#{tmux_commands_with_legacy_scroll}\" | grep -q \"#{pane_current_command}\"" \
+ "send -t= Up" "copy-mode -et="'
+
+ bind-key -T root WheelDownPane \
+ if-shell -Ft = '#{?pane_in_mode,1,#{mouse_any_flag}}' \
+ 'send -Mt=' \
+ 'if-shell -t= "#{?alternate_on,true,false} || echo \"#{tmux_commands_with_legacy_scroll}\" | grep -q \"#{pane_current_command}\"" \
+ "send -t= Down" "send -Mt="'
+
+ # bind -n DoubleClick1Pane run-shell "${pkgs.xdragon}/bin/dragon -x '#{pane_current_path}/#{mouse_word}'"
+ '';
+ };
+}