Nix hm #1

Merged
LarssonMartin1998 merged 106 commits from nix-hm into main 2025-02-25 14:13:05 +00:00
112 changed files with 1804 additions and 1338 deletions

1
.gitignore vendored
View file

@ -1,3 +1,4 @@
.DS_Store .DS_Store
home/.config/lazygit/state.yml home/.config/lazygit/state.yml
neomuttrc.local neomuttrc.local
result

View file

@ -69,7 +69,7 @@ cmd-alt-h = [] # Disable "hide others"
# All possible modifiers: cmd, alt, ctrl, shift # All possible modifiers: cmd, alt, ctrl, shift
# All possible commands: https://nikitabobko.github.io/AeroSpace/commands # All possible commands: https://nikitabobko.github.io/AeroSpace/commands
cmd-enter = 'exec-and-forget open -n /Applications/Alacritty.app' cmd-enter = 'exec-and-forget open -n /Applications/Ghostty.app'
# See: https://nikitabobko.github.io/AeroSpace/commands#layout # See: https://nikitabobko.github.io/AeroSpace/commands#layout
# alt-slash = 'layout tiles horizontal vertical' # alt-slash = 'layout tiles horizontal vertical'

277
flake.lock generated Normal file
View file

@ -0,0 +1,277 @@
{
"nodes": {
"brew-src": {
"flake": false,
"locked": {
"lastModified": 1731323744,
"narHash": "sha256-SxUQm4cTHcaoPQHoXe26ZV8cZiMWBGow8MjE4L+MckM=",
"owner": "Homebrew",
"repo": "brew",
"rev": "254bf3fe9d8fa2e1b2fb55dbcf535b2d870180c4",
"type": "github"
},
"original": {
"owner": "Homebrew",
"ref": "4.4.5",
"repo": "brew",
"type": "github"
}
},
"flake-compat": {
"flake": false,
"locked": {
"lastModified": 1733328505,
"narHash": "sha256-NeCCThCEP3eCl2l/+27kNNK7QrwZB1IJCrXfrbv5oqU=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "ff81ac966bb2cae68946d5ed5fc4994f96d0ffec",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1731533236,
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"home-manager": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1740347597,
"narHash": "sha256-st5q9egkPGz8TUcVVlIQX7y6G3AzHob+6M963bwVq74=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "12e26a74e5eb1a31e13daaa08858689e25ebd449",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "home-manager",
"type": "github"
}
},
"neovim": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs"
},
"locked": {
"lastModified": 1740326390,
"narHash": "sha256-fAT9H/sPTOyGR/L7HAKgEw270i6t0fYCay0WP39R2ho=",
"owner": "LarssonMartin1998",
"repo": "neovim-flake",
"rev": "03b2f8498cf44ca7ab6436f5a081772f3e378be4",
"type": "github"
},
"original": {
"owner": "LarssonMartin1998",
"repo": "neovim-flake",
"type": "github"
}
},
"nix-darwin": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1739933872,
"narHash": "sha256-UhuvTR4OrWR+WBaRCZm4YMkvjJhZ1KZo/jRjE41m+Ek=",
"owner": "LnL7",
"repo": "nix-darwin",
"rev": "6ab392f626a19f1122d1955c401286e1b7cf6b53",
"type": "github"
},
"original": {
"owner": "LnL7",
"ref": "master",
"repo": "nix-darwin",
"type": "github"
}
},
"nix-darwin_2": {
"inputs": {
"nixpkgs": "nixpkgs_2"
},
"locked": {
"lastModified": 1716329735,
"narHash": "sha256-ap51w+VqG21vuzyQ04WrhI2YbWHd3UGz0e7dc/QQmoA=",
"owner": "LnL7",
"repo": "nix-darwin",
"rev": "eac4f25028c1975a939c8f8fba95c12f8a25e01c",
"type": "github"
},
"original": {
"owner": "LnL7",
"repo": "nix-darwin",
"type": "github"
}
},
"nix-homebrew": {
"inputs": {
"brew-src": "brew-src",
"nix-darwin": "nix-darwin_2",
"nixpkgs": "nixpkgs_3"
},
"locked": {
"lastModified": 1736041957,
"narHash": "sha256-Kk/cVtkxwfHNoB6nINUarMLTtyAEvH+ohzxKBptMzzg=",
"owner": "zhaofengli-wip",
"repo": "nix-homebrew",
"rev": "a6d99cc7436fc18c097b3536d9c45c0548c694c8",
"type": "github"
},
"original": {
"owner": "zhaofengli-wip",
"repo": "nix-homebrew",
"type": "github"
}
},
"nixos-wsl": {
"inputs": {
"flake-compat": "flake-compat",
"nixpkgs": "nixpkgs_4"
},
"locked": {
"lastModified": 1740046902,
"narHash": "sha256-Xbhz8eEqBmNpvqaGFbF5JopmfNJccWUr8eExtU/iGX4=",
"owner": "nix-community",
"repo": "NixOS-WSL",
"rev": "c4f6ae89468939d9fcf1a317c062cf5dd02004ea",
"type": "github"
},
"original": {
"owner": "nix-community",
"ref": "main",
"repo": "NixOS-WSL",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1740019556,
"narHash": "sha256-vn285HxnnlHLWnv59Og7muqECNMS33mWLM14soFIv2g=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "dad564433178067be1fbdfcce23b546254b6d641",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1687274257,
"narHash": "sha256-TutzPriQcZ8FghDhEolnHcYU2oHIG5XWF+/SUBNnAOE=",
"path": "/nix/store/22qgs3skscd9bmrxv9xv4q5d4wwm5ppx-source",
"rev": "2c9ecd1f0400076a4d6b2193ad468ff0a7e7fdc5",
"type": "path"
},
"original": {
"id": "nixpkgs",
"type": "indirect"
}
},
"nixpkgs_3": {
"locked": {
"lastModified": 1716330097,
"narHash": "sha256-8BO3B7e3BiyIDsaKA0tY8O88rClYRTjvAp66y+VBUeU=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "5710852ba686cc1fd0d3b8e22b3117d43ba374c2",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_4": {
"locked": {
"lastModified": 1739624908,
"narHash": "sha256-f84lBmLl4tkDp1ZU5LBTSFzlxXP4926DVW3KnXrke10=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "a60651b217d2e529729cbc7d989c19f3941b9250",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-24.11",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_5": {
"locked": {
"lastModified": 1740367490,
"narHash": "sha256-WGaHVAjcrv+Cun7zPlI41SerRtfknGQap281+AakSAw=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "0196c0175e9191c474c26ab5548db27ef5d34b05",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"home-manager": "home-manager",
"neovim": "neovim",
"nix-darwin": "nix-darwin",
"nix-homebrew": "nix-homebrew",
"nixos-wsl": "nixos-wsl",
"nixpkgs": "nixpkgs_5"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

159
flake.nix Normal file
View file

@ -0,0 +1,159 @@
{
description = "LarssonMartin1998's dotfiles configured with Home Manager";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
nix-darwin = {
url = "github:LnL7/nix-darwin/master";
inputs.nixpkgs.follows = "nixpkgs";
};
nixos-wsl.url = "github:nix-community/NixOS-WSL/main";
neovim.url = "github:LarssonMartin1998/neovim-flake";
nix-homebrew.url = "github:zhaofengli-wip/nix-homebrew";
};
outputs =
{
self,
nixpkgs,
home-manager,
nix-darwin,
nixos-wsl,
neovim,
nix-homebrew,
...
}:
let
lib = nixpkgs.lib;
makeSystemConfig =
{
name,
system,
builder,
extraModules ? [ ],
specialArgs ? { },
}:
builder {
inherit system;
pkgs = import nixpkgs {
inherit system;
config = {
allowUnfree = true;
};
};
modules = [
{
nix.settings.experimental-features = "nix-command flakes";
}
./nix/local_system.nix
] ++ extraModules;
specialArgs = specialArgs;
};
makeHomeConfig =
{
name,
system,
extraModules ? [ ],
}:
home-manager.lib.homeManagerConfiguration {
pkgs = import nixpkgs {
inherit system;
config = {
allowUnfree = true;
};
};
modules = [
./nix/pkgs/home.nix
./nix/local_home.nix
] ++ extraModules;
# Pass neovim-flake to all modules
extraSpecialArgs = {
neovim-flake = neovim;
};
};
in
{
nixosConfigurations = {
"wsl" = makeSystemConfig {
name = "wsl";
system = "x86_64-linux";
builder = lib.nixosSystem;
extraModules = [ ./nix/system/wsl.nix ];
specialArgs = {
nixos-wsl = nixos-wsl;
};
};
"linux-x86" = makeSystemConfig {
name = "linux-x86";
system = "x86_64-linux";
builder = lib.nixosSystem;
extraModules = [ ./nix/system/linux.nix ];
};
"linux-aarch" = makeSystemConfig {
name = "linux-aarch";
system = "aarch64-linux";
builder = lib.nixosSystem;
extraModules = [ ./nix/system/linux.nix ];
};
};
darwinConfigurations."darwin" = makeSystemConfig {
name = "darwin";
system = "aarch64-darwin";
builder = nix-darwin.lib.darwinSystem;
extraModules = [
./nix/system/darwin.nix
nix-homebrew.darwinModules.nix-homebrew
{
nix-homebrew = {
enable = true;
enableRosetta = true;
};
}
];
specialArgs = {
self = self;
nix-homebrew = nix-homebrew;
};
};
homeConfigurations = {
"wsl" = makeHomeConfig {
name = "wsl";
system = "x86_64-linux";
extraModules = [ ./nix/pkgs/wsl.nix ];
};
"linux-x86" = makeHomeConfig {
name = "linux-x86";
system = "x86_64-linux";
extraModules = [ ./nix/pkgs/linux.nix ];
};
"linux-aarch" = makeHomeConfig {
name = "linux-aarch";
system = "aarch64-linux";
extraModules = [ ./nix/pkgs/linux.nix ];
};
"darwin" = makeHomeConfig {
name = "darwin";
system = "aarch64-darwin";
extraModules = [ ./nix/pkgs/darwin.nix ];
};
};
};
}

View file

@ -11,6 +11,8 @@ font-style-bold = Bold
font-style-italic = Italic font-style-italic = Italic
font-style-bold-italic = Bold Italic font-style-bold-italic = Bold Italic
font-feature = ss01 font-feature = ss01
font-feature = ss19
font-feature = ss20
font-feature = -calt font-feature = -calt
scrollback-limit = 100000 scrollback-limit = 100000
@ -20,16 +22,19 @@ clipboard-paste-protection = false
window-decoration = false window-decoration = false
shell-integration = zsh shell-integration = zsh
background = #1F2430 theme = Ayu Mirage
# Transparency background-opacity = 0.90
background-opacity = 0.95 background-blur-radius = 7
background-blur-radius = 20
bold-is-bright = true bold-is-bright = true
cursor-invert-fg-bg = true cursor-invert-fg-bg = false
link-url = true link-url = true
mouse-hide-while-typing = true mouse-hide-while-typing = true
window-vsync = true window-vsync = true
cursor-click-to-move = false
cursor-text = #000000
macos-option-as-alt=true
keybind = ctrl+comma=unbind keybind = ctrl+comma=unbind
keybind = alt+one=unbind keybind = alt+one=unbind
@ -41,3 +46,5 @@ keybind = alt+six=unbind
keybind = alt+seven=unbind keybind = alt+seven=unbind
keybind = alt+eight=unbind keybind = alt+eight=unbind
keybind = alt+nine=unbind keybind = alt+nine=unbind
keybind = alt+left=unbind
keybind = alt+right=unbind

View file

@ -1,47 +0,0 @@
{
"arrow.nvim": { "branch": "master", "commit": "5438c977e729a29d96bd54c8da3103154e80dbd1" },
"auto-session": { "branch": "main", "commit": "021b64ed7d4ac68a37be3ad28d8e1cba5bec582c" },
"blink.cmp": { "branch": "main", "commit": "1cc3b1a908fbcfd15451c4772759549724f38524" },
"codecompanion.nvim": { "branch": "main", "commit": "e3c528aab52f32513fdb771e3e27d93efe57e12a" },
"codesnap.nvim": { "branch": "main", "commit": "6400480aa6cc366cbd931146c429aaa64680dab9" },
"copilot.vim": { "branch": "release", "commit": "87038123804796ca7af20d1b71c3428d858a9124" },
"diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" },
"dressing.nvim": { "branch": "master", "commit": "3a45525bb182730fe462325c99395529308f431e" },
"fzf-lua": { "branch": "main", "commit": "6f7249741168c0751356e3b6c5c1e3bade833b6b" },
"gitsigns.nvim": { "branch": "main", "commit": "76d88f3b584e1f83b2aa51663a32cc6ee8d97eff" },
"incline.nvim": { "branch": "main", "commit": "16fc9c073e3ea4175b66ad94375df6d73fc114c0" },
"indent-blankline.nvim": { "branch": "master", "commit": "7a698a1d7ed755af9f5a88733b23ca246ce2df28" },
"lazy.nvim": { "branch": "main", "commit": "d8f26efd456190241afd1b0f5235fe6fdba13d4a" },
"leap.nvim": { "branch": "main", "commit": "c6bfb191f1161fbabace1f36f578a20ac6c7642c" },
"lspsaga.nvim": { "branch": "main", "commit": "7dae6e92c82964a8889d3cd999dfd4f271e3a873" },
"lua-utils.nvim": { "branch": "main", "commit": "e565749421f4bbb5d2e85e37c3cef9d56553d8bd" },
"lualine.nvim": { "branch": "master", "commit": "2a5bae925481f999263d6f5ed8361baef8df4f83" },
"mason-tool-installer.nvim": { "branch": "main", "commit": "c5e07b8ff54187716334d585db34282e46fa2932" },
"mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" },
"mini.diff": { "branch": "main", "commit": "00f072250061ef498f91ed226918c9ec31a416a4" },
"neogit": { "branch": "master", "commit": "060a625660b2816649d83dbd6c7ab1b4345ea8bc" },
"neorg": { "branch": "main", "commit": "29993a7bb8279ffa0ba473a3f393daa28c645825" },
"neovim-ayu": { "branch": "master", "commit": "283badaa983234c90e857c12c1f1c18e1544360a" },
"noice.nvim": { "branch": "main", "commit": "eaed6cc9c06aa2013b5255349e4f26a6b17ab70f" },
"nui.nvim": { "branch": "main", "commit": "53e907ffe5eedebdca1cd503b00aa8692068ca46" },
"nvim-colorizer.lua": { "branch": "master", "commit": "a065833f35a3a7cc3ef137ac88b5381da2ba302e" },
"nvim-dap": { "branch": "master", "commit": "99807078c5089ed30e0547aa4b52c5867933f426" },
"nvim-dap-go": { "branch": "main", "commit": "1bacf2fa7d4dc6a8a4f6cc390f1544e5b34c35a4" },
"nvim-dap-python": { "branch": "master", "commit": "34282820bb713b9a5fdb120ae8dd85c2b3f49b51" },
"nvim-dap-repl-highlights": { "branch": "master", "commit": "a7512fc0a0de0c0be8d58983939856dda6f72451" },
"nvim-dap-ui": { "branch": "master", "commit": "727c032a8f63899baccb42a1c26f27687e62fc5e" },
"nvim-dap-virtual-text": { "branch": "master", "commit": "df66808cd78b5a97576bbaeee95ed5ca385a9750" },
"nvim-nio": { "branch": "master", "commit": "a428f309119086dc78dd4b19306d2d67be884eee" },
"nvim-notify": { "branch": "master", "commit": "a3020c2cf4dfc4c4f390c4a21e84e35e46cf5d17" },
"nvim-surround": { "branch": "main", "commit": "9f0cb495f25bff32c936062d85046fbda0c43517" },
"nvim-treesitter": { "branch": "master", "commit": "984214ef8e4ca18d77639663319aabdfba89632f" },
"nvim-treesitter-context": { "branch": "master", "commit": "d0dd7ce5a9d0be1f28086e818e52fdc5c78975df" },
"nvim-treesitter-textobjects": { "branch": "master", "commit": "ad8f0a472148c3e0ae9851e26a722ee4e29b1595" },
"nvim-web-devicons": { "branch": "master", "commit": "aafa5c187a15701a7299a392b907ec15d9a7075f" },
"pathlib.nvim": { "branch": "main", "commit": "57e5598af6fe253761c1b48e0b59b7cd6699e2c1" },
"persistent-breakpoints.nvim": { "branch": "main", "commit": "4b199b1dcfd136cac8b0fa9c8dbbdeb81463f7a9" },
"plenary.nvim": { "branch": "master", "commit": "3707cdb1e43f5cea73afb6037e6494e7ce847a66" },
"rustaceanvim": { "branch": "master", "commit": "0a1876b970ab946be3f4d341e9d743a5d62d646a" },
"tiny-inline-diagnostic.nvim": { "branch": "main", "commit": "5922bb3dd691a2a37bd51e20d4a3dc7895221e51" },
"vim-repeat": { "branch": "master", "commit": "65846025c15494983dafe5e3b46c8f88ab2e9635" }
}

View file

@ -1,151 +0,0 @@
local g = vim.g
g.mapleader = " "
g.maplocalleader = " "
local move_up = {
cmd = "v:count || mode(1)[0:1] == \"no\" ? \"k\" : \"gk\"",
opts = {
expr = true
}
}
local move_down = {
cmd = "v:count || mode(1)[0:1] == \"no\" ? \"j\" : \"gj\"",
opts = {
expr = true
}
}
local utils = require("utils")
utils.add_keymaps({
n = {
-- Using lspsaga for hover doc
["K"] = {
cmd = "<Nop>",
},
-- Using lspsaga finder with gr which does references
["grr"] = {
cmd = "<Nop>",
},
["gra"] = {
cmd = "<Nop>",
},
["grn"] = {
cmd = "<Nop>",
},
["gri"] = {
cmd = "<Nop>",
},
-- Navigation
["<C-Left>"] = {
cmd = "<C-w>h",
},
["<C-Down>"] = {
cmd = "<C-w>j",
},
["<C-Up>"] = {
cmd = "<C-w>k",
},
["<C-Right>"] = {
cmd = "<C-w>l",
},
["<C-h>"] = {
cmd = "<C-w>h",
},
["<C-j>"] = {
cmd = "<C-w>j",
},
["<C-k>"] = {
cmd = "<C-w>k",
},
["<C-l>"] = {
cmd = "<C-w>l",
},
-- Window
["<C-q>"] = {
cmd = "<C-w>q",
},
-- Disable current highlights
["<Esc>"] = {
cmd = "<cmd> noh <CR>",
},
-- Copies the entire file
["<C-c>"] = {
cmd = ":%y+<CR>",
opts = {
silent = true
}
},
-- Allow moving the cursor through wrapped lines with <Up> and <Down>
-- http://www.reddit.com/r/vim/comments/2k4cbr/problem_with_gj_and_gk/
-- empty mode is same as using <cmd> :map
-- also don't use g[j|k] when in operator pending mode, so it doesn't alter d, y or c behaviour
["<Up>"] = move_up,
["<Down>"] = move_down,
["j"] = move_down,
["k"] = move_up,
-- Maps to remove
["<C-z>"] = {
cmd = "<Nop>",
},
-- Marks are less frequently used than leaping, also, less relevant with arrow and fzf navigation.
-- Prioritize regular m for leaping, and <leader>m for setting marks.
["<leader>m"] = {
cmd = "m",
},
["[d"] = {
cmd = function()
vim.diagnostic.jump({ count = -1, float = false })
end
},
["]d"] = {
cmd = function()
vim.diagnostic.jump({ count = 1, float = false })
end
},
},
i = {},
v = {
["<Up>"] = move_up,
["<Down>"] = move_down,
["j"] = move_down,
["k"] = move_up,
["<tab>"] = {
cmd = ">gv",
},
["<S-tab>"] = {
cmd = "<gv",
},
-- Marks are less frequently used than leaping, also, less relevant with arrow and fzf navigation.
-- Prioritize regular m for leaping, and <leader>m for setting marks.
["<leader>m"] = {
cmd = "m",
},
},
x = {
["<Up>"] = move_up,
["<Down>"] = move_down,
["j"] = move_down,
["k"] = move_up,
["p"] = {
cmd = "p:let @+=@0<CR>:let @\"=@0<CR>",
opts = {
silent = true
},
},
},
t = {
["<C-q>"] = {
cmd = "<C-\\><C-N>",
},
},
})

View file

@ -1,20 +0,0 @@
return {
"rmagatti/auto-session",
opts = {
log_level = "error",
auto_session_suppress_dirs = {
"/",
"~/",
"~/Projects",
"~/Downloads",
"~/Development",
"~/Dev",
"~/Dev/Git",
"~/.config",
"~/dev/git/.dotfiles",
},
},
init = function()
vim.o.sessionoptions = "localoptions"
end
}

View file

@ -1,56 +0,0 @@
return {
"olimorris/codecompanion.nvim",
dependencies = {
"nvim-lua/plenary.nvim",
"nvim-treesitter/nvim-treesitter",
-- "hrsh7th/nvim-cmp",
{ 'echasnovski/mini.diff', version = false },
{ "stevearc/dressing.nvim", opts = {} },
},
config = function()
require("codecompanion").setup({
strategies = {
chat = {
adapter = "copilot",
},
inline = {
adapter = "copilot",
},
agent = {
adapter = "copilot",
},
},
adapters = {
copilot = function() return require("codecompanion.adapters").extend("copilot", {}) end,
},
display = {
diff = {
provider = "mini_diff",
},
},
opts = {
log_level = "DEBUG",
},
})
local keymaps = {
n = {
["<Leader>ci"] = { cmd = "<cmd>CodeCompanion<cr>" },
["<Leader>cc"] = { cmd = "<cmd>CodeCompanionChat toggle<cr>" },
["<Leader>cm"] = { cmd = "<cmd>CodeCompanion /commit<cr>" },
},
v = {
["<Leader>ci"] = { cmd = "<cmd>CodeCompanion<cr>" },
["ga"] = { cmd = "<cmd>CodeCompanionAdd<cr>" },
["<Leader>ce"] = { cmd = "<cmd>CodeCompanion /explain<cr>" },
["<Leader>cf"] = { cmd = "<cmd>CodeCompanion /fix<cr>" },
["<Leader>ct"] = { cmd = "<cmd>CodeCompanion /tests<cr>" },
}
}
local utils = require("utils")
utils.add_opts_to_all_mappings(keymaps, { silent = true })
utils.add_keymaps(keymaps)
vim.cmd([[cab cc CodeCompanion]])
end
}

View file

@ -1,26 +0,0 @@
return {
"mistricky/codesnap.nvim",
build = "make",
event = "VeryLazy",
lazy = true,
config = function()
require("codesnap").setup({
mac_window_bar = true,
title = "codesnap.nvim",
code_font_family = "JetBrainsMono Nerd Font",
breadcrumbs_separator = "/",
has_breadcrumbs = true,
bg_theme = "grape",
watermark = "",
})
require("utils").add_keymaps({
v = {
["<leader>cs"] = {
cmd = ":CodeSnap<CR>",
opts = { silent = true },
},
}
})
end,
}

View file

@ -1,18 +0,0 @@
return {
"github/copilot.vim",
config = function()
vim.g.copilot_no_tab_map = true
require("utils").add_keymaps({
i = {
["<Right>"] = {
cmd = 'copilot#Accept("\\<Right>")',
opts = {
expr = true,
replace_keycodes = false,
silent = true,
}
}
}
})
end
}

View file

@ -1,71 +0,0 @@
return {
"ibhagwan/fzf-lua",
dependencies = { "nvim-tree/nvim-web-devicons" },
opts = {
"telescope",
winopts = {
preview = {
default = "bat"
}
},
lsp = {
workspace_symbols = {
symbol_kinds = { "Variable", "Function", "Method", "Class", "Struct", "Interface" },
},
},
previewers = {
builtin = {
-- turn off syntax highlighting for files with more than 100KB
-- this avoid hanging when previewing large files (due to treesitter parsing on minified files)
syntax_limit_b = 1024 * 100, -- 100KB
}
}
},
config = function()
local fzf = require("fzf-lua")
local pickers = {
{
mapping = "o",
action = function()
fzf.files({
git_icons = false,
})
end
},
{
mapping = "a",
action = function()
fzf.live_grep_native({
git_icons = false,
rg_opts = "--hidden --column --line-number --no-heading --color=always --smart-case",
fzf_opts = {
['--exact'] = false, -- Disable exact matching
},
})
end
},
{
mapping = "g",
action = function()
fzf.git_bcommits({})
end
},
{
mapping = "s",
action = function()
fzf.lsp_live_workspace_symbols({})
end
}
}
local keymaps = {}
keymaps.n = {}
for _, picker in ipairs(pickers) do
keymaps.n["<leader>t" .. picker.mapping] = {
cmd = picker.action
}
end
require("utils").add_keymaps(keymaps)
end
}

View file

@ -1,101 +0,0 @@
return {
"b0o/incline.nvim",
dependencies = {
"lewis6991/gitsigns.nvim"
},
event = "VeryLazy",
lazy = true,
config = function()
local gitsigns = require("gitsigns")
gitsigns.setup({})
local devicons = require("nvim-web-devicons")
require("incline").setup({
window = {
padding = 0,
},
hide = {
cursorline = true,
},
render = function(props)
local filename = vim.fn.fnamemodify(vim.api.nvim_buf_get_name(props.buf), ":t")
if filename == "" then
filename = "[No Name]"
end
local ft_icon, ft_color = devicons.get_icon_color(filename)
local function get_git_diff()
local icons = { removed = "", changed = "", added = "" }
local signs = vim.b[props.buf].gitsigns_status_dict
local labels = {}
if signs == nil then
return labels
end
for name, icon in pairs(icons) do
if tonumber(signs[name]) and signs[name] > 0 then
table.insert(labels, { icon .. " " .. signs[name] .. " ", group = "Diff" .. name })
end
end
if #labels > 0 then
table.insert(labels, { "" })
end
return labels
end
local function get_diagnostic_label()
local icons = { error = "", warn = "", info = "", hint = "" }
local label = {}
for severity, icon in pairs(icons) do
local n = #vim.diagnostic.get(props.buf,
{ severity = vim.diagnostic.severity[string.upper(severity)] })
if n > 0 then
table.insert(label, { icon .. " " .. n .. " ", group = "DiagnosticSign" .. severity })
end
end
if #label > 0 then
table.insert(label, { "" })
end
return label
end
local function get_arrow_label()
local statusline = require("arrow.statusline")
if statusline.is_on_arrow_file(props.buf) == nil then
return ""
end
return " " .. statusline.text_for_statusline_with_icons(props.buf)
end
return {
guibg = "#1e2030",
guifg = "#cad3f5",
{ " " },
{ get_diagnostic_label() },
{ get_git_diff() },
{ (ft_icon or "") .. " ", guifg = ft_color, guibg = "none" },
{ filename .. "", gui = vim.bo[props.buf].modified and "bold,italic" or "bold" },
{ get_arrow_label() .. "" .. vim.api.nvim_win_get_number(props.win), group = "DevIconWindows" },
{ " " }
}
end,
require("utils").add_keymaps({
n = {
["<leader>gh"] = {
cmd = gitsigns.preview_hunk
},
["<leader>gb"] = {
cmd = gitsigns.toggle_current_line_blame
},
["[g"] = {
cmd = function() gitsigns.nav_hunk("prev") end
},
["]g"] = {
cmd = function() gitsigns.nav_hunk("next") end
}
}
})
})
end,
}

View file

@ -1,11 +0,0 @@
return {
"lukas-reineke/indent-blankline.nvim",
main = "ibl",
event = "BufRead",
opts = {
debounce = 100,
scope = {
enabled = false
},
}
}

View file

@ -1,65 +0,0 @@
return {
-- "nvimdev/lspsaga.nvim",
"LarssonMartin1998/lspsaga.nvim", -- Use my own fork until PR's are merged
event = "LspAttach",
lazy = true,
-- dir = "~/dev/git/lspsaga.nvim",
dependencies = {
"nvim-tree/nvim-web-devicons",
},
after = "nvim-lspconfig",
config = function()
require("lspsaga").setup({
request_timeout = 750,
symbol_in_winbar = {
enable = false,
},
implement = {
enable = false,
},
outline = {
enable = false,
win_width = 52,
},
ui = {
border = "rounded",
title = false,
},
code_action = {
extend_gitsigns = true
},
hover = {
jump_on_first_press = true
},
})
local keymaps = {
n = {
["K"] = {
cmd = ":Lspsaga hover_doc<CR>"
},
["<leader>rn"] = {
cmd = ":Lspsaga rename<CR>"
},
["gr"] = {
cmd = ":Lspsaga finder<CR>"
},
["<leader>lt"] = {
cmd = ":Lspsaga peek_type_definition<CR>"
},
["<leader>ld"] = {
cmd = ":Lspsaga peek_definition<CR>"
},
["<leader>ca"] = {
cmd = ":Lspsaga code_action<CR>"
},
["<leader>lc"] = {
cmd = ":Lspsaga incoming_calls<CR>"
},
}
}
local utils = require("utils")
utils.add_opts_to_all_mappings(keymaps, { silent = true })
utils.add_keymaps(keymaps)
end,
}

View file

@ -1,51 +0,0 @@
local wm = require("window_management")
local function resize_mode()
if wm.is_in_resizing_mode() then
return "▲ Resizing ▼"
else
return ""
end
end
return {
"nvim-lualine/lualine.nvim",
dependencies = {
"nvim-tree/nvim-web-devicons"
},
event = "VeryLazy",
lazy = true,
config = function()
require("lualine").setup {
options = {
theme = "ayu",
section_separators = {
left = "",
right = "",
},
component_separators = {
left = "",
right = ""
},
icons_enabled = true,
},
sections = {
lualine_a = { "mode" },
lualine_b = { "branch", resize_mode },
lualine_c = { "buffers" },
lualine_x = { "encoding", "fileformat", "filetype" },
lualine_y = { "progress" },
lualine_z = { "location" }
},
inactive_sections = {
lualine_a = {},
lualine_b = {},
lualine_c = {},
lualine_x = {},
lualine_y = {},
lualine_z = {}
},
tabline = {},
}
end
}

View file

@ -1,36 +0,0 @@
return {
"williamboman/mason.nvim",
dependencies = { "WhoIsSethDaniel/mason-tool-installer.nvim" },
config = function()
require("mason").setup({})
require("mason-tool-installer").setup({
ensure_installed = {
-- LLVM debugger
"codelldb",
-- C and C++
"clangd",
"clang-format",
-- Rust
"rust-analyzer",
-- Go
"gopls",
"golangci-lint",
"delve",
-- Lua
"lua-language-server",
-- CMake
"cmake-language-server",
"cmakelang",
-- Python
"debugpy",
"pyright",
},
})
end
}

View file

@ -1,11 +0,0 @@
return {
"NeogitOrg/neogit",
dependencies = {
"sindrets/diffview.nvim",
},
event = "VeryLazy",
lazy = true,
config = function()
require("neogit").setup()
end
}

View file

@ -1,18 +0,0 @@
return {
"nvim-neorg/neorg",
opts = {
load = {
["core.defaults"] = {},
["core.dirman"] = {
config = {
workspaces = {
my_workspace = "~/.neorg",
},
},
},
["core.concealer"] = {},
},
},
event = "VeryLazy",
lazy = true,
}

View file

@ -1,152 +0,0 @@
local utils = require("utils")
local inlay_hints_handler = require("inlay_hints_handler")
local are_stepping_keymaps_active = false
return {
"mfussenegger/nvim-dap",
dependencies = {
"rcarriga/nvim-dap-ui",
-- Special adapters
"leoluz/nvim-dap-go",
"mfussenegger/nvim-dap-python",
{ "nvim-neotest/nvim-nio", lazy = true },
"LiadOz/nvim-dap-repl-highlights",
"theHamsta/nvim-dap-virtual-text",
"Weissle/persistent-breakpoints.nvim",
},
config = function()
local dap = require("dap")
local dapui = require("dapui")
-- Special adapters
require("dap-go").setup()
require("dap-python").setup("python3")
-- Special adapters
require("dap.ext.vscode").load_launchjs()
require("persistent-breakpoints").setup {
load_breakpoints_event = { "BufReadPost" }
}
require("nvim-dap-repl-highlights").setup()
require("nvim-dap-virtual-text").setup()
local virtual_text = require("nvim-dap-virtual-text/virtual_text")
local breakpoint_api = require("persistent-breakpoints.api")
dapui.setup({
controls = {
enabled = false,
},
layouts = {
{
elements = {
{
id = "watches",
size = 0.5
},
{
id = "stacks",
size = 0.5
}
},
position = "bottom",
size = 15
}
},
})
local stepping_keymaps = {
n = {
["m"] = {
cmd = function()
dap.step_out()
end
},
["n"] = {
cmd = function()
dap.step_over()
end
},
["i"] = {
cmd = function()
dap.step_into()
end
},
}
}
local function enter_debug_mode()
dapui.open()
if not are_stepping_keymaps_active then
utils.add_temporary_keymaps(stepping_keymaps)
are_stepping_keymaps_active = true
end
inlay_hints_handler.disable()
end
local function exit_debug_mode()
dapui.close()
if are_stepping_keymaps_active then
utils.remove_keymaps(stepping_keymaps)
are_stepping_keymaps_active = false
end
inlay_hints_handler.restore()
virtual_text.clear_virtual_text()
end
local dap_signs = {
{ "DapBreakpoint", { text = "🛑", texthl = "", linehl = "", numhl = "" } },
{ "DapBreakpointRejected", { text = "🔵", texthl = "", linehl = "", numhl = "" } },
{ "DapBreakpointCondition", { text = "🟥", texthl = "", linehl = "", numhl = "" } },
}
for _, sign in ipairs(dap_signs) do
vim.fn.sign_define(unpack(sign))
end
dap.listeners.after.event_initialized["dapui_config"] = function()
enter_debug_mode()
end
dap.listeners.before.event_terminated["dapui_config"] = function()
exit_debug_mode()
end
dap.listeners.before.event_exited["dapui_config"] = function()
exit_debug_mode()
end
utils.add_keymaps({
n = {
["<leader>dr"] = {
cmd = function()
dap.continue()
end
},
["<leader>bt"] = {
cmd = function()
breakpoint_api.toggle_breakpoint()
end
},
["<leader>bc"] = {
cmd = function()
breakpoint_api.set_conditional_breakpoint()
end
},
["<leader>br"] = { -- breakpoint remove
cmd = function()
breakpoint_api.clear_all_breakpoints()
end
},
["<leader>ds"] = {
cmd = function()
dap.disconnect({ terminateDebuggee = true })
dap.close()
exit_debug_mode()
end
},
}
})
end,
}

View file

@ -1,19 +0,0 @@
return {
"rachartier/tiny-inline-diagnostic.nvim",
event = "VeryLazy",
priority = 1000,
config = function()
require("tiny-inline-diagnostic").setup()
vim.diagnostic.config({
virtual_text = false,
})
vim.cmd [[
highlight DiagnosticUnderlineError gui=undercurl guisp=#ff0000 " Red for error
highlight DiagnosticUnderlineWarn gui=undercurl guisp=#ffaa00 " Yellow/Orange for warning
highlight DiagnosticUnderlineHint gui=undercurl guisp=#00ffff " Cyan for hint
highlight DiagnosticUnderlineInfo gui=undercurl guisp=#0000ff " Blue for info
]]
end
}

View file

@ -1,205 +0,0 @@
local M = {}
local overridden_default_keymaps = {}
local function is_single_keymap_table(map_table)
assert(map_table)
return map_table.n or map_table.t or map_table.i or map_table.v or map_table.x or map_table.o
end
function M.get_file_names_in_dir(dir, expr, strip_extension)
local path = vim.fn.stdpath("config") .. "/lua/" .. dir
local files_str = vim.fn.globpath(path, expr, true)
local has_line_breaks = vim.fn.match(files_str, [[\n]]) > -1
local files = has_line_breaks and vim.fn.split(files_str, "\n") or { files_str }
local should_strip_extension = strip_extension or false
if should_strip_extension then
return vim.tbl_map(function(file)
return vim.fn.fnamemodify(file, ":t:r")
end, files)
else
return files
end
end
function M.validate_bufnr(bufnr)
vim.validate('bufnr', bufnr, 'number')
return bufnr == 0 and vim.api.nvim_get_current_buf() or bufnr
end
function M.xpcallmsg(fn, err_msg, err_container)
return xpcall(fn, function(err)
if err_container then
table.insert(err_container, err_msg .. ": " .. err)
else
error(err_msg .. ": " .. err)
end
end)
end
function M.foreach(t, f)
for _, v in pairs(t) do
f(v)
end
end
function M.create_user_event_cb(event_name, function_callback, augroup)
assert(event_name and event_name ~= "", "Event name must be provided")
assert(function_callback and type(function_callback) == "function", "Callback must be a valid function")
local cmd = {
callback = function_callback,
pattern = event_name,
}
if augroup then
cmd.group = augroup
end
vim.api.nvim_create_autocmd("User", cmd)
end
function M.broadcast_event(event_name)
vim.api.nvim_command("doautocmd <nomodeline> User " .. event_name)
end
function M.add_opts_to_all_mappings(mappings, opts)
assert(opts and mappings)
for _, modes in pairs(mappings) do
for _, mapping in pairs(modes) do
local existing_opts = mapping.opts or {}
mapping.opts = vim.tbl_extend("force", existing_opts, opts)
end
end
end
local function pass_keymap_tbl_to_fn(maps, fn)
if is_single_keymap_table(maps) then
fn(maps)
else
for _, map_table in pairs(maps) do
fn(map_table)
end
end
end
local function get_keymaps(mode, buffer)
if buffer then
return vim.api.nvim_buf_get_keymap(buffer, mode)
end
return vim.api.nvim_get_keymap(mode)
end
function M.add_temporary_keymaps(maps)
assert(maps)
pass_keymap_tbl_to_fn(maps, function(map_table)
for mode, entries in pairs(map_table) do
-- We make an assumptino here which is that all the entries are buffers, or not buffers.
-- Meaning, we only check the first entry and trust that the rest are the same.
local result = get_keymaps(mode, (function()
for _, entry in pairs(entries) do
-- nil buffer is treated as a global keymap
return entry.buffer
end
end)())
for code, _ in pairs(entries) do
for _, map in ipairs(result) do
if map.lhs == code then
if not overridden_default_keymaps[mode] then
overridden_default_keymaps[mode] = {}
end
overridden_default_keymaps[mode][code] = {
cmd = map.callback or map.rhs,
opts = {
noremap = map.noremap == 1,
expr = map.expr == 1,
silent = map.silent == 1,
nowait = map.nowait == 1,
script = map.script == 1,
buffer = type(map.buffer) == "number" and map.buffer or nil,
},
}
end
end
end
end
end)
M.add_keymaps(maps)
end
function M.add_keymaps(maps)
assert(maps)
pass_keymap_tbl_to_fn(maps, function(map_table)
for mode, entries in pairs(map_table) do
for code, info in pairs(entries) do
vim.keymap.set(mode, code, info.cmd, info.opts)
end
end
end)
end
function M.remove_keymaps(maps)
assert(maps)
pass_keymap_tbl_to_fn(maps, function(map_table)
for mode, entries in pairs(map_table) do
local overriden_mode = overridden_default_keymaps[mode]
for code, _ in pairs(entries) do
vim.keymap.del(mode, code)
if overriden_mode and overriden_mode[code] then
vim.keymap.set(mode, code, overriden_mode[code].cmd, overriden_mode[code].opts)
end
end
end
end)
end
function M.is_buf_filetype(bufnr, filetype)
return vim.api.nvim_buf_get_option(bufnr, "filetype") == filetype
end
function M.is_buf_buftype(bufnr, filetype)
return vim.api.nvim_buf_get_option(bufnr, "buftype") == filetype
end
function M.lock_buf_to_window(win_id, bufnr, filetype)
local augroup_id = vim.api.nvim_create_augroup("LockWindow" .. win_id, { clear = true })
vim.api.nvim_create_autocmd("BufEnter", {
group = augroup_id,
callback = function()
local current_win = vim.api.nvim_get_current_win()
if current_win ~= win_id then
return
end
local current_buf = vim.api.nvim_win_get_buf(win_id)
if current_buf == bufnr then
return
end
if M.is_buf_filetype(current_buf, filetype) then
bufnr = current_buf
return
end
vim.api.nvim_win_set_buf(win_id, bufnr)
end,
})
end
function M.calculate_split_size(term_size, percentage, min_size, max_size)
local calculated_size = math.floor(term_size * percentage)
return math.min(math.max(calculated_size, min_size), max_size)
end
return M

62
nix/home.nix Normal file
View file

@ -0,0 +1,62 @@
{ pkgs, neovim-flake, ... }: {
programs = {
zsh = {
enable = true;
};
};
home = {
stateVersion = "24.05";
packages = with pkgs; [
neovim-flake.packages.${system}.neovim
fzf
bat
git
yazi
tmux
eza
curl
wget
ripgrep
fd
jq
starship
fastfetch
clang
clang-tools
nixfmt-rfc-style
luajit
zoxide
rustup
zig
zls
nil
lldb
gopls
delve
golangci-lint
cmake
cmake-language-server
cmake-format
cmake-lint
python313Packages.debugpy
pyright
lua-language-server
gnumake
ninja
nodejs
];
file = {
".zshrc".source = ../zsh/.zshrc;
".config/nvim".source = ../nvim;
".config/yazi".source = ../yazi;
".config/starship.toml".source = ../starship/starship.toml;
".tmux.conf".source = ../tmux/.tmux.conf;
".config/tmux".source = ../tmux;
".config/bat".source = ../bat;
".config/ghostty".source = ../ghostty;
".config/confutils".source = ../confutils;
".config/wallpapers".source = ../wallpapers;
};
};
}

12
nix/local_home.nix Normal file
View file

@ -0,0 +1,12 @@
{ ... }:
{
# local_home.nix
# This is a template file that is committed to git with minimal changes.
# In order to use this and remain pure, each machine needs to create a local branch, i.e `machine-wsl` and set these variables
# accordingly, and then commit it.
home = {
# Stub values for demonstration. Override these in local branch.
username = "nixos";
homeDirectory = "/home/nixos";
};
}

8
nix/local_system.nix Normal file
View file

@ -0,0 +1,8 @@
{
...
}:
{
system = {
stateVersion = "24.11";
};
}

13
nix/pkgs/darwin.nix Normal file
View file

@ -0,0 +1,13 @@
{ pkgs, config, ... }:
{
home = {
packages = with pkgs; [
gawk
discord
];
file = {
".config/aerospace/aerospace.toml".source =
config.lib.file.mkOutOfStoreSymlink ../../aerospace/aerospace.toml;
};
};
}

131
nix/pkgs/home.nix Normal file
View file

@ -0,0 +1,131 @@
{
pkgs,
config,
lib,
neovim-flake,
...
}:
let
dotfiles = [
[
".zshrc"
"zsh/.zshrc"
]
[
".config/nvim"
"nvim"
]
[
".config/yazi"
"yazi"
]
[
".config/starship.toml"
"starship/starship.toml"
]
[
".tmux.conf"
"tmux/.tmux.conf"
]
[
".config/tmux"
"tmux"
]
[
".config/bat"
"bat"
]
[
".config/ghostty"
"ghostty"
]
[
".config/confutils"
"confutils"
]
[
".config/wallpapers"
"wallpapers"
]
];
codelldb = pkgs.runCommand "codelldb" { } ''
mkdir -p $out/bin
cp ${pkgs.vscode-extensions.vadimcn.vscode-lldb}/share/vscode/extensions/vadimcn.vscode-lldb/adapter/codelldb $out/bin/codelldb
chmod +x $out/bin/codelldb
'';
symlinkFiles = builtins.listToAttrs (
map (file: {
name = builtins.elemAt file 0;
value = {
source = config.lib.file.mkOutOfStoreSymlink "${config.home.homeDirectory}/dev/git/.dotfiles/${builtins.elemAt file 1}";
};
}) dotfiles
);
in
{
programs = {
zsh = {
enable = true;
};
};
home = {
stateVersion = "24.05";
packages = with pkgs; [
neovim-flake.packages.${system}.neovim
fzf
bat
git
yazi
tmux
eza
curl
wget
ripgrep
fd
jq
starship
fastfetch
nixfmt-rfc-style
luajit
zoxide
dart
go
rustup
zig
zls
nil
gopls
delve
golangci-lint
cmake
cmake-language-server
cmake-format
cmake-lint
python313Packages.debugpy
pyright
lua-language-server
gnumake
ninja
tldr
nerd-fonts.caskaydia-mono
clang
clang-tools
lldb
nodejs
tree-sitter
codelldb
bottom
python311
pcre
];
file = symlinkFiles;
activation.batCache = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
run ${pkgs.bat}/bin/bat cache --build
'';
};
}

12
nix/pkgs/linux.nix Normal file
View file

@ -0,0 +1,12 @@
{ pkgs, ... }:
{
home = {
packages = with pkgs; [
wl-clipboard-rs
sway
];
file = {
".config/sway".source = ../sway;
};
};
}

8
nix/pkgs/wsl.nix Normal file
View file

@ -0,0 +1,8 @@
{ pkgs, ... }:
{
home = {
packages = with pkgs; [
wslu
];
};
}

91
nix/system/darwin.nix Normal file
View file

@ -0,0 +1,91 @@
{
pkgs,
config,
self,
...
}:
{
environment.systemPackages = with pkgs; [
home-manager
mkalias
];
homebrew = {
enable = true;
casks = [
"ghostty"
"zen-browser"
"nikitabobko/tap/aerospace"
];
brews = [
"mas"
];
masApps = { };
onActivation.cleanup = "zap";
onActivation.autoUpdate = true;
onActivation.upgrade = true;
};
system = {
configurationRevision = self.rev or self.dirtyRev or null;
defaults = {
dock = {
autohide = true;
persistent-apps = [ ];
persistent-others = [ ];
show-recents = false;
static-only = true;
};
finder = {
_FXShowPosixPathInTitle = true;
_FXSortFoldersFirst = true;
AppleShowAllFiles = true;
AppleShowAllExtensions = true;
ShowPathbar = true;
ShowStatusBar = true;
FXPreferredViewStyle = "clmv";
};
loginwindow.GuestEnabled = false;
NSGlobalDomain = {
AppleICUForce24HourTime = true;
AppleInterfaceStyle = "Dark";
KeyRepeat = 2;
};
trackpad = {
Clicking = true;
TrackpadThreeFingerDrag = true;
};
controlcenter = {
BatteryShowPercentage = true;
};
hitoolbox.AppleFnUsageType = "Show Emoji & Symbols";
};
keyboard = {
enableKeyMapping = true;
nonUS.remapTilde = true;
remapCapsLockToEscape = true;
swapLeftCtrlAndFn = true;
};
activationScripts.applications.text =
let
env = pkgs.buildEnv {
name = "system-applications";
paths = config.environment.systemPackages;
pathsToLink = "/Applications";
};
in
pkgs.lib.mkForce ''
# Set up applications
echo "setting up /Applications..." >&2
rm -rf /Applications/Nix\ Apps
mkdir -p /Applications/Nix\ Apps
find ${env}/Applications -maxdepth 1 -type l -exec readlink '{}' + |
while read -r src; do
app_name=$(basename "$src")
echo "copying $src" >&2
${pkgs.mkalias}/bin/mkalias "$src" "/Applications/Nix Apps/$app_name"
done
'';
};
}

3
nix/system/linux.nix Normal file
View file

@ -0,0 +1,3 @@
{ ... }:
{
}

22
nix/system/wsl.nix Normal file
View file

@ -0,0 +1,22 @@
{ nixos-wsl, pkgs, ... }:
{
imports = [
nixos-wsl.nixosModules.default
];
wsl.enable = true;
environment.systemPackages = with pkgs; [
home-manager
];
programs = {
zsh = {
enable = true;
};
};
users.users.nixos = {
shell = pkgs.zsh;
};
}

View file

@ -1,5 +1,6 @@
{ {
"diagnostics.globals": [ "diagnostics.globals": [
"vim" "vim"
"Snacks"
] ]
} }

View file

@ -16,7 +16,7 @@ end
-- Load keymaps before loading any plugins -- Load keymaps before loading any plugins
require("keymaps") require("keymaps")
-- change and personalize native vim settings -- Change and personalize native vim settings
vim.opt = require("vim_opt") vim.opt = require("vim_opt")
-- Initialize Lazy package manager -- Initialize Lazy package manager
@ -40,9 +40,13 @@ require("dap/setup")
-- See ":help vim.highlight.on_yank()" -- See ":help vim.highlight.on_yank()"
setup_yank_highlight() setup_yank_highlight()
-- Change built in settings related to diagnostics
require("diagnostics")
--[[ --[[
-- Annoyances in Neovim environment: -- Annoyances in Neovim environment:
-- 1. codelldb doesn't terminate C++ program after debugging. : Don't know how to fix, have asked for help. -- 1. codelldb doesn't terminate C++ program after debugging. : Don't know how to fix, have asked for help.
-- 2. Sometimes very seldomly the cursor stops rendering, the only fix I found is to restsart Neovim. -- 2. Sometimes very seldomly the cursor stops rendering, the only fix I found is to restsart Neovim.
-- 3. Add PR to lspsaga so you can add keybindings for closing hover_doc, rename, finder, incoming_calls, and code actions using many configurable keybindings. I'm after "<Esc>" and "q". -- 3. Add PR to lspsaga so you can add keybindings for closing hover_doc, rename, finder, incoming_calls, and code actions using many configurable keybindings. I'm after "<Esc>" and "q".
-- 4. Remove usage of dap-go, dap-python, and rustaceanvim. These are really just providing DAP/LSP configs which I prefer to have without plugin bloat. However, they require more to setup than your average conf.
--]] --]]

38
nvim/lazy-lock.json Normal file
View file

@ -0,0 +1,38 @@
{
"arrow.nvim": { "branch": "master", "commit": "5438c977e729a29d96bd54c8da3103154e80dbd1" },
"auto-session": { "branch": "main", "commit": "9c3f977aafb56bd73ba0d082c4dcbdba5666faf3" },
"blink.cmp": { "branch": "main", "commit": "18b352d12b35bca148427b607098df14b75a218f" },
"codecompanion.nvim": { "branch": "main", "commit": "dd81bd9176daba9ea507cd0457f662c0a15c001f" },
"codesnap.nvim": { "branch": "main", "commit": "6400480aa6cc366cbd931146c429aaa64680dab9" },
"copilot.vim": { "branch": "release", "commit": "cd7f01009fb7b30e22840cadc4faad88b05c6eef" },
"diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" },
"gitsigns.nvim": { "branch": "main", "commit": "4c40357994f386e72be92a46f41fc1664c84c87d" },
"incline.nvim": { "branch": "main", "commit": "0eb5b7f6fc6636a4e7b2eb2800b7650fd6d164a2" },
"lazy.nvim": { "branch": "main", "commit": "e5e9bf48211a13d9ee6c1077c88327c49c1ab4a0" },
"leap.nvim": { "branch": "main", "commit": "8b826a9fc766bffd14288aee01847cb0d6c6c383" },
"lspsaga.nvim": { "branch": "main", "commit": "4acafaf3455c57c94400e961636d979fb6ddd9fc" },
"lualine.nvim": { "branch": "master", "commit": "f4f791f67e70d378a754d02da068231d2352e5bc" },
"markview.nvim": { "branch": "main", "commit": "f1e2a57388b61fff8e9d7519ce05cee27a59a57e" },
"neogit": { "branch": "master", "commit": "63124cf520ff24d09deb3b850e053908ab0fc66a" },
"neovim-ayu": { "branch": "master", "commit": "283badaa983234c90e857c12c1f1c18e1544360a" },
"noice.nvim": { "branch": "main", "commit": "0427460c2d7f673ad60eb02b35f5e9926cf67c59" },
"nui.nvim": { "branch": "main", "commit": "53e907ffe5eedebdca1cd503b00aa8692068ca46" },
"nvim-colorizer.lua": { "branch": "master", "commit": "a065833f35a3a7cc3ef137ac88b5381da2ba302e" },
"nvim-dap": { "branch": "master", "commit": "6e0e8ab4d8ed520076971465a4388dfe54a91d83" },
"nvim-dap-go": { "branch": "main", "commit": "8763ced35b19c8dc526e04a70ab07c34e11ad064" },
"nvim-dap-python": { "branch": "master", "commit": "34282820bb713b9a5fdb120ae8dd85c2b3f49b51" },
"nvim-dap-repl-highlights": { "branch": "master", "commit": "a7512fc0a0de0c0be8d58983939856dda6f72451" },
"nvim-dap-ui": { "branch": "master", "commit": "bc81f8d3440aede116f821114547a476b082b319" },
"nvim-dap-virtual-text": { "branch": "master", "commit": "df66808cd78b5a97576bbaeee95ed5ca385a9750" },
"nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" },
"nvim-surround": { "branch": "main", "commit": "ae298105122c87bbe0a36b1ad20b06d417c0433e" },
"nvim-treesitter": { "branch": "master", "commit": "5774e7d3da4f681296a87fcd85d17779ad362a4f" },
"nvim-treesitter-context": { "branch": "master", "commit": "198720b4016af04c9590f375d714d5bf8afecc1a" },
"nvim-treesitter-textobjects": { "branch": "master", "commit": "ad8f0a472148c3e0ae9851e26a722ee4e29b1595" },
"nvim-web-devicons": { "branch": "master", "commit": "1020869742ecb191f260818234517f4a1515cfe8" },
"persistent-breakpoints.nvim": { "branch": "main", "commit": "4b199b1dcfd136cac8b0fa9c8dbbdeb81463f7a9" },
"plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" },
"rustaceanvim": { "branch": "master", "commit": "f03035fa03ccb36cd26d0792c946fbacba1d1a39" },
"snacks.nvim": { "branch": "main", "commit": "b100c937177536cf2aa634ddd2aa5b8a1dd23ace" },
"vim-repeat": { "branch": "master", "commit": "65846025c15494983dafe5e3b46c8f88ab2e9635" }
}

View file

@ -2,7 +2,7 @@ return {
type = "server", type = "server",
port = "${port}", port = "${port}",
executable = { executable = {
command = vim.fn.exepath("codelldb"), -- Update with your codelldb binary path command = vim.fn.exepath("codelldb"),
args = { "--port", "${port}" }, args = { "--port", "${port}" },
}, },
} }

View file

@ -1,32 +1,34 @@
local utils = require("utils") local utils = require("utils")
local dap = require("dap") local dap = require("dap")
--[[
.vscode/launch.json:
----------------------------
{
"version": "0.2.0",
"configurations": [
{
"type": "name_of_adapter",
"request": "launch/attach",
"name": "Friendly name",
"program": "${workspaceFolder}/path/to/executable",
"cwd": "${workspaceFolder}",
"args": [],
"stopOnEntry": false,
"environment": []
}
]
}
----------------------------
]]
local dir_path = "dap/adapters" local dir_path = "dap/adapters"
utils.foreach(utils.get_file_names_in_dir(dir_path, "*.lua", true), function(adapter) utils.foreach(utils.get_file_names_in_dir(dir_path, "*.lua", true), function(adapter)
dap.adapters[adapter] = require(dir_path .. "/" .. adapter) dap.adapters[adapter] = require(dir_path .. "/" .. adapter)
end) end)
vim.api.nvim_create_user_command("LaunchTemplate", function()
local template = {
'{',
' "version": "0.2.0",',
' "configurations": [',
' {',
' "type": "codelldb",',
' "request": "launch",',
' "name": "Launch",',
' "program": "${workspaceFolder}/build/binary",',
' "cwd": "${workspaceFolder}",',
' "args": [],',
' "stopOnEntry": false,',
' "environment": []',
' }',
' ]',
'}',
}
local bufnr = vim.api.nvim_get_current_buf()
vim.api.nvim_buf_set_lines(bufnr, 0, -1, false, template)
end, {})
-- Do not define default fallbacks until I have a better way of handling a default selected configuration. -- Do not define default fallbacks until I have a better way of handling a default selected configuration.
-- I never want to be prompted for a configuration, we should have ae serialized active config which is always run unless changed. -- I never want to be prompted for a configuration, we should have ae serialized active config which is always run unless changed.
-- -- Define configurations -- -- Define configurations

49
nvim/lua/diagnostics.lua Normal file
View file

@ -0,0 +1,49 @@
local theme_colors = require("ayu.colors")
theme_colors.generate(true)
-- These are not apart of the Ayu color theme, however, I needed these
-- colors while still fitting in with the rest
local ayu_turquoise = "#5CCFE6"
local ayu_dark_blue = "#3A7BD5"
local colors = {
info = ayu_dark_blue,
hint = ayu_turquoise,
warning = theme_colors.warning,
error = theme_colors.error,
}
for _, highlight in ipairs({
{ "DiagnosticUnderlineInfo", { undercurl = true, sp = colors.info } },
{ "DiagnosticUnderlineHint", { undercurl = true, sp = colors.hint } },
{ "DiagnosticUnderlineWarn", { undercurl = true, sp = colors.warning } },
{ "DiagnosticUnderlineError", { undercurl = true, sp = colors.error } },
{ "DiagnosticInfo", { fg = colors.info } },
{ "DiagnosticHint", { fg = colors.hint } },
{ "DiagnosticWarn", { fg = colors.warning } },
{ "DiagnosticError", { fg = colors.error } },
}) do
vim.api.nvim_set_hl(0, highlight[1], highlight[2])
end
local sev = vim.diagnostic.severity
vim.diagnostic.config({
underline = true,
virtual_text = {
prefix = "",
},
update_in_insert = true,
signs = {
text = {
[sev.ERROR] = "",
[sev.WARN] = "",
[sev.INFO] = "",
[sev.HINT] = "",
},
numhl = {
[sev.WARN] = "WarningMsg",
[sev.ERROR] = "ErrorMsg",
[sev.INFO] = "DiagnosticInfo",
[sev.HINT] = "DiagnosticHint",
},
},
})

View file

@ -26,18 +26,10 @@ function M.setup()
vim.api.nvim_command("command! " .. cmd[1] .. " " .. cmd[2]) vim.api.nvim_command("command! " .. cmd[1] .. " " .. cmd[2])
end end
utils.add_keymaps({ utils.set_keymap_list({
n = { { "<leader>ff", function() M.format() end },
["<leader>ff"] = { { "<leader>fe", function() M.format_enable() end },
cmd = function() M.format(true) end { "<leader>fd", function() M.format_disable() end },
},
["<leader>fe"] = {
cmd = M.format_enable,
},
["<leader>fd"] = {
cmd = M.format_disable,
},
},
}) })
end end

98
nvim/lua/keymaps.lua Normal file
View file

@ -0,0 +1,98 @@
local utils = require("utils")
local g = vim.g
g.mapleader = " "
g.maplocalleader = " "
local move_up = { "v:count || mode(1)[0:1] == \"no\" ? \"k\" : \"gk\"", { expr = true } }
local move_down = { "v:count || mode(1)[0:1] == \"no\" ? \"j\" : \"gj\"", { expr = true } }
utils.foreach({
{
"n",
{
-- Using lspsaga for hover doc
{ "K", "<Nop>", },
-- Using lspsaga finder with gr which does references
{ "grr", "<Nop>", },
{ "gra", "<Nop>", },
{ "grn", "<Nop>", },
{ "gri", "<Nop>", },
-- Navigation
{ "<C-Left>", "<C-w>h", },
{ "<C-Down>", "<C-w>j", },
{ "<C-Up>", "<C-w>k", },
{ "<C-Right>", "<C-w>l", },
{ "<C-h>", "<C-w>h", },
{ "<C-j>", "<C-w>j", },
{ "<C-k>", "<C-w>k", },
{ "<C-l>", "<C-w>l", },
-- Window
{ "<C-q>", "<C-w>q", },
-- Disable current highlights
{ "<Esc>", "<cmd> noh <CR>", },
-- Copies the entire file
{ "<C-c>", ":%y+<CR>", { silent = true } },
-- Allow moving the cursor through wrapped lines with <Up> and <Down>
-- http://www.reddit.com/r/vim/comments/2k4cbr/problem_with_gj_and_gk/
-- empty mode is same as using <cmd> :map
-- also don't use g[j|k] when in operator pending mode,
-- so it doesn't alter d, y or c behaviour
{ "<Up>", move_up[1], move_up[2], },
{ "<Down>", move_down[1], move_down[2], },
{ "j", move_down[1], move_down[2], },
{ "k", move_up[1], move_up[2], },
-- Maps to remove
{ "<C-z>", "<Nop>", },
-- Marks are less frequently used than leaping, also, less relevant with arrow and fzf navigation.
-- Prioritize regular m for leaping, and <leader>m for setting marks.
{ "<leader>m", "m", },
{ "[d", function()
vim.diagnostic.jump({ count = -1, float = false })
end },
{ "]d", function()
vim.diagnostic.jump({ count = 1, float = false })
end },
}
},
{
"v",
{
{ "<Up>", move_up[1], move_up[2], },
{ "<Down>", move_down[1], move_down[2], },
{ "j", move_down[1], move_down[2], },
{ "k", move_up[1], move_up[2], },
{ "<tab>", ">gv", },
{ "<S-tab>", "<gv", },
-- Marks are less frequently used than leaping, also, less relevant with arrow and fzf navigation.
-- Prioritize regular m for leaping, and <leader>m for setting marks.
{ "<leader>m", "m", },
},
},
{
"x",
{
{ "<Up>", move_up[1], move_up[2], },
{ "<Down>", move_down[1], move_down[2], },
{ "j", move_down[1], move_down[2], },
{ "k", move_up[1], move_up[2], },
{ "p", "p:let @+=@0<CR>:let @\"=@0<CR>", { silent = true }, },
}
},
{
"t",
{
{ "<C-q>", "<C-\\><C-N>", },
}
},
}, function(mode_mapping)
local mode = mode_mapping[1]
local mappings = mode_mapping[2]
utils.set_keymap_list(mappings, mode)
end)

View file

@ -0,0 +1,33 @@
local M = {}
local function leap_across_windows()
require("leap").leap({
target_windows = require("leap.user").get_focusable_windows()
})
end
local function leap_in_current_buffer()
require("leap").leap({
target_windows = { vim.api.nvim_get_current_win() }
})
end
local function normal_mode_leap()
if _G["snacks_zen_mode"] then
leap_in_current_buffer()
else
leap_across_windows()
end
end
function M.set_leap_keymapping()
require("utils").foreach({
{ "n", "m", normal_mode_leap },
{ "v", "m", leap_in_current_buffer },
{ "o", "m", leap_in_current_buffer }
}, function(mapping)
vim.keymap.set(mapping[1], mapping[2], mapping[3])
end)
end
return M

View file

@ -1,21 +1,23 @@
local utils = require("utils") local utils = require("utils")
-- https://clangd.llvm.org/extensions.html#switch-between-sourceheader -- https://clangd.llvm.org/extensions.html#switch-between-sourceheader
local function switch_source_header(bufnr) local function switch_source_header()
bufnr = utils.validate_bufnr(bufnr) local bufnr = utils.validate_bufnr(0)
local clangd_client = vim.lsp.get_clients({ bufnr = bufnr, name = "clangd" })[1] local clangd_client = vim.lsp.get_clients({ bufnr = bufnr, name = "clangd" })[1]
local params = { uri = vim.uri_from_bufnr(bufnr) }
if clangd_client then if clangd_client then
clangd_client.request("textDocument/switchSourceHeader", params, function(err, result) clangd_client.request(
if err then "textDocument/switchSourceHeader",
error(tostring(err)) { uri = vim.uri_from_bufnr(bufnr) },
end function(err, result)
if not result then if err then
print "Corresponding file cannot be determined" error(tostring(err))
return end
end if not result then
vim.api.nvim_command("drop " .. vim.uri_to_fname(result)) print "Corresponding file cannot be determined"
end, bufnr) return
end
vim.api.nvim_command("drop " .. vim.uri_to_fname(result))
end, bufnr)
else else
print "method textDocument/switchSourceHeader is not supported by any servers active on the current buffer" print "method textDocument/switchSourceHeader is not supported by any servers active on the current buffer"
end end
@ -44,19 +46,9 @@ return {
"compile_flags.txt", "compile_flags.txt",
"configure.ac", "configure.ac",
}, },
on_attach = function(_, bufnr) on_attach = function()
local lsp_maps = { utils.set_keymap_list({
{ { "<leader>ko", switch_source_header, },
"<leader>ko", })
function() switch_source_header(0) end,
},
}
local keymaps = { n = {} }
for i, _ in ipairs(lsp_maps) do
local binding, cmd = unpack(lsp_maps[i])
keymaps.n[binding] = { cmd = cmd, opts = { buffer = bufnr } }
end
utils.add_keymaps(keymaps)
end, end,
} }

View file

@ -0,0 +1,18 @@
return {
cmd = { "dart", "language-server", "--protocol=lsp" },
filetypes = { "dart" },
root_markers = { "pubspec.yaml" },
init_options = {
onlyAnalyzeProjectsWithOpenFiles = true,
suggestFromUnimportedLibraries = true,
closingLabels = true,
outline = true,
flutterOutline = true,
},
settings = {
dart = {
completeFunctionCalls = true,
showTodos = true,
},
},
}

View file

@ -5,11 +5,6 @@ return {
filetypes = { "go", "gomod", "gowork", "gotmpl" }, filetypes = { "go", "gomod", "gowork", "gotmpl" },
settings = { settings = {
gopls = { gopls = {
["ui.inlayhints.hints"] = {
compositeLiteralFields = true,
constantValues = true,
parameterNames = true,
},
analyses = { analyses = {
unusedparams = true, unusedparams = true,
}, },

View file

@ -11,6 +11,12 @@ return {
"selene.yml", "selene.yml",
".git" ".git"
}, },
settings = {
Lua = {
maxPreload = 100000,
preloadFileSize = 10000,
},
},
on_init = function(client) on_init = function(client)
local path = vim.tbl_get(client, "workspace_folders", 1, "name") local path = vim.tbl_get(client, "workspace_folders", 1, "name")
if not path then if not path then
@ -23,6 +29,9 @@ return {
runtime = { runtime = {
version = "LuaJIT" version = "LuaJIT"
}, },
diagnostics = {
globals = { "vim", "Snacks" },
},
-- Make the server aware of Neovim runtime files -- Make the server aware of Neovim runtime files
workspace = { workspace = {
checkThirdParty = false, checkThirdParty = false,

View file

@ -0,0 +1,20 @@
return {
cmd = { "nil" },
filetypes = { "nix" },
root_markers = {
"flake.nix",
".git"
},
settings = {
["nil"] = {
formatting = {
command = { "nixfmt" },
},
},
},
on_attach = function(_, bufnr)
vim.bo[bufnr].tabstop = 2
vim.bo[bufnr].shiftwidth = 2
vim.bo[bufnr].softtabstop = 2
end
}

View file

@ -0,0 +1,10 @@
return {
cmd = { "zls" },
on_new_config = function(new_config, new_root_dir)
if vim.fn.filereadable(vim.fs.joinpath(new_root_dir, "zls.json")) ~= 0 then
new_config.cmd = { "zls", "--config-path", "zls.json" }
end
end,
filetypes = { "zig", "zir" },
root_markers = {"zls.json", "build.zig", ".git"},
}

View file

@ -24,42 +24,15 @@ local function global_on_attach(client, bufnr)
}) })
end end
utils.add_keymaps({ utils.set_keymap_list({
n = { { "gd", function() vim.lsp.buf.definition({ reuse_win = true, }) end, { noremap = true, buffer = bufnr } },
["gd"] = { { "gD", function() vim.lsp.buf.declaration({ reuse_win = true, }) end, { noremap = true, buffer = bufnr } },
cmd = function()
vim.lsp.buf.definition()
end,
opts = {
noremap = true,
silent = true,
buffer = bufnr
}
},
["gD"] = {
cmd = function()
vim.lsp.buf.declaration()
end,
opts = {
noremap = true,
silent = true,
buffer = bufnr
}
},
}
}) })
end end
local global_capabilities = require("blink.cmp").get_lsp_capabilities() local global_capabilities = require("blink.cmp").get_lsp_capabilities()
global_capabilities.offsetEncoding = { "utf-16" } global_capabilities.offsetEncoding = { "utf-16" }
vim.diagnostic.config({
underline = true, -- Underline diagnostic errors
virtual_text = false, -- Disable inline text messages
signs = true, -- Show icons in the sign column
update_in_insert = true, -- Update diagnostics during insert mode
})
vim.lsp.config("*", { vim.lsp.config("*", {
capabilities = global_capabilities, capabilities = global_capabilities,
handlers = { handlers = {

View file

@ -26,11 +26,9 @@ end
return { return {
"Shatur/neovim-ayu", "Shatur/neovim-ayu",
config = function() config = function()
local is_mirage = true
local ayu = require("ayu") local ayu = require("ayu")
local colors = require("ayu.colors") local colors = require("ayu.colors")
colors.generate(is_mirage) colors.generate(true)
local overrides = { local overrides = {
global_variable = { global_variable = {
@ -56,8 +54,8 @@ return {
} }
ayu.setup({ ayu.setup({
mirage = is_mirage, -- Set to `true` to use `mirage` variant instead of `dark` for dark background. mirage = true,
terminal = false, -- Set to `false` to let terminal manage its own colors. terminal = false,
overrides = { overrides = {
-- TRANSPARENCY -- TRANSPARENCY
Normal = { bg = "none" }, Normal = { bg = "none" },

View file

@ -6,11 +6,6 @@ return {
---@type blink.cmp.Config ---@type blink.cmp.Config
opts = { opts = {
keymap = { preset = "super-tab" }, keymap = { preset = "super-tab" },
-- highlight = {
-- use_nvim_cmp_as_default = true,
-- },
-- nerd_font_variant = "mono",
}, },
-- allows extending the enabled_providers array elsewhere in your config -- allows extending the enabled_providers array elsewhere in your config
-- without having to redefining it -- without having to redefining it

View file

@ -0,0 +1,39 @@
return {
"olimorris/codecompanion.nvim",
dependencies = {
"nvim-lua/plenary.nvim",
"nvim-treesitter/nvim-treesitter",
},
opts = {
strategies = {
chat = {
adapter = "copilot",
},
inline = {
adapter = "copilot",
},
agent = {
adapter = "copilot",
},
},
adapters = {
copilot = function() return require("codecompanion.adapters").extend("copilot", {}) end,
},
display = {
diff = {
provider = "mini_diff",
},
},
opts = {
log_level = "DEBUG",
},
},
keys = {
{ "<Leader>ci", "<cmd>CodeCompanion<cr>" },
{ "<Leader>cc", "<cmd>CodeCompanionChat toggle<cr>" },
{ "<Leader>ce", "<cmd>CodeCompanion /explain<cr>", mode = "v" },
},
init = function()
vim.cmd([[cab cc CodeCompanion]])
end
}

View file

@ -0,0 +1,18 @@
return {
"mistricky/codesnap.nvim",
build = "make",
event = "VeryLazy",
lazy = true,
opts = {
mac_window_bar = true,
title = "codesnap.nvim",
code_font_family = "JetBrainsMono Nerd Font",
breadcrumbs_separator = "/",
has_breadcrumbs = true,
bg_theme = "grape",
watermark = "",
},
keys = {
{ "<leader>cs", ":CodeSnap<CR>", mode = "v", silent = true, noremap = true },
},
}

View file

@ -0,0 +1,18 @@
return {
"github/copilot.vim",
event = "InsertEnter",
init = function()
vim.g.copilot_no_tab_map = true
end,
keys = {
{
"<Right>",
'copilot#Accept("\\<Right>")',
mode = "i",
expr = true,
replace_keycodes = false,
silent = true,
desc = "Copilot Accept with <Right>",
},
},
}

View file

@ -0,0 +1,86 @@
return {
"b0o/incline.nvim",
dependencies = {
{
"lewis6991/gitsigns.nvim",
opts = {},
keys = {
{ "[g", function() require("gitsigns").nav_hunk("prev") end, },
{ "]g", function() require("gitsigns").nav_hunk("next") end, },
}
}
},
event = "VeryLazy",
lazy = true,
opts = {
window = {
padding = 0,
},
hide = {
cursorline = true,
},
render = function(props)
local filename = vim.fn.fnamemodify(vim.api.nvim_buf_get_name(props.buf), ":t")
if filename == "" then
filename = "[No Name]"
end
local ft_icon, ft_color = require("nvim-web-devicons").get_icon_color(filename)
local function get_git_diff()
local icons = { removed = "", changed = "", added = "" }
local signs = vim.b[props.buf].gitsigns_status_dict
local labels = {}
if signs == nil then
return labels
end
for name, icon in pairs(icons) do
if tonumber(signs[name]) and signs[name] > 0 then
table.insert(labels, { icon .. " " .. signs[name] .. " ", group = "Diff" .. name })
end
end
if #labels > 0 then
table.insert(labels, { "" })
end
return labels
end
local function get_diagnostic_label()
local icons = { error = "", warn = "", info = "", hint = "" }
local label = {}
for severity, icon in pairs(icons) do
local n = #vim.diagnostic.get(props.buf,
{ severity = vim.diagnostic.severity[string.upper(severity)] })
if n > 0 then
table.insert(label, { icon .. " " .. n .. " ", group = "DiagnosticSign" .. severity })
end
end
if #label > 0 then
table.insert(label, { "" })
end
return label
end
local function get_arrow_label()
local statusline = require("arrow.statusline")
if statusline.is_on_arrow_file(props.buf) == nil then
return ""
end
return " " .. statusline.text_for_statusline_with_icons(props.buf)
end
return {
guibg = "#1e2030",
guifg = "#cad3f5",
{ " " },
{ get_diagnostic_label() },
{ get_git_diff() },
{ (ft_icon or "") .. " ", guifg = ft_color, guibg = "none" },
{ filename .. "", gui = vim.bo[props.buf].modified and "bold,italic" or "bold" },
{ get_arrow_label() .. "" .. vim.api.nvim_win_get_number(props.win), group = "DevIconWindows" },
{ " " }
}
end,
},
}

View file

@ -19,7 +19,8 @@ return {
}, },
event = "VeryLazy", event = "VeryLazy",
lazy = true, lazy = true,
config = function() opts = {},
init = function()
local leap = require("leap") local leap = require("leap")
-- Disable auto jumping to the first match -- Disable auto jumping to the first match
@ -54,41 +55,6 @@ return {
utils.create_user_event_cb(cmd.event_name, cmd.cb, leap_augroup_name) utils.create_user_event_cb(cmd.event_name, cmd.cb, leap_augroup_name)
end end
local leap_user = require("leap.user") require("leap_keymap_handler").set_leap_keymapping()
local function leap_across_windows()
leap.leap({
target_windows = leap_user.get_focusable_windows()
})
end
local function leap_in_current_buffer()
leap.leap({
target_windows = { vim.api.nvim_get_current_win() }
})
end
utils.add_keymaps({
n = {
["m"] = {
cmd = function()
leap_across_windows()
end,
},
},
v = {
["m"] = {
cmd = function()
leap_in_current_buffer()
end,
}
},
o = {
["m"] = {
cmd = function()
leap_in_current_buffer()
end,
}
}
})
end, end,
} }

View file

@ -0,0 +1,42 @@
return {
-- "nvimdev/lspsaga.nvim",
"LarssonMartin1998/lspsaga.nvim", -- Use my own fork until PR's are merged
event = "LspAttach",
lazy = true,
-- dir = "~/dev/git/lspsaga.nvim",
dependencies = {
"nvim-tree/nvim-web-devicons",
},
opts = {
request_timeout = 750,
symbol_in_winbar = {
enable = false,
},
implement = {
enable = false,
},
outline = {
enable = false,
win_width = 52,
},
ui = {
border = "rounded",
title = false,
},
code_action = {
extend_gitsigns = true
},
hover = {
jump_on_first_press = true
},
},
keys = {
{ "K", ":Lspsaga hover_doc<CR>", silent = true, },
{ "<leader>rn", ":Lspsaga rename<CR>", silent = true, },
{ "gr", ":Lspsaga finder<CR>", silent = true, },
{ "<leader>lt", ":Lspsaga peek_type_definition<CR>", silent = true, },
{ "<leader>ld", ":Lspsaga peek_definition<CR>", silent = true, },
{ "<leader>ca", ":Lspsaga code_action<CR>", silent = true, },
{ "<leader>lc", ":Lspsaga incoming_calls<CR>", silent = true, },
},
}

View file

@ -0,0 +1,56 @@
local function resize_mode()
if require("window_management").is_in_resizing_mode() then
return "▲ Resizing ▼"
else
return ""
end
end
return {
"nvim-lualine/lualine.nvim",
dependencies = {
"nvim-tree/nvim-web-devicons"
},
event = "VeryLazy",
lazy = true,
opts = {
options = {
theme = "ayu",
section_separators = {
left = "",
right = "",
},
component_separators = {
left = "",
right = ""
},
icons_enabled = true,
},
sections = {
lualine_a = { "mode" },
lualine_b = {
"branch",
{
"diagnostics",
sources = { "nvim_lsp" },
sections = { "error", "warn", "info", "hint" },
update_in_insert = false,
},
resize_mode,
},
lualine_c = { "buffers" },
lualine_x = { "encoding", "fileformat", "filetype" },
lualine_y = { "progress" },
lualine_z = { "location" }
},
inactive_sections = {
lualine_a = {},
lualine_b = {},
lualine_c = {},
lualine_x = {},
lualine_y = {},
lualine_z = {}
},
tabline = {},
}
}

View file

@ -0,0 +1,4 @@
return {
"OXY2DEV/markview.nvim",
lazy = false
}

21
nvim/lua/plugs/neogit.lua Normal file
View file

@ -0,0 +1,21 @@
return {
"NeogitOrg/neogit",
dependencies = {
{
"sindrets/diffview.nvim",
opts = {
view = {
merge_tool = {
layout = "diff1_plain",
},
},
},
}
},
event = "VeryLazy",
lazy = true,
opts = {},
keys = {
{ "<leader>g", function() require("neogit").open({ kind = "vsplit" }) end }
},
}

View file

@ -4,23 +4,12 @@ return {
lazy = true, lazy = true,
dependencies = { dependencies = {
{ "MunifTanjim/nui.nvim", lazy = true }, { "MunifTanjim/nui.nvim", lazy = true },
{
"rcarriga/nvim-notify",
opts = {
background_colour = "#24273a",
fps = 1,
render = "compact",
stages = "static"
}
}
}, },
opts = { opts = {
lsp = { lsp = {
-- override markdown rendering so that **cmp** and other plugins use **Treesitter**
override = { override = {
["vim.lsp.util.convert_input_to_markdown_lines"] = true, ["vim.lsp.util.convert_input_to_markdown_lines"] = true,
["vim.lsp.util.stylize_markdown"] = true, ["vim.lsp.util.stylize_markdown"] = true,
-- ["cmp.entry.get_documentation"] = true, -- requires hrsh7th/nvim-cmp
}, },
}, },
presets = { presets = {

View file

@ -0,0 +1,96 @@
local utils = require("utils")
local inlay_hints_handler = require("inlay_hints_handler")
local is_debug_mode_active = false
return {
"mfussenegger/nvim-dap",
dependencies = {
{ "igorlfs/nvim-dap-view", opts = {} },
-- Special adapters
{ "leoluz/nvim-dap-go", opts = {} },
{ "mfussenegger/nvim-dap-python", },
{ "nvim-neotest/nvim-nio", lazy = true },
{ "LiadOz/nvim-dap-repl-highlights", opts = {} },
{ "theHamsta/nvim-dap-virtual-text", opts = {} },
{ "Weissle/persistent-breakpoints.nvim", opts = { load_breakpoints_event = { "BufReadPost" } } },
},
config = function()
local dap = require("dap")
require("dap-python").setup("python3")
require("dap.ext.vscode").load_launchjs()
local virtual_text = require("nvim-dap-virtual-text/virtual_text")
local breakpoint_api = require("persistent-breakpoints.api")
local stepping_keymaps = {
{ "m", function() dap.step_out() end },
{ "n", function() dap.step_over() end },
{ "i", function() dap.step_into() end },
}
local dap_signs = {
{ "DapBreakpoint", { text = "🛑", texthl = "", linehl = "", numhl = "" } },
{ "DapBreakpointRejected", { text = "🔵", texthl = "", linehl = "", numhl = "" } },
{ "DapBreakpointCondition", { text = "🟥", texthl = "", linehl = "", numhl = "" } },
}
for _, sign in ipairs(dap_signs) do
vim.fn.sign_define(unpack(sign))
end
local function enter_debug_mode()
if is_debug_mode_active then
return
end
utils.set_keymap_list(stepping_keymaps)
is_debug_mode_active = true
inlay_hints_handler.disable()
require("dap-view").open()
end
local function exit_debug_mode()
if not is_debug_mode_active then
return
end
utils.del_keymap_list(stepping_keymaps)
is_debug_mode_active = false
require("leap_keymap_handler").set_leap_keymapping()
inlay_hints_handler.restore()
virtual_text.clear_virtual_text()
require("dap-view").close()
end
for _, request in ipairs({
{ "attach", enter_debug_mode },
{ "launch", enter_debug_mode },
}) do
dap.listeners.before[request[1]]["dapview"] = request[2]
end
for _, event in ipairs({
{ "event_terminated", exit_debug_mode },
{ "event_exited", exit_debug_mode },
}) do
dap.listeners.after[event[1]]["dapview"] = event[2]
end
local function dap_stop()
dap.terminate()
dap.close()
exit_debug_mode()
end
utils.set_keymap_list({
{ "<leader>dr", dap.continue },
{ "<leader>bt", breakpoint_api.toggle_breakpoint },
{ "<leader>bc", breakpoint_api.set_conditional_breakpoint },
{ "<leader>br", breakpoint_api.clear_all_breakpoints },
{ "<leader>ds", dap_stop },
})
end,
}

View file

@ -0,0 +1,5 @@
return {
"folke/persistence.nvim",
event = "BufReadPre", -- this will only start session saving when an actual file was opened
opts = {}
}

View file

@ -1,4 +1,5 @@
return { return {
"nvim-lua/plenary.nvim", "nvim-lua/plenary.nvim",
branch = "master",
lazy = true, lazy = true,
} }

View file

@ -30,29 +30,9 @@ return {
}) })
end end
utils.add_keymaps({ utils.set_keymap_list({
n = { { "gd", function() vim.lsp.buf.definition({ reuse_win = true, }) end, { noremap = true, buffer = bufnr } },
["gd"] = { { "gD", function() vim.lsp.buf.declaration({ reuse_win = true, }) end, { noremap = true, buffer = bufnr } },
cmd = function()
vim.lsp.buf.definition()
end,
opts = {
noremap = true,
silent = true,
buffer = bufnr,
}
},
["gD"] = {
cmd = function()
vim.lsp.buf.declaration()
end,
opts = {
noremap = true,
silent = true,
buffer = bufnr,
}
},
}
}) })
end, end,
} }

87
nvim/lua/plugs/snacks.lua Normal file
View file

@ -0,0 +1,87 @@
return {
"folke/snacks.nvim",
priority = 1000,
lazy = false,
opts = {
gitbrowse = {
enabled = true,
what = "repo",
},
picker = { enabled = true, },
dashboard = {
enabled = true,
preset = {
keys = {
{ icon = "", key = "f", desc = "Find File", action = ":lua Snacks.dashboard.pick('files')" },
{ icon = "", key = "n", desc = "New File", action = ":ene | startinsert" },
{ icon = "", key = "g", desc = "Find Text", action = ":lua Snacks.dashboard.pick('live_grep')" },
{ icon = "", key = "c", desc = "Config", action = ":lua Snacks.dashboard.pick('files', {cwd = vim.fn.stdpath('config')})" },
{ icon = "", key = "s", desc = "Restore Session", section = "session" },
{ icon = "󰒲 ", key = "L", desc = "Lazy", action = ":Lazy", enabled = package.loaded.lazy ~= nil },
{ icon = "", key = "q", desc = "Quit", action = ":qa" },
},
},
},
debug = { enabled = true, },
indent = {
enabled = true,
animate = {
enabled = false,
},
},
input = { enabled = true, },
notifier = { enabled = true, },
quickfile = { enabled = true, },
scroll = {
enabled = true,
animate = {
duration = { step = 7, total = 250 },
easing = "outCirc",
},
animate_repeat = {
delay = 100,
duration = { step = 3, total = 50 },
easing = "outCirc",
},
},
words = {
enabled = true,
debounce = 100,
},
zen = {
enabled = true,
toggles = { dim = false, },
on_open = function()
_G["snacks_zen_mode"] = true
end,
on_close = function()
_G["snacks_zen_mode"] = false
end,
},
},
keys = {
{ "gB", function() Snacks.gitbrowse() end, },
{ "<leader>z", function() Snacks.zen() end, },
{ "<leader>to", function() Snacks.picker.smart() end, },
{ "<leader>ta", function() Snacks.picker.grep() end, },
{ "<leader>tg", function() Snacks.picker.git_log_file() end, },
{ "<leader>ts", function() Snacks.picker.lsp_workspace_symbols() end, },
{ "<leader>tn", function() Snacks.picker.notifications() end },
},
init = function()
vim.api.nvim_create_autocmd("User", {
pattern = "VeryLazy",
callback = function()
_G.inspect = function(...)
Snacks.debug.inspect(...)
end
_G.backtrace = function()
Snacks.debug.backtrace()
end
vim.print = _G.inspect
end,
})
end
}

View file

@ -47,6 +47,8 @@ return {
"dap_repl", "dap_repl",
"muttrc", "muttrc",
"python", "python",
"latex",
"typst",
}, },
sync_install = false, sync_install = false,
-- This can be updated to a list of languages instead of defaulting to true -- This can be updated to a list of languages instead of defaulting to true

View file

@ -1,10 +1,8 @@
local utils = require("utils")
local wm = require("window_management")
local terminal_window = nil local terminal_window = nil
local terminal_bufnr = nil local terminal_bufnr = nil
local function open_terminal_window() local function open_terminal_window()
local utils = require("utils")
if terminal_bufnr and vim.api.nvim_buf_is_valid(terminal_bufnr) and utils.is_buf_buftype(terminal_bufnr, "terminal") then if terminal_bufnr and vim.api.nvim_buf_is_valid(terminal_bufnr) and utils.is_buf_buftype(terminal_bufnr, "terminal") then
vim.cmd("botright split") vim.cmd("botright split")
terminal_window = vim.api.nvim_get_current_win() terminal_window = vim.api.nvim_get_current_win()
@ -23,27 +21,22 @@ local function toggle_terminal()
return return
end end
local utils = require("utils")
open_terminal_window() open_terminal_window()
local term_height = vim.api.nvim_get_option("lines") local term_height = vim.api.nvim_get_option_value("lines", {})
local height_percentage = 0.225 local height_percentage = 0.225
local min_height = 15 local min_height = 15
local max_height = 25 local max_height = 25
local height = utils.calculate_split_size(term_height, height_percentage, min_height, max_height) local height = utils.calculate_split_size(term_height, height_percentage, min_height, max_height)
vim.api.nvim_win_set_height(terminal_window, height) vim.api.nvim_win_set_height(terminal_window, height)
vim.api.nvim_win_set_option(terminal_window, "winfixheight", true) vim.api.nvim_set_option_value("winfixheight", true, { win = terminal_window })
utils.lock_buf_to_window(terminal_window, terminal_bufnr, "terminal") utils.lock_buf_to_window(terminal_window, terminal_bufnr, "terminal")
vim.api.nvim_command("startinsert") vim.api.nvim_command("startinsert")
end end
utils.add_keymaps({ vim.keymap.set("n", "<leader>h", function()
n = { toggle_terminal()
["<leader>h"] = { require("window_management").autosize_windows()
cmd = function() end)
toggle_terminal()
wm.autosize_windows()
end,
}
}
})

124
nvim/lua/utils.lua Normal file
View file

@ -0,0 +1,124 @@
local M = {}
function M.set_keymap_list(keymap_list, mode)
mode = mode or "n"
M.foreach(keymap_list, function(mapping)
vim.keymap.set(mode, mapping[1], mapping[2], mapping[3] or {})
end)
end
function M.del_keymap_list(keymap_list, mode)
mode = mode or "n"
M.foreach(keymap_list, function(mapping)
vim.keymap.del(mode, mapping[1])
end)
end
function M.get_file_names_in_dir(dir, expr, strip_extension)
local path = vim.fn.stdpath("config") .. "/lua/" .. dir
local files_str = vim.fn.globpath(path, expr, true)
local has_line_breaks = vim.fn.match(files_str, [[\n]]) > -1
local files = has_line_breaks and vim.fn.split(files_str, "\n") or { files_str }
local should_strip_extension = strip_extension or false
if should_strip_extension then
return vim.tbl_map(function(file)
return vim.fn.fnamemodify(file, ":t:r")
end, files)
else
return files
end
end
function M.validate_bufnr(bufnr)
vim.validate('bufnr', bufnr, 'number')
return bufnr == 0 and vim.api.nvim_get_current_buf() or bufnr
end
function M.xpcallmsg(fn, err_msg, err_container)
return xpcall(fn, function(err)
if err_container then
table.insert(err_container, err_msg .. ": " .. err)
else
error(err_msg .. ": " .. err)
end
end)
end
function M.foreach(t, f)
for _, v in pairs(t) do
f(v)
end
end
function M.create_user_event_cb(event_name, function_callback, augroup)
assert(event_name and event_name ~= "", "Event name must be provided")
assert(function_callback and type(function_callback) == "function", "Callback must be a valid function")
local cmd = {
callback = function_callback,
pattern = event_name,
}
if augroup then
cmd.group = augroup
end
vim.api.nvim_create_autocmd("User", cmd)
end
function M.broadcast_event(event_name)
vim.api.nvim_command("doautocmd <nomodeline> User " .. event_name)
end
function M.add_opts_to_all_mappings(mappings, opts)
assert(opts and mappings)
for _, modes in pairs(mappings) do
for _, mapping in pairs(modes) do
local existing_opts = mapping.opts or {}
mapping.opts = vim.tbl_extend("force", existing_opts, opts)
end
end
end
function M.is_buf_filetype(bufnr, filetype)
return vim.api.nvim_get_option_value("filetype", { buf = bufnr }) == filetype
end
function M.is_buf_buftype(bufnr, buftype)
return vim.api.nvim_get_option_value("buftype", { buf = bufnr }) == buftype
end
function M.lock_buf_to_window(win_id, bufnr, filetype)
local augroup_id = vim.api.nvim_create_augroup("LockWindow" .. win_id, { clear = true })
vim.api.nvim_create_autocmd("BufEnter", {
group = augroup_id,
callback = function()
local current_win = vim.api.nvim_get_current_win()
if current_win ~= win_id then
return
end
local current_buf = vim.api.nvim_win_get_buf(win_id)
if current_buf == bufnr then
return
end
if M.is_buf_filetype(current_buf, filetype) then
bufnr = current_buf
return
end
vim.api.nvim_win_set_buf(win_id, bufnr)
end,
})
end
function M.calculate_split_size(term_size, percentage, min_size, max_size)
local calculated_size = math.floor(term_size * percentage)
return math.min(math.max(calculated_size, min_size), max_size)
end
return M

View file

@ -66,8 +66,9 @@ opt.termsync = true
opt.scrolloff = 4 opt.scrolloff = 4
-- Whitespaces -- Whitespaces
-- opt.listchars = { tab = "→\"", trail = "·", nbsp = "␣" }
-- opt.list = true
opt.list = false opt.list = false
-- Sessions
opt.sessionoptions = { "buffers", "curdir", "winsize", "winpos", "skiprtp" }
return opt return opt

View file

@ -26,7 +26,7 @@ local function window_has_valid_buffer(window)
return false return false
end end
local buf_type = vim.api.nvim_buf_get_option(buf, "buftype") local buf_type = vim.api.nvim_get_option_value("buftype", { buf = buf })
if buf_type ~= "" then if buf_type ~= "" then
return false return false
end end
@ -189,75 +189,35 @@ end
function M.setup() function M.setup()
local resizing_mode_keymaps = { local resizing_mode_keymaps = {
n = { { "<Left>", function() resize_window(vim.api.nvim_get_current_win(), "h") end },
["<Left>"] = { { "<Down>", function() resize_window(vim.api.nvim_get_current_win(), "j") end },
cmd = function() resize_window(vim.api.nvim_get_current_win(), "h") end { "<Up>", function() resize_window(vim.api.nvim_get_current_win(), "k") end },
}, { "<Right>", function() resize_window(vim.api.nvim_get_current_win(), "l") end },
["<Down>"] = { { "<Esc>", function() exit_resizing_mode() end },
cmd = function() resize_window(vim.api.nvim_get_current_win(), "j") end { "<Enter>", function() exit_resizing_mode() end },
}, { "=", function() M.autosize_windows() end },
["<Up>"] = {
cmd = function() resize_window(vim.api.nvim_get_current_win(), "k") end
},
["<Right>"] = {
cmd = function() resize_window(vim.api.nvim_get_current_win(), "l") end
},
["<Esc>"] = {
cmd = function() exit_resizing_mode() end
},
["<Enter>"] = {
cmd = function() exit_resizing_mode() end
},
["="] = {
cmd = function() M.autosize_windows() end
},
}
} }
local enter_resizing_mode_keymaps = { local enter_resizing_mode_keymaps = {
n = { { "<C- >", function() enter_resizing_mode() end }
["<C- >"] = {
cmd = function() enter_resizing_mode() end
}
},
} }
local window_shifting_keymaps = { local window_shifting_keymaps = {
n = { { "<C-S-Left>", function() swap_window("h") end },
["<C-S-Left>"] = { { "<C-S-Down>", function() swap_window("j") end },
cmd = function() { "<C-S-Up>", function() swap_window("k") end },
swap_window("h") { "<C-S-Right>", function() swap_window("l") end },
end
},
["<C-S-Down>"] = {
cmd = function()
swap_window("j")
end
},
["<C-S-Up>"] = {
cmd = function()
swap_window("k")
end
},
["<C-S-Right>"] = {
cmd = function()
swap_window("l")
end
},
},
} }
utils.add_keymaps({ utils.set_keymap_list(window_shifting_keymaps)
window_shifting_keymaps, utils.set_keymap_list(enter_resizing_mode_keymaps)
enter_resizing_mode_keymaps
})
local function on_resize_mode_enter() local function on_resize_mode_enter()
utils.remove_keymaps(enter_resizing_mode_keymaps) utils.del_keymap_list(enter_resizing_mode_keymaps)
utils.add_keymaps(resizing_mode_keymaps) utils.set_keymap_list(resizing_mode_keymaps)
end end
local function on_resize_mode_exit() local function on_resize_mode_exit()
utils.remove_keymaps(resizing_mode_keymaps) utils.del_keymap_list(resizing_mode_keymaps)
utils.add_keymaps(enter_resizing_mode_keymaps) utils.set_keymap_list(enter_resizing_mode_keymaps)
end end
local window_management_augroup = "WindowManagementEvents" local window_management_augroup = "WindowManagementEvents"

View file

@ -6,6 +6,10 @@ bind-key -n M-Left select-pane -L
bind-key -n M-Down select-pane -D bind-key -n M-Down select-pane -D
bind-key -n M-Up select-pane -U bind-key -n M-Up select-pane -U
bind-key -n M-Right select-pane -R bind-key -n M-Right select-pane -R
bind-key -n M-h select-pane -L
bind-key -n M-j select-pane -D
bind-key -n M-k select-pane -U
bind-key -n M-l select-pane -R
# Resize mode # Resize mode
set -g @tmux_resize_mode 0 set -g @tmux_resize_mode 0
@ -20,18 +24,22 @@ bind-key -n Up if -F "#{==:#{@tmux_resize_mode},1}" "resize-pane -U" "send-keys
bind-key -n Down if -F "#{==:#{@tmux_resize_mode},1}" "resize-pane -D" "send-keys Down" bind-key -n Down if -F "#{==:#{@tmux_resize_mode},1}" "resize-pane -D" "send-keys Down"
bind-key -n Left if -F "#{==:#{@tmux_resize_mode},1}" "resize-pane -L" "send-keys Left" bind-key -n Left if -F "#{==:#{@tmux_resize_mode},1}" "resize-pane -L" "send-keys Left"
bind-key -n Right if -F "#{==:#{@tmux_resize_mode},1}" "resize-pane -R" "send-keys Right" bind-key -n Right if -F "#{==:#{@tmux_resize_mode},1}" "resize-pane -R" "send-keys Right"
bind-key -n k if -F "#{==:#{@tmux_resize_mode},1}" "resize-pane -U" "send-keys k"
bind-key -n j if -F "#{==:#{@tmux_resize_mode},1}" "resize-pane -D" "send-keys j"
bind-key -n h if -F "#{==:#{@tmux_resize_mode},1}" "resize-pane -L" "send-keys h"
bind-key -n l if -F "#{==:#{@tmux_resize_mode},1}" "resize-pane -R" "send-keys l"
bind-key -n M-p display-message "#{@tmux_resize_mode}" bind-key -n M-p display-message "#{@tmux_resize_mode}"
bind-key -n M-d run-shell "~/.config/tmux/tmux-fuzzy-find-session.sh" bind-key -n M-d run-shell "~/.config/tmux/tmux-fuzzy-find-session.sh"
# Split window, change keybindings to match vim concept of splits # Split window, change keybindings to match vim concept of splits
bind-key -n M-v split-window -h bind-key -n M-V split-window -h -c "#{pane_current_path}"
bind-key -n M-h split-window -v bind-key -n M-H split-window -v -c "#{pane_current_path}"
bind-key -n M-q kill-pane bind-key -n M-q kill-pane
bind-key -n M-f resize-pane -Z bind-key -n M-f resize-pane -Z
bind-key -n M-s command-prompt -p "New session: " "run-shell '~/.config/tmux/tmux-create-session.sh '%%''" bind-key -n M-s command-prompt -p "New session: " "run-shell '~/.config/tmux/tmux-create-session.sh '%%''"
bind-key -n M-w new-window bind-key -n M-w new-window -c "#{pane_current_path}"
bind-key -n M-r command-prompt -p "Rename window:" "rename-window '%%'" bind-key -n M-r command-prompt -p "Rename window:" "rename-window '%%'"
bind-key -n M-R command-prompt -p "Rename session:" "rename-session '%%'" bind-key -n M-R command-prompt -p "Rename session:" "rename-session '%%'"
@ -118,7 +126,7 @@ setw -g window-status-format "#[bg=#171B24,fg=#CCCAC2] #[bold]#I #[default] #[fg
setw -g window-status-current-format "#[bg=#757B84,fg=#EFEDE7] #[bold]#I #[default] #[fg=#FFAD66]#W #[default]" setw -g window-status-current-format "#[bg=#757B84,fg=#EFEDE7] #[bold]#I #[default] #[fg=#FFAD66]#W #[default]"
# Set the right status: Battery, date and time, session name # Set the right status: Battery, date and time, session name
set -g status-right "#($HOME/.config/tmux/tmux-status-right.sh) | #S#[default]" set -g status-right "#($HOME/.config/tmux/tmux-status-right.sh)"
set -g status-bg "#171B24" set -g status-bg "#171B24"
set -g status-style bold set -g status-style bold

View file

@ -1,5 +1,3 @@
#!/bin/zsh
session_name=$1 session_name=$1
tmux new-session -d -s $session_name tmux new-session -d -s $session_name
tmux switch-client -t $session_name tmux switch-client -t $session_name

View file

@ -1,5 +1,3 @@
#!/bin/zsh
# Run fzf-tmux in the background and serialize the input # Run fzf-tmux in the background and serialize the input
( (
current_session=$(tmux display-message -p '#S') current_session=$(tmux display-message -p '#S')

View file

@ -1,5 +1,3 @@
#!/bin/zsh
source_pane=$(tmux display-message -p '#{pane_id}') source_pane=$(tmux display-message -p '#{pane_id}')
target_window=$1 target_window=$1

View file

@ -1,4 +1,3 @@
#!/bin/zsh
# program blacklist # program blacklist
# program=$( # program=$(
# ps -o comm= -t "$(tmux display-message -p '#{pane_tty}')" 2>/dev/null \ # ps -o comm= -t "$(tmux display-message -p '#{pane_tty}')" 2>/dev/null \

View file

@ -1,5 +1,3 @@
#!/bin/zsh
desired_state=$1 desired_state=$1
current_state=$(tmux show-environment -g @resize_mode 2>/dev/null | cut -d '=' -f 2) current_state=$(tmux show-environment -g @resize_mode 2>/dev/null | cut -d '=' -f 2)

Some files were not shown because too many files have changed in this diff Show more