diff --git a/nix/common.nix b/nix/common.nix index 8822d8b..9e3ea19 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}!" @@ -48,7 +49,8 @@ # EDITOR = "nvim"; #}; - # home.shellAliases = { + #home.shellAliases = { + # "ll" = "ls -la"; # "t" = "tmuxp"; # "tl" = "tmuxp load"; # }; diff --git a/nix/flake.lock b/nix/flake.lock index ea40871..ec87c03 100644 --- a/nix/flake.lock +++ b/nix/flake.lock @@ -7,11 +7,11 @@ ] }, "locked": { - "lastModified": 1732482255, - "narHash": "sha256-GUffLwzawz5WRVfWaWCg78n/HrBJrOG7QadFY6rtV8A=", + "lastModified": 1740579671, + "narHash": "sha256-Dwt/3KknOQ4bgFG5YjqDT7oWRy27rPpDjAi2P0ok1zw=", "owner": "nix-community", "repo": "home-manager", - "rev": "a9953635d7f34e7358d5189751110f87e3ac17da", + "rev": "53c587d263f94aaf6a281745923c76bbec62bcf3", "type": "github" }, "original": { @@ -20,13 +20,33 @@ "type": "github" } }, + "nix-darwin": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1740452771, + "narHash": "sha256-/tI1vFJ7/dXJqUmI+s0EV1F0DPe6dZvT444mrLUkrlU=", + "owner": "LnL7", + "repo": "nix-darwin", + "rev": "42be12b510253d750138ec90c66decc282298b44", + "type": "github" + }, + "original": { + "owner": "LnL7", + "repo": "nix-darwin", + "type": "github" + } + }, "nixpkgs": { "locked": { - "lastModified": 1732014248, - "narHash": "sha256-y/MEyuJ5oBWrWAic/14LaIr/u5E0wRVzyYsouYY3W6w=", + "lastModified": 1740367490, + "narHash": "sha256-WGaHVAjcrv+Cun7zPlI41SerRtfknGQap281+AakSAw=", "owner": "nixos", "repo": "nixpkgs", - "rev": "23e89b7da85c3640bbc2173fe04f4bd114342367", + "rev": "0196c0175e9191c474c26ab5548db27ef5d34b05", "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 ff9a481..36043f9 100644 --- a/nix/flake.nix +++ b/nix/flake.nix @@ -3,18 +3,54 @@ 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"; system = "x86_64-linux"; 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; @@ -22,9 +58,20 @@ modules = [ ./user/profiles/moustachioedBook.nix ./common.nix - ./user/task.nix + ./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 9b74d3f..1050e94 100644 --- a/nix/user/git.nix +++ b/nix/user/git.nix @@ -20,10 +20,39 @@ difftastic.enable = true; extraConfig = { - core = { - editor = "nvim"; + column.ui = "auto"; + branch.sort = "-committerdate"; + 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"; merge.conflicstyle = "zdiff3"; fetch.prune = true; diff --git a/nix/user/nvim.nix b/nix/user/nvim.nix index 004eab6..98b874b 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 @@ -29,12 +31,17 @@ cmp-path cmp-cmdline cmp-nvim-lsp + cmp-nvim-lsp-signature-help cmp_yanky cmp-git nvim-lspconfig 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 ])) ]; @@ -51,6 +58,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 9979284..a90152a 100644 --- a/nix/user/sh.nix +++ b/nix/user/sh.nix @@ -79,7 +79,7 @@ du-dust glow ripgrep-all - #nerdfonts + llm ]; home.sessionVariables = lib.mkMerge [ { diff --git a/nix/user/task.nix b/nix/user/task.nix index ec5ceb1..ab0e89d 100644 --- a/nix/user/task.nix +++ b/nix/user/task.nix @@ -39,6 +39,15 @@ report.low.labels="ID,Active,Age,Deps,P,E,Project,Tag,Recur,S,Due,Until,Description,Urg"; report.low.sort="energy+,urgency-"; + 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"; }; 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"; + } + ]; +} 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!") +