From 386d856c6082706b9710d93bd75f28f5c771ab4f Mon Sep 17 00:00:00 2001 From: Martin Date: Fri, 17 May 2024 16:03:50 +0200 Subject: [PATCH 01/10] Update flake --- nix/flake.lock | 33 +++++++++++++++++++++++++++------ nix/flake.nix | 38 +++++++++++++++++++++++++++++++++++++- 2 files changed, 64 insertions(+), 7 deletions(-) diff --git a/nix/flake.lock b/nix/flake.lock index a024de3..22c5c48 100644 --- a/nix/flake.lock +++ b/nix/flake.lock @@ -7,11 +7,11 @@ ] }, "locked": { - "lastModified": 1712212014, - "narHash": "sha256-s+lbaf3nLRn1++/X2eXwY9mYCA/m9l8AvyG8beeOaXE=", + "lastModified": 1715930644, + "narHash": "sha256-W9pyM3/vePxrffHtzlJI6lDS3seANQ+Nqp+i58O46LI=", "owner": "nix-community", "repo": "home-manager", - "rev": "7e91f2a0ba4b62b88591279d54f741a13e36245b", + "rev": "e3ad5108f54177e6520535768ddbf1e6af54b59d", "type": "github" }, "original": { @@ -20,13 +20,33 @@ "type": "github" } }, + "nix-darwin": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1715901937, + "narHash": "sha256-eMyvWP56ZOdraC2IOvZo0/RTDcrrsqJ0oJWDC76JTak=", + "owner": "LnL7", + "repo": "nix-darwin", + "rev": "ffc01182f90118119930bdfc528c1ee9a39ecef8", + "type": "github" + }, + "original": { + "owner": "LnL7", + "repo": "nix-darwin", + "type": "github" + } + }, "nixpkgs": { "locked": { - "lastModified": 1712163089, - "narHash": "sha256-Um+8kTIrC19vD4/lUCN9/cU9kcOsD1O1m+axJqQPyMM=", + "lastModified": 1715787315, + "narHash": "sha256-cYApT0NXJfqBkKcci7D9Kr4CBYZKOQKDYA23q8XNuWg=", "owner": "nixos", "repo": "nixpkgs", - "rev": "fd281bd6b7d3e32ddfa399853946f782553163b5", + "rev": "33d1e753c82ffc557b4a585c77de43d4c922ebb5", "type": "github" }, "original": { @@ -39,6 +59,7 @@ "root": { "inputs": { "home-manager": "home-manager", + "nix-darwin": "nix-darwin", "nixpkgs": "nixpkgs" } } diff --git a/nix/flake.nix b/nix/flake.nix index 4c8d414..6066d4c 100644 --- a/nix/flake.nix +++ b/nix/flake.nix @@ -3,17 +3,53 @@ inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + nix-darwin.url = "github:LnL7/nix-darwin"; + nix-darwin.inputs.nixpkgs.follows = "nixpkgs"; home-manager = { url = "github:nix-community/home-manager"; inputs.nixpkgs.follows = "nixpkgs"; }; }; - outputs = { nixpkgs, home-manager, ... }: + outputs = { self, nix-darwin, nixpkgs, home-manager, ... }: let system = "x86_64-darwin"; pkgs = nixpkgs.legacyPackages.${system}; + + configuration = { pkgs, ... }: { + environment.systemPackages = + [ + pkgs.vim + ]; + + # Auto upgrade nix package and the daemon service. + services.nix-daemon.enable = true; + # nix.package = pkgs.nix; + + nix.settings.experimental-features = "nix-command flakes"; + + programs.zsh.enable = true; # default shell on catalina + + # Set Git commit hash for darwin-version. + system.configurationRevision = self.rev or self.dirtyRev or null; + + # Used for backwards compatibility, please read the changelog before changing. + # $ darwin-rebuild changelog + system.stateVersion = 4; + + # The platform the configuration will be used on. + nixpkgs.hostPlatform = system; + }; in { + # Build darwin flake using: + # $ darwin-rebuild build --flake .#Martins-MacBook-Pro + darwinConfigurations."Martins-MacBook-Pro" = nix-darwin.lib.darwinSystem { + modules = [ configuration ]; + }; + + # Expose the package set, including overlays, for convenience. + darwinPackages = self.darwinConfigurations."Martins-MacBook-Pro".pkgs; + homeConfigurations = { "moustachioed" = home-manager.lib.homeManagerConfiguration { inherit pkgs; From 2a2279ee29949a689a3220a872a19c489b2065d1 Mon Sep 17 00:00:00 2001 From: Martin Date: Fri, 17 May 2024 16:30:29 +0200 Subject: [PATCH 02/10] Merge changes from work --- .gitignore | 1 + nix/common.nix | 4 ++++ nix/flake.nix | 2 +- nix/user/git.nix | 5 +++++ nix/user/profiles/work.nix | 15 +++++++++++++-- nix/user/sh.nix | 16 +++++++++++++++- nix/user/task.nix | 36 +++++++++++++++++++++++++++++++----- nix/user/tmux.nix | 9 +++++++-- nvim/base.lua | 17 ++++++++++++----- nvim/plugins.lua | 1 - 10 files changed, 89 insertions(+), 17 deletions(-) diff --git a/.gitignore b/.gitignore index e69de29..16873f6 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1 @@ +plugins/ diff --git a/nix/common.nix b/nix/common.nix index c5a0206..1f0294f 100644 --- a/nix/common.nix +++ b/nix/common.nix @@ -51,6 +51,10 @@ #home.shellAliases = { # "ll" = "ls -la"; #}; + # home.shellAliases = { + # "t" = "tmuxp"; + # "tl" = "tmuxp load"; + # }; news.display = "silent"; diff --git a/nix/flake.nix b/nix/flake.nix index 6066d4c..2d4453e 100644 --- a/nix/flake.nix +++ b/nix/flake.nix @@ -60,7 +60,7 @@ ./user/task.nix ]; }; - "work" = home-manager.lib.homeManagerConfiguration { + "pan" = home-manager.lib.homeManagerConfiguration { inherit pkgs; modules = [ diff --git a/nix/user/git.nix b/nix/user/git.nix index 4fab21b..b40f724 100644 --- a/nix/user/git.nix +++ b/nix/user/git.nix @@ -24,5 +24,10 @@ push.default = "matching"; init.defaultBranch = "main"; }; + + ignores = [ + ".direnv/" + ".envrc" + ]; }; } diff --git a/nix/user/profiles/work.nix b/nix/user/profiles/work.nix index d340c3c..5a21078 100644 --- a/nix/user/profiles/work.nix +++ b/nix/user/profiles/work.nix @@ -1,8 +1,8 @@ { config, pkgs, ... }: { - home.username = "moustachioed"; - home.homeDirectory = "/Users/moustachioed"; + home.username = "pan"; + home.homeDirectory = "/home/pan"; home.stateVersion = "23.11"; # Please read the comment before changing. @@ -10,4 +10,15 @@ userName = "Martin Pander"; userEmail = "martin.pander@knowtion.de"; }; + + home.packages = with pkgs; [ + yaml-language-server + marksman + dockerfile-language-server-nodejs + ]; + + programs.zsh.profileExtra = '' + source $HOME/.profile + ''; + } diff --git a/nix/user/sh.nix b/nix/user/sh.nix index 9ca21b5..96f99f3 100644 --- a/nix/user/sh.nix +++ b/nix/user/sh.nix @@ -1,4 +1,4 @@ -{ config, pkgs, ... }: +{ config, pkgs, lib, ... }: { programs.zsh = { @@ -63,12 +63,26 @@ enableAliases = true; }; + programs.zoxide = { + enable = true; + enableZshIntegration = true; + options = [ + "--cmd cd" + ]; + }; + programs.bat.enable = true; programs.ripgrep.enable = true; home.packages = with pkgs; [ fd du-dust + glow #nerdfonts ]; + + home.sessionVariables = lib.mkMerge [ { + BAT_THEME = "Coldark-Cold"; + } + ]; } diff --git a/nix/user/task.nix b/nix/user/task.nix index 8b8b463..3df5d50 100644 --- a/nix/user/task.nix +++ b/nix/user/task.nix @@ -1,16 +1,42 @@ -{config, pkgs, ...}: +{config, pkgs, lib, ...}: { programs.taskwarrior = { enable = true; + colorTheme = "light-256"; + package = pkgs.taskwarrior3; + config = { + weekstart = "monday"; + + uda.priority.values = "H,M,,L"; + urgency.uda.priority.L.coefficient = -0.5; + urgency.user.tag.deferred.coefficient = -15.0; + urgency.user.tag.cust.coefficient = 5.0; + + context.today.read = "-deferred and (prio:H or +next)"; + context.today.write = "prio:H or +next"; + context.deferred.read = "+deferred"; + context.deferred.write = "+deferred"; + context.customer.read = "+cust"; + context.customer.write = "+cust"; + context.low_energy.read = "+low"; + context.low_energy.write = "+low"; + + uda.taskwarrior-tui.task-report.show-info = false; + uda.taskwarrior-tui.selection.reverse = "yes"; + }; }; home.packages = with pkgs; [ taskwarrior-tui + timewarrior ]; - home.shellAliases = { - t = "task"; - tt = "taskwarrior-tui"; - }; + home.shellAliases = lib.mkMerge [ { + t = "task"; + tt = "taskwarrior-tui"; + tw = "timew"; + tws = "timew summary :ids"; + } + ]; } diff --git a/nix/user/tmux.nix b/nix/user/tmux.nix index b61c458..4d416fd 100644 --- a/nix/user/tmux.nix +++ b/nix/user/tmux.nix @@ -1,4 +1,4 @@ -{ config, pkgs, ... }: +{ config, pkgs, lib, ... }: { programs.tmux = { @@ -9,7 +9,6 @@ escapeTime = 0; terminal = "screen-256color"; tmuxp.enable = true; - # newSession = true; extraConfig = '' set -g display-time 1500 @@ -58,4 +57,10 @@ set -g pane-border-style "bg=#eeeeee,fg=#999999" ''; }; + + home.shellAliases = lib.mkMerge [ { + "o" = "tmuxp"; + "ol" = "tmuxp load"; + } + ]; } diff --git a/nvim/base.lua b/nvim/base.lua index 676de54..fe83b24 100644 --- a/nvim/base.lua +++ b/nvim/base.lua @@ -39,8 +39,6 @@ vim.opt.scrolloff = 8 vim.opt.background = 'light' vim.opt.wrap = true vim.opt.showbreak = '..' --- vim.opt.clipboard = vim.opt.clipboard + 'unnamedplus' --- vim.opt.clipboard = 'unnamedplus' vim.opt.errorbells = false vim.opt.visualbell = false vim.opt.title = true @@ -49,10 +47,19 @@ vim.opt.syntax = 'on' vim.opt.encoding = 'utf-8' vim.opt.completeopt = 'menu,menuone,noselect' + ---------------------------- --------- COMMANDS -------- +-------- CLIPBOARD --------- ---------------------------- --- +if vim.fn.has("wsl") == 1 then + vim.opt.clipboard = vim.opt.clipboard + 'unnamedplus' +end + + +---------------------------- +-------- COMMANDS ---------- +---------------------------- + vim.cmd('filetype plugin indent on') -- vim.cmd('colorscheme lucius') @@ -60,7 +67,7 @@ vim.cmd('filetype plugin indent on') ---------------------------- --------- AUTOGROUPs -------- +-------- AUTOGROUPS -------- ---------------------------- vim.api.nvim_create_augroup('VimIntern', { clear = true }) diff --git a/nvim/plugins.lua b/nvim/plugins.lua index a9d433a..74cf673 100644 --- a/nvim/plugins.lua +++ b/nvim/plugins.lua @@ -41,7 +41,6 @@ cmp.setup({ { name = 'buffer', keyword_length = 2 }, }), - formatting = { formatting = { format = lspkind.cmp_format({ -- mode = "symbol_text", From 9dff153c8b5c83148cbdc4f30f4f91d3f0ad3d20 Mon Sep 17 00:00:00 2001 From: Martin Date: Fri, 17 May 2024 16:32:38 +0200 Subject: [PATCH 03/10] Split task between work and home --- nix/flake.nix | 2 +- nix/user/task_home.nix | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 nix/user/task_home.nix diff --git a/nix/flake.nix b/nix/flake.nix index 2d4453e..458033c 100644 --- a/nix/flake.nix +++ b/nix/flake.nix @@ -57,7 +57,7 @@ modules = [ ./user/profiles/moustachioedBook.nix ./common.nix - ./user/task.nix + ./user/task_home.nix ]; }; "pan" = home-manager.lib.homeManagerConfiguration { diff --git a/nix/user/task_home.nix b/nix/user/task_home.nix new file mode 100644 index 0000000..d0e47b3 --- /dev/null +++ b/nix/user/task_home.nix @@ -0,0 +1,37 @@ +{config, pkgs, lib, ...}: + +{ + programs.taskwarrior = { + enable = true; + colorTheme = "light-256"; + package = pkgs.taskwarrior3; + config = { + weekstart = "monday"; + + uda.priority.values = "H,M,,L"; + urgency.uda.priority.L.coefficient = -0.5; + urgency.user.tag.deferred.coefficient = -15.0; + urgency.user.tag.cust.coefficient = 5.0; + + context.today.read = "-deferred and (prio:H or +next)"; + context.today.write = "prio:H or +next"; + context.deferred.read = "+deferred"; + context.deferred.write = "+deferred"; + context.low_energy.read = "+low"; + context.low_energy.write = "+low"; + + uda.taskwarrior-tui.task-report.show-info = false; + uda.taskwarrior-tui.selection.reverse = "yes"; + }; + }; + + home.packages = with pkgs; [ + taskwarrior-tui + ]; + + home.shellAliases = lib.mkMerge [ { + t = "task"; + tt = "taskwarrior-tui"; + } + ]; +} From 14b1f87938b71e7a270588ab3a8681579d42913d Mon Sep 17 00:00:00 2001 From: Martin Date: Tue, 21 May 2024 19:37:49 +0200 Subject: [PATCH 04/10] Use system clipboard on all platforms --- nvim/base.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/nvim/base.lua b/nvim/base.lua index fe83b24..0fbe31c 100644 --- a/nvim/base.lua +++ b/nvim/base.lua @@ -51,9 +51,9 @@ vim.opt.completeopt = 'menu,menuone,noselect' ---------------------------- -------- CLIPBOARD --------- ---------------------------- -if vim.fn.has("wsl") == 1 then - vim.opt.clipboard = vim.opt.clipboard + 'unnamedplus' -end +-- if vim.fn.has("wsl") == 1 then +vim.opt.clipboard:append('unnamedplus') +-- end ---------------------------- From 4a1c390fd68d4126486824139d34ca8053195158 Mon Sep 17 00:00:00 2001 From: Martin Date: Wed, 12 Jun 2024 12:08:40 +0200 Subject: [PATCH 05/10] Add neovim cmp signature tooltips --- nix/user/nvim.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/nix/user/nvim.nix b/nix/user/nvim.nix index 004eab6..a65c307 100644 --- a/nix/user/nvim.nix +++ b/nix/user/nvim.nix @@ -29,6 +29,7 @@ cmp-path cmp-cmdline cmp-nvim-lsp + cmp-nvim-lsp-signature-help cmp_yanky cmp-git nvim-lspconfig From 8e8b47151f3b98816a46feba36d2c443e437d3a3 Mon Sep 17 00:00:00 2001 From: Martin Date: Sun, 22 Sep 2024 10:05:00 +0200 Subject: [PATCH 06/10] Add ripgrep-all --- nix/user/sh.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/nix/user/sh.nix b/nix/user/sh.nix index 96f99f3..116d7b4 100644 --- a/nix/user/sh.nix +++ b/nix/user/sh.nix @@ -78,6 +78,7 @@ fd du-dust glow + ripgrep-all #nerdfonts ]; From c373f5fcfdb05c9043217c732747705df8c44ae7 Mon Sep 17 00:00:00 2001 From: Martin Date: Tue, 25 Feb 2025 14:29:55 +0100 Subject: [PATCH 07/10] Update git; Update vim --- nix/flake.nix | 9 +++++++++ nix/user/git.nix | 35 ++++++++++++++++++++++++++++++++--- nix/user/nvim.nix | 5 ++++- nix/user/profiles/martin.nix | 13 +++++++++++++ nix/user/sh.nix | 1 + 5 files changed, 59 insertions(+), 4 deletions(-) create mode 100644 nix/user/profiles/martin.nix diff --git a/nix/flake.nix b/nix/flake.nix index 458033c..7d31391 100644 --- a/nix/flake.nix +++ b/nix/flake.nix @@ -60,6 +60,15 @@ ./user/task_home.nix ]; }; + "martin" = home-manager.lib.homeManagerConfiguration { + inherit pkgs; + + modules = [ + ./user/profiles/martin.nix + ./common.nix + ./user/task_home.nix + ]; + }; "pan" = home-manager.lib.homeManagerConfiguration { inherit pkgs; diff --git a/nix/user/git.nix b/nix/user/git.nix index b40f724..9479611 100644 --- a/nix/user/git.nix +++ b/nix/user/git.nix @@ -18,10 +18,39 @@ difftastic.enable = true; extraConfig = { - core = { - editor = "nvim"; + column.ui = "auto"; + branch.sort = "-comitterdate"; + tag.sort = "version:refname"; + diff = { + algorithm = "histogram"; + colorMoved = "plain"; + mnemonicPrefix = "true"; + renames = "true"; }; - push.default = "matching"; + pull.rebase = "true"; + push = { + default = "simple"; + autoSetupRemote = "true"; + followTags = "true"; + }; + fetch = { + prune = "true"; + pruneTags = "true"; + all = "true"; + }; + help.autocorrect = "prompt"; + commit.verbose = "true"; + rerere = { + enabled = "true"; + autoupdate = "true"; + }; + rebase = { + autoSquas = "true"; + autoStash = "true"; + updateRefs = "true"; + }; + merge.conflictstyle = "zdiff3"; + core.editor = "nvim"; init.defaultBranch = "main"; }; diff --git a/nix/user/nvim.nix b/nix/user/nvim.nix index a65c307..1811ed6 100644 --- a/nix/user/nvim.nix +++ b/nix/user/nvim.nix @@ -8,12 +8,14 @@ vimAlias = true; plugins = with pkgs.vimPlugins; [ + aerial-nvim + zen-mode-nvim vim-commentary vim-repeat vim-surround targets-vim delimitMate - vim-startify + # vim-startify vim-windowswap vim-nix plenary-nvim @@ -52,6 +54,7 @@ home.packages = with pkgs; [ nodejs-slim + marksman ]; } diff --git a/nix/user/profiles/martin.nix b/nix/user/profiles/martin.nix new file mode 100644 index 0000000..4f9fc00 --- /dev/null +++ b/nix/user/profiles/martin.nix @@ -0,0 +1,13 @@ +{ config, pkgs, ... }: + +{ + home.username = "martin"; + home.homeDirectory = "/Users/martin"; + + home.stateVersion = "24.05"; # Please read the comment before changing. + + programs.git = { + userName = "Martin"; + userEmail = "git@pander-on.de"; + }; +} diff --git a/nix/user/sh.nix b/nix/user/sh.nix index 116d7b4..93226b7 100644 --- a/nix/user/sh.nix +++ b/nix/user/sh.nix @@ -79,6 +79,7 @@ du-dust glow ripgrep-all + llm #nerdfonts ]; From 360362fb9e5b177c8c89449ebb74a8c4181a7a25 Mon Sep 17 00:00:00 2001 From: Martin Date: Tue, 25 Feb 2025 14:31:04 +0100 Subject: [PATCH 08/10] Fix git --- nix/user/git.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nix/user/git.nix b/nix/user/git.nix index 9479611..394125a 100644 --- a/nix/user/git.nix +++ b/nix/user/git.nix @@ -19,7 +19,7 @@ extraConfig = { column.ui = "auto"; - branch.sort = "-comitterdate"; + branch.sort = "-committerdate"; tag.sort = "version:refname"; diff = { algorithm = "histogram"; From d6c9961745bb226238a3190145a055a7755a8f73 Mon Sep 17 00:00:00 2001 From: Martin Date: Wed, 26 Feb 2025 19:52:41 +0100 Subject: [PATCH 09/10] Update nix; add some vim markdown --- nix/common.nix | 3 ++- nix/flake.lock | 18 +++++++++--------- nix/user/nvim.nix | 4 ++++ 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/nix/common.nix b/nix/common.nix index 1f0294f..d676d3d 100644 --- a/nix/common.nix +++ b/nix/common.nix @@ -13,7 +13,8 @@ nil # neovim - (pkgs.nerdfonts.override { fonts = [ "FiraCode" ]; }) + # (pkgs.nerdfonts.override { fonts = [ "FiraCode" ]; }) + pkgs.nerd-fonts.fira-code # (pkgs.writeShellScriptBin "my-hello" '' # echo "Hello, ${config.home.username}!" diff --git a/nix/flake.lock b/nix/flake.lock index 22c5c48..ec87c03 100644 --- a/nix/flake.lock +++ b/nix/flake.lock @@ -7,11 +7,11 @@ ] }, "locked": { - "lastModified": 1715930644, - "narHash": "sha256-W9pyM3/vePxrffHtzlJI6lDS3seANQ+Nqp+i58O46LI=", + "lastModified": 1740579671, + "narHash": "sha256-Dwt/3KknOQ4bgFG5YjqDT7oWRy27rPpDjAi2P0ok1zw=", "owner": "nix-community", "repo": "home-manager", - "rev": "e3ad5108f54177e6520535768ddbf1e6af54b59d", + "rev": "53c587d263f94aaf6a281745923c76bbec62bcf3", "type": "github" }, "original": { @@ -27,11 +27,11 @@ ] }, "locked": { - "lastModified": 1715901937, - "narHash": "sha256-eMyvWP56ZOdraC2IOvZo0/RTDcrrsqJ0oJWDC76JTak=", + "lastModified": 1740452771, + "narHash": "sha256-/tI1vFJ7/dXJqUmI+s0EV1F0DPe6dZvT444mrLUkrlU=", "owner": "LnL7", "repo": "nix-darwin", - "rev": "ffc01182f90118119930bdfc528c1ee9a39ecef8", + "rev": "42be12b510253d750138ec90c66decc282298b44", "type": "github" }, "original": { @@ -42,11 +42,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1715787315, - "narHash": "sha256-cYApT0NXJfqBkKcci7D9Kr4CBYZKOQKDYA23q8XNuWg=", + "lastModified": 1740367490, + "narHash": "sha256-WGaHVAjcrv+Cun7zPlI41SerRtfknGQap281+AakSAw=", "owner": "nixos", "repo": "nixpkgs", - "rev": "33d1e753c82ffc557b4a585c77de43d4c922ebb5", + "rev": "0196c0175e9191c474c26ab5548db27ef5d34b05", "type": "github" }, "original": { diff --git a/nix/user/nvim.nix b/nix/user/nvim.nix index 1811ed6..98b874b 100644 --- a/nix/user/nvim.nix +++ b/nix/user/nvim.nix @@ -38,6 +38,10 @@ lspkind-nvim copilot-lua copilot-cmp + image-nvim + img-clip-nvim + markdown-preview-nvim + vim-markdown (nvim-treesitter.withPlugins (p: [ p.awk p.bash p.c p.c_sharp p.cpp p.css p.diff p.dockerfile p.doxygen p.git_config p.gitcommit p.go p.gomod p.gosum p.gotmpl p.helm p.haskell p.html p.http p.java p.javascript p.json p.latex p.lua p.markdown p.markdown_inline p.matlab p.nix p.printf p.python p.regex p.rust p.sql p.strace p.supercollider p.svelte p.swift p.terraform p.tmux p.toml p.typescript p.vim p.xml p.yaml p.zig ])) ]; From 56da32336bebd0ee3cf4d644d2515fa604463b1b Mon Sep 17 00:00:00 2001 From: Martin Date: Wed, 26 Feb 2025 19:55:40 +0100 Subject: [PATCH 10/10] Add nvim writing init --- nvim/writing-init.lua | 338 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 338 insertions(+) create mode 100644 nvim/writing-init.lua diff --git a/nvim/writing-init.lua b/nvim/writing-init.lua new file mode 100644 index 0000000..d13c0f2 --- /dev/null +++ b/nvim/writing-init.lua @@ -0,0 +1,338 @@ +------------------------- +-------- OPTIONS -------- +------------------------- +vim.opt.mouse = 'a' +vim.opt.history = 1000 +-- vim.opt.ruler = true +-- vim.opt.ruler = true +-- vim.opt.number = true +vim.opt.showcmd = true +vim.opt.ttimeoutlen = 100 +vim.opt.backspace = 'indent,eol,start' +vim.opt.tabstop = 2 +vim.opt.expandtab = true +vim.opt.shiftwidth = 2 +vim.opt.softtabstop = 2 +vim.opt.autoindent = true +vim.opt.showmatch = true +vim.opt.incsearch = true +vim.opt.hlsearch = true +vim.opt.wrapscan = true +vim.opt.ignorecase = true +vim.opt.smartcase = true +vim.opt.hidden = true +vim.opt.splitright = true +vim.opt.splitbelow = true +vim.opt.swapfile = false +vim.opt.wildmode = 'longest,list' +vim.opt.wildignore = vim.opt.wildignore + 'main,*.o,*.d,*.aux,*.bbl,*.lof,*.loa,*.blg,*.fdb_latexmk,*.fls,*.tdo,*.pdf,*.pyc' +vim.opt.spell = false +vim.opt.foldmethod = 'syntax' +vim.opt.foldopen = vim.opt.foldopen - 'block' +vim.opt.foldlevel = 99 +vim.opt.lazyredraw = true +vim.opt.listchars = 'eol:¬,tab:▸ ,trail:·' +vim.opt.fillchars = 'vert:|,fold: ' +vim.opt.list = true +vim.opt.laststatus = 2 +vim.opt.scrolloff = 8 +vim.opt.background = 'light' +vim.opt.wrap = true +vim.opt.showbreak = '..' +vim.opt.errorbells = false +vim.opt.visualbell = false +vim.opt.title = true +vim.opt.autoread = true +vim.opt.syntax = 'on' +vim.opt.encoding = 'utf-8' +vim.opt.completeopt = 'menu,menuone,noselect' + + +---------------------------- +-------- CLIPBOARD --------- +---------------------------- +-- if vim.fn.has("wsl") == 1 then +vim.opt.clipboard:append('unnamedplus') +-- end + + +---------------------------- +-------- COMMANDS ---------- +---------------------------- + +vim.cmd('filetype plugin indent on') + +-- vim.cmd('colorscheme lucius') +-- vim.cmd('LuciusWhite') + + +------------------------------ +---------- AUTOGROUPS -------- +------------------------------ + +vim.api.nvim_create_augroup('VimIntern', { clear = true }) + +vim.api.nvim_create_autocmd({'FocusGained', 'BufEnter', 'CursorMoved', 'CursorMovedI', 'CursorHold', 'CursorHoldI'}, { + group = 'VimIntern', + pattern = '*', + command = 'silent! checktime' +}) + +vim.api.nvim_create_autocmd('BufEnter', { + group = 'VimIntern', + pattern = '*', + command = 'silent! lcd %:p:h' +}) + + +----------------------------- +---------- FUNCTIONS -------- +----------------------------- + +vim.api.nvim_create_user_command('TrimWhiteSpace', function() + vim.cmd('%s/\\s\\+$//e') +end, {}) +vim.g.mapleader = " " + +-- Navigation +vim.keymap.set('n', 'j', 'gj', {}) +vim.keymap.set('n', 'k', 'gk', {}) +vim.keymap.set('v', 'j', 'gj', {}) +vim.keymap.set('v', 'k', 'gk', {}) + +vim.keymap.set('n', '', 'h', {}) +vim.keymap.set('n', '', 'j', {}) +vim.keymap.set('n', '', 'k', {}) +vim.keymap.set('n', '', 'l', {}) + +vim.keymap.set('n', 's', ':call WindowSwap#EasyWindowSwap()', {}) + +-- Convenience +vim.keymap.set('n', 'w', ':w', { silent = true }) +vim.keymap.set('n', 'F', ':e.', {}) +vim.keymap.set('n', 'Y', 'y$', {}) + +-- Telescope +local telebuiltin = require('telescope.builtin') +vim.keymap.set('n', 'ff', telebuiltin.find_files, { silent = true }) +vim.keymap.set('n', 'fg', telebuiltin.live_grep, { silent = true }) +vim.keymap.set('n', 'fs', telebuiltin.grep_string, { silent = true }) +vim.keymap.set('n', 'o', telebuiltin.buffers, { silent = true }) +vim.keymap.set('n', 'fh', telebuiltin.help_tags, { silent = true }) + +---- Yanky +--vim.keymap.set({"n","x"}, "p", "(YankyPutAfter)") +--vim.keymap.set({"n","x"}, "P", "(YankyPutBefore)") +--vim.keymap.set({"n","x"}, "gp", "(YankyGPutAfter)") +--vim.keymap.set({"n","x"}, "gP", "(YankyGPutBefore)") +--vim.keymap.set("n", "", "(YankyCycleForward)") +--vim.keymap.set("n", "", "(YankyCycleBackward)") +--vim.keymap.set({"n","x"}, "y", "(YankyYank)") + +-- Undotree +vim.keymap.set('n', 'u', vim.cmd.UndotreeToggle) + +---- nnoremap t :CtrlPBufTagAll +---- nnoremap T :TagbarToggle +vim.g.delimitMate_expand_space=1 +vim.g.delimitMate_expand_cr = 1 + +vim.g.tagbar_left=1 +vim.g.tagbar_autoclose=1 +vim.g.tagbar_autofocus=1 + +--vim.g.windowswap_map_keys=0 + +local cmp = require('cmp') +local lspkind = require('lspkind') + +--cmp.setup({ +-- snippet = { +-- expand = function(args) +-- vim.fn["vsnip#anonymous"](args.body) -- For `vsnip` users. +-- end, +-- }, + +-- window = { +-- completion = cmp.config.window.bordered(), +-- documentation = cmp.config.window.bordered(), +-- }, + +-- mapping = cmp.mapping.preset.insert({ +-- [''] = cmp.mapping.scroll_docs(-4), +-- [''] = cmp.mapping.scroll_docs(4), +-- [''] = cmp.mapping.complete(), +-- [''] = cmp.mapping.abort(), +-- [''] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. +-- }), + +-- sources = cmp.config.sources({ +-- { name = 'nvim_lsp' }, +-- { name = 'vsnip' }, +-- { name = 'path' }, +-- { name = 'cmp_yanky' }, +-- { name = 'git' }, +-- { name = 'copilot' }, +-- -- }, { +-- { name = 'buffer', keyword_length = 2 }, +-- }), + +-- formatting = { +-- format = lspkind.cmp_format({ +-- -- mode = "symbol_text", +-- mode = "symbol", +-- menu = ({ +-- buffer = "[buf]", +-- nvim_lsp = "[lsp]", +-- vsnip = "[snip]", +-- nvim_lua = "[lua]", +-- latex_symbols = "[tex]", +-- path = "[path]", +-- cmp_yanky = "[yank]", +-- copilot = "[copilot]", +-- }), +-- symbol_map = { Copilot = "" } +-- }), +-- }, +--}) + +---- -- Set configuration for specific filetype. +---- cmp.setup.filetype('gitcommit', { +---- sources = cmp.config.sources({ +---- { name = 'git' }, -- You can specify the `git` source if [you were installed it](https://github.com/petertriho/cmp-git). +---- }, { +---- { name = 'buffer' }, +---- }) +---- }) + +--cmp.setup.cmdline({ '/', '?' }, { +-- mapping = cmp.mapping.preset.cmdline(), +-- sources = { +-- { name = 'buffer' } +-- } +--}) + +--cmp.setup.cmdline(':', { +-- mapping = cmp.mapping.preset.cmdline(), +-- sources = cmp.config.sources({ +-- { name = 'path' } +-- }, { +-- { name = 'cmdline' } +-- }), +-- matching = { disallow_symbol_nonprefix_matching = false } +--}) + +--local capabilities = require('cmp_nvim_lsp').default_capabilities() +local lspconfig = require("lspconfig") +--lspconfig.gopls.setup({ capabilities = capabilities }) +--lspconfig.svelte.setup({ capabilities = capabilities }) +--lspconfig.pyright.setup({ capabilities = capabilities }) +--lspconfig.omnisharp.setup({ capabilities = capabilities }) +--lspconfig.clangd.setup({ capabilities = capabilities }) +--lspconfig.dockerls.setup({ capabilities = capabilities }) +--lspconfig.docker_compose_language_service.setup({ capabilities = capabilities }) +--lspconfig.flow.setup({ capabilities = capabilities }) +lspconfig.marksman.setup({ capabilities = capabilities }) +--lspconfig.als.setup({ capabilities = capabilities }) +--lspconfig.sqls.setup({ capabilities = capabilities }) +--lspconfig.yamlls.setup({ capabilities = capabilities }) +--lspconfig.nil_ls.setup({ capabilities = capabilities }) + +require("yanky").setup({ + ring = { + history_length = 100, + storage = "shada", + sync_with_numbered_registers = true, + cancel_event = "update", + }, + system_clipboard = { + sync_with_ring = true, + }, + preserve_cursor_position = { + enabled = true, + }, +}) + +require("telescope").load_extension("yank_history") + +require'nvim-treesitter.configs'.setup { + -- ensure_installed = { "lua", "vim", "help" }, + ensure_installed = {}, + sync_install = false, + auto_install = false, + + + highlight = { + enable = true, + + disable = function(lang, buf) + local max_filesize = 100 * 1024 -- 100 KB + local ok, stats = pcall(vim.loop.fs_stat, vim.api.nvim_buf_get_name(buf)) + if ok and stats and stats.size > max_filesize then + return true + end + end, + + additional_vim_regex_highlighting = false, + }, +} + +require('lualine').setup({ + options = { + icons_enabled = true, + theme = 'Tomorrow', + component_separators = { left = '', right = ''}, + section_separators = { left = '', right = ''}, + disabled_filetypes = { + statusline = {}, + winbar = {}, + }, + ignore_focus = {}, + always_divide_middle = true, + globalstatus = false, + refresh = { + statusline = 1000, + tabline = 1000, + winbar = 1000, + } + }, + sections = { + lualine_a = {'mode'}, + lualine_b = {'branch', 'diff', 'diagnostics'}, + lualine_c = {'filename'}, + lualine_x = {'encoding', 'fileformat', 'filetype'}, + lualine_y = {'progress'}, + lualine_z = {'location'} + }, + inactive_sections = { + lualine_a = {}, + lualine_b = {}, + lualine_c = {'filename'}, + lualine_x = {'location'}, + lualine_y = {}, + lualine_z = {} + }, + tabline = {}, + winbar = {}, + inactive_winbar = {}, + extensions = {} +}) + + +--require("copilot").setup({ +-- suggestion = { enabled = false }, +-- panel = { enabled = false }, +--}) +--require("copilot_cmp").setup() + +require("aerial").setup({ + -- optionally use on_attach to set keymaps when aerial has attached to a buffer + on_attach = function(bufnr) + -- Jump forwards/backwards with '{' and '}' + vim.keymap.set("n", "{", "AerialPrev", { buffer = bufnr }) + vim.keymap.set("n", "}", "AerialNext", { buffer = bufnr }) + end, +}) +-- You probably also want to set a keymap to toggle aerial +vim.keymap.set("n", "a", "AerialToggle!") +