From 0c1f2b4297b5baa591580a55bd0e653cfb5ed797 Mon Sep 17 00:00:00 2001 From: Matei Adriel Date: Mon, 4 Apr 2022 02:10:26 +0300 Subject: [PATCH] feat: greek letter keyboard layout + custom brackets in nvim --- README.md | 1 + configuration.nix | 33 +- dotfiles/kmonad/keymap.kbd | 109 +++ dotfiles/kmonad/test.sh | 2 + dotfiles/kmonad/xcompose | 40 ++ dotfiles/neovim/init.lua | 1 + .../lspconfig/server_configurations/agda.lua | 12 + dotfiles/neovim/lua/my/abbreviations.lua | 8 + dotfiles/neovim/lua/my/helpers/augroup.lua | 14 + dotfiles/neovim/lua/my/keymaps.lua | 17 +- dotfiles/neovim/lua/my/plugins/comment.lua | 20 +- dotfiles/neovim/lua/my/plugins/idris.lua | 33 + dotfiles/neovim/lua/my/plugins/init.lua | 10 +- dotfiles/neovim/lua/my/plugins/lean.lua | 13 + .../neovim/lua/my/plugins/lh-brackets.lua | 38 ++ dotfiles/neovim/lua/my/plugins/lspconfig.lua | 5 +- dotfiles/neovim/lua/my/plugins/telescope.lua | 33 +- .../lua/my/plugins/vim-tmux-navigator.lua | 15 + .../lua/telescope/extensions/unicode.lua | 80 +++ dotfiles/tmux/tmux.conf | 6 - flake.lock | 629 +++++++++++++++++- flake.nix | 37 +- modules/applications/default.nix | 3 +- modules/applications/kmonad.nix | 22 + modules/applications/locale.nix | 7 +- modules/applications/misc.nix | 3 +- modules/applications/neovim.nix | 12 +- modules/applications/tmux.nix | 2 +- modules/applications/xmodmap/.Xmodmap | 11 +- modules/dev/agda.nix | 3 + modules/dev/default.nix | 12 +- modules/dev/idris.nix | 5 +- modules/dev/lean.nix | 5 + modules/nix.nix | 21 +- modules/overlays/flakes.nix | 24 +- modules/themes/themes.nix | 2 +- modules/users.nix | 22 + rebuild.sh | 2 + test.sh | 3 + 39 files changed, 1228 insertions(+), 87 deletions(-) create mode 100644 dotfiles/kmonad/keymap.kbd create mode 100755 dotfiles/kmonad/test.sh create mode 100644 dotfiles/kmonad/xcompose create mode 100644 dotfiles/neovim/lua/lspconfig/server_configurations/agda.lua create mode 100644 dotfiles/neovim/lua/my/abbreviations.lua create mode 100644 dotfiles/neovim/lua/my/helpers/augroup.lua create mode 100644 dotfiles/neovim/lua/my/plugins/idris.lua create mode 100644 dotfiles/neovim/lua/my/plugins/lean.lua create mode 100644 dotfiles/neovim/lua/my/plugins/lh-brackets.lua create mode 100644 dotfiles/neovim/lua/my/plugins/vim-tmux-navigator.lua create mode 100644 dotfiles/neovim/lua/telescope/extensions/unicode.lua create mode 100644 modules/applications/kmonad.nix create mode 100644 modules/dev/agda.nix create mode 100644 modules/dev/lean.nix create mode 100644 rebuild.sh create mode 100755 test.sh diff --git a/README.md b/README.md index 307e889..2f0798c 100644 --- a/README.md +++ b/README.md @@ -3,4 +3,5 @@ My flake based nixos configuration. To use this, just rebuild your system using `sudo nixos-rebuild switch --flake .` while in the project directory. ## TODO: + - make special separate dir for dotfiles. Would makes it easier to share them specifically diff --git a/configuration.nix b/configuration.nix index 280f3f6..d908620 100644 --- a/configuration.nix +++ b/configuration.nix @@ -2,6 +2,7 @@ imports = [ ./modules ]; boot.loader.systemd-boot.enable = true; + boot.tmpOnTmpfs = true; home-manager.useGlobalPkgs = true; home-manager.useUserPackages = true; @@ -44,14 +45,9 @@ home-manager.users.adrielus = { manual.manpages.enable = false; - # home.packages = with pkgs; [ bluez bluez-tools ]; }; - # Enable blueman - # services.blueman.enable = true; - hardware = { - pulseaudio = { enable = true; @@ -62,35 +58,8 @@ # Extra codecs extraModules = [ pkgs.pulseaudio-modules-bt ]; }; - - # configFile = pkgs.writeText "default.pa" '' - # load-module module-bluetooth-policy - # load-module module-bluetooth-discover - # ## module fails to load with - # ## module-bluez5-device.c: Failed to get device path from module arguments - # ## module.c: Failed to load module "module-bluez5-device" (argument: ""): initialization failed. - # # load-module module-bluez5-device - # # load-module module-bluez5-discover - # ''; - - # extraConfig = '' - # load-module module-switch-on-connect - # ''; - # }; - # bluetooth = { - # enable = true; - # config."General"."Enable" = "Source,Sink,Media,Socket"; - - # }; }; - # home-manager.users.adrielus.services.mpris-proxy = { - # Unit.Description = "Mpris proxy"; - # Unit.After = [ "network.target" "sound.target" ]; - # Service.ExecStart = "${pkgs.bluez}/bin/mpris-proxy"; - # Install.WantedBy = [ "default.target" ]; - # }; - system.stateVersion = "21.11"; # TODO: put nixpkgs stuff inside their own file diff --git a/dotfiles/kmonad/keymap.kbd b/dotfiles/kmonad/keymap.kbd new file mode 100644 index 0000000..560460c --- /dev/null +++ b/dotfiles/kmonad/keymap.kbd @@ -0,0 +1,109 @@ +(defcfg + ;; For Linux + input (device-file "/dev/input/by-path/platform-i8042-serio-0-event-kbd") + output (uinput-sink "My KMonad output" + ;; To understand the importance of the following line, see the section on + ;; Compose-key sequences at the near-bottom of this file. + "/run/current-system/sw/bin/sleep 1 && /run/current-system/sw/bin/setxkbmap -option compose:ralt") + cmp-seq ralt ;; Set the compose key to `RightAlt' + cmp-seq-delay 5 ;; 5ms delay between each compose-key sequence press + + ;; Comment this is you want unhandled events not to be emitted + fallthrough true + + ;; Set this to false to disable any command-execution in KMonad + allow-cmd false +) + +#| +(deflayer qwerty + _ _ _ _ _ _ _ _ _ _ _ _ _ _ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ + _ _ _ _ _ _ _ _ _ _ _ _ _ + _ _ _ _ _ _ _ _ _ _ _ _ + _ _ _ _ _ _ _ +) +|# + +(defalias + mth (layer-toggle math) + Mth (layer-toggle capital-math) + + ga #(ralt a h) ;; alpha + gb #(ralt b h) ;; beta + gg #(ralt g h) ;; gamma + ge #(ralt e h) ;; epsilon + gt #(ralt t h) ;; tau + gl #(ralt l h) ;; lambda + gm #(ralt m h) ;; miu + gp #(ralt p h) ;; pi + gx #(ralt x h) ;; xi + gs #(ralt s h) ;; sigma + go #(ralt o h) ;; omega + gu #(ralt u h) ;; uspilon + + gph #(ralt l p h h) ;; phi + gth #(ralt l t h h) ;; theta + gps #(ralt l p s h) ;; psi + + Gu #(ralt u j) ;; UPSILON + Gg #(ralt g j) ;; GAMMA + Gd #(ralt d j) ;; DELTAJ + Gp #(ralt p j) ;; PI + Gs #(ralt s j) ;; SIGMA + Go #(ralt o j) ;; OMEGA + Gx #(ralt x j) ;; XI + + neg #(ralt l -) ;; ¬ + fal #(ralt l v) ;; ∀ + ex #(ralt l e) ;; ∃ + lar #(ralt < -) ;; ← + rar #(ralt - >) ;; → + + alp #(ralt f \( ) ;; angled left parenthesis + arp #(ralt f \) ) ;; angled right parenthesis + + shrugFace #(ralt l s h r) ;; shrug face + topBar #(ralt t -) ;; ¯ + + shr #(@topBar \ \_ \_ \( @shrugFace \) \_ / @topBar) ;; ¯\_(ツ)_/¯ +) + +(defsrc + esc f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 del + grv 1 2 3 4 5 6 7 8 9 0 - = bspc + tab q w e r t y u i o p [ ] \ + caps a s d f g h j k l ; ' ret + lsft z x c v b n m , . / rsft + lctl lsgt lmet lalt spc ralt rctl +) + +(deflayer qwerty + esc f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 del + grv 1 2 3 4 5 6 7 8 9 0 - = bspc + tab q w e r t y u i o p [ ] \ + @mth a s d f g h j k l ; ' ret + lsft z x c v b n m , . / rsft + lctl lsgt lmet lalt spc ralt rctl +) + +(deflayer math + _ _ _ _ _ _ _ _ _ _ _ _ _ _ + _ _ _ @ex _ _ _ _ _ @alp @arp @neg _ _ + _ @shr @go @ge _ @gt _ @gu _ @go @gp _ _ _ + _ @ga @gs _ _ @gg @gth @gps @gph @gl _ _ _ + @Mth _ @gx _ @fal @gb _ @gm @lar @rar _ _ + _ _ _ _ _ _ _ +) + +(deflayer capital-math + _ _ _ _ _ _ _ _ _ _ _ _ _ _ + _ _ _ _ _ _ _ _ _ _ _ _ _ _ + _ _ _ _ _ _ _ @Gu _ @Go @Gp _ _ _ + _ _ @Gs @Gd _ @Gg _ _ _ _ _ _ _ + _ _ @Gx _ _ _ _ _ _ _ _ _ + _ _ _ _ _ _ _ +) + + diff --git a/dotfiles/kmonad/test.sh b/dotfiles/kmonad/test.sh new file mode 100755 index 0000000..c3067a7 --- /dev/null +++ b/dotfiles/kmonad/test.sh @@ -0,0 +1,2 @@ +#!/run/current-system/sw/bin/bash +kmonad -d "`dirname "$0"`/keymap.kbd" diff --git a/dotfiles/kmonad/xcompose b/dotfiles/kmonad/xcompose new file mode 100644 index 0000000..ad9e2d7 --- /dev/null +++ b/dotfiles/kmonad/xcompose @@ -0,0 +1,40 @@ +# -*- coding: utf-8; mode: conf -*- include "%L" + + : "ɑ" U0251 # LATIN SMALL LETTER ALPHA + : "β" U0252 # LATIN SMALL LETTER BETA + : "γ" U0253 # LATIN SMALL LETTER GAMMA + : "ϵ" U0254 # LATIN SMALL LETTER EPSILON + : "λ" U0255 # LATIN SMALL LETTER LAMBDA + : "μ" U0256 # LATIN SMALL LETTER MU +

: "π" U0257 # LATIN SMALL LETTER PI + : "τ" U0258 # LATIN SMALL LETTER TAU + : "ξ" U0259 # LATIN SMALL LETTER XI + : "σ" U0260 # LATIN SMALL LETTER SIGMA + : "ω" U0261 # LATIN SMALL LETTER OMEGA + : "υ" U0262 # LATIN SMALL LETTER UPSILON + +

: "ϕ" U0270 # LATIN SMALL LETTER PHI + : "θ" U0271 # LATIN SMALL LETTER THETA +

: "ψ" U0272 # LATIN SMALL LETTER PSI + + : "ϒ" U0280 # LATIN CAPITAL LETTER UPSILON + : "Γ" U0281 # LATIN CAPITAL LETTER GAMMA + : "Δ" U0282 # LATIN CAPITAL LETTER DELTA +

: "Π" U0283 # LATIN CAPITAL LETTER PI + : "Σ" U0284 # LATIN CAPITAL LETTER SIGMA + : "Ω" U0285 # LATIN CAPITAL LETTER OMEGA + : "Ξ" U0286 # LATIN CAPITAL LETTER XI + + : "Θ" U0300 # LATIN CAPITAL LETTER OMEGA + + : "ツ" U0350 # SHRUG FACE + : "¯" U0351 # TOP BAR + : "¬" U0352 # LOGICAL NEGATION + : "→" U0353 # ARROW RIGHT + : "←" U0354 # ARROW LEFT + : "∀" U0355 # LOGICAL FORALL + : "∃" U0356 # LOGICAL EXISTS + + : "⟨" U0357 # FANCY LEFT PAREN + : "⟩" U0358 # FANCY RIGHT PAREN + diff --git a/dotfiles/neovim/init.lua b/dotfiles/neovim/init.lua index 4e3bf89..6f28d6c 100644 --- a/dotfiles/neovim/init.lua +++ b/dotfiles/neovim/init.lua @@ -2,3 +2,4 @@ require("my.options").setup() require('my.keymaps').setup() require('my.plugins').setup() +require("telescope.extensions.unicode").setupAbbreviations() diff --git a/dotfiles/neovim/lua/lspconfig/server_configurations/agda.lua b/dotfiles/neovim/lua/lspconfig/server_configurations/agda.lua new file mode 100644 index 0000000..ba6194d --- /dev/null +++ b/dotfiles/neovim/lua/lspconfig/server_configurations/agda.lua @@ -0,0 +1,12 @@ +local bin_name = 'agda-language-server' +local cmd = {bin_name, '--stdio'} + +if vim.fn.has 'win32' == 1 then cmd = {'cmd.exe', '/C', bin_name, '--stdio'} end + +return { + default_config = { + cmd = cmd, + filetypes = {'agda'} + -- root_dir = util.root_pattern('bower.json', 'psc-package.json', 'spago.dhall'), + } +} diff --git a/dotfiles/neovim/lua/my/abbreviations.lua b/dotfiles/neovim/lua/my/abbreviations.lua new file mode 100644 index 0000000..41c0eb9 --- /dev/null +++ b/dotfiles/neovim/lua/my/abbreviations.lua @@ -0,0 +1,8 @@ +local M = {} + +function M.abbr(lhs, rhs) + -- Create abbreviation + vim.cmd(":iabbrev " .. lhs .. " " .. rhs) +end + +return M diff --git a/dotfiles/neovim/lua/my/helpers/augroup.lua b/dotfiles/neovim/lua/my/helpers/augroup.lua new file mode 100644 index 0000000..12a6372 --- /dev/null +++ b/dotfiles/neovim/lua/my/helpers/augroup.lua @@ -0,0 +1,14 @@ +local M = {} + +function M.augroup(name, inside) + vim.cmd('augroup ' .. name) + vim.cmd('autocmd!') + inside() + vim.cmd('augroup END') +end + +function M.autocmd(event, glob, action) + vim.cmd('autocmd ' .. event .. ' ' .. glob .. ' ' .. action) +end + +return M diff --git a/dotfiles/neovim/lua/my/keymaps.lua b/dotfiles/neovim/lua/my/keymaps.lua index 8b4c187..8fcbe5f 100644 --- a/dotfiles/neovim/lua/my/keymaps.lua +++ b/dotfiles/neovim/lua/my/keymaps.lua @@ -1,10 +1,18 @@ local helpers = require("my.helpers") +local arpeggio = require("my.plugins.arpeggio") local M = {} function M.map(mode, lhs, rhs, opts) - local options = helpers.mergeTables(opts, {noremap = true}) - vim.api.nvim_set_keymap(mode, lhs, rhs, options) + if string.len(mode) > 1 then + for i = 1, #mode do + local c = mode:sub(i, i) + M.map(c, lhs, rhs, opts) + end + else + local options = helpers.mergeTables(opts, {noremap = true}) + vim.api.nvim_set_keymap(mode, lhs, rhs, options) + end end function M.mapSilent(mode, lhs, rhs, opts) @@ -16,6 +24,11 @@ function M.setup() M.map("i", "jj", "") -- Remap Esc to jj M.map("n", "", ":w") -- Double space to sace M.map("n", "vv", "v") -- Create vertical split + + if arpeggio ~= nil then + -- Create chords + arpeggio.chord("i", "k", "C-k") -- Rebind digraph insertion to leader+k + end end return M diff --git a/dotfiles/neovim/lua/my/plugins/comment.lua b/dotfiles/neovim/lua/my/plugins/comment.lua index a9a4814..e1c14ae 100644 --- a/dotfiles/neovim/lua/my/plugins/comment.lua +++ b/dotfiles/neovim/lua/my/plugins/comment.lua @@ -1,18 +1,26 @@ +local A = require("my.helpers.augroup") local M = {} +local extraCommentStrings = {nix = "# %s", lean = "/- %s -/"} + -- Update comments for certain languages local function setCommentString(extension, commentString) - vim.cmd('augroup set-commentstring-' .. extension) - vim.cmd('autocmd!') - vim.cmd('autocmd BufEnter *.' .. extension .. ' :lua vim.api.nvim_buf_set_option(0, "commentstring", "' .. commentString .. '")') - vim.cmd('autocmd BufFilePost *.' .. extension .. ' :lua vim.api.nvim_buf_set_option(0, "commentstring", "' .. commentString .. '")') - vim.cmd('augroup END') + A.augroup('set-commentstring-' .. extension, function() + local action = + ':lua vim.api.nvim_buf_set_option(0, "commentstring", "' .. + commentString .. '")' + + A.autocmd('BufEnter', '*.' .. extension, action) + A.autocmd('BufFilePost', '*.' .. extension, action) + end) end function M.setup() require('nvim_comment').setup() - setCommentString("nix", "# %s") + for lang, commentString in pairs(extraCommentStrings) do + setCommentString(lang, commentString) + end end return M diff --git a/dotfiles/neovim/lua/my/plugins/idris.lua b/dotfiles/neovim/lua/my/plugins/idris.lua new file mode 100644 index 0000000..5799d09 --- /dev/null +++ b/dotfiles/neovim/lua/my/plugins/idris.lua @@ -0,0 +1,33 @@ +local arpeggio = require("my.plugins.arpeggio") +local lspconfig = require("my.plugins.lspconfig") + +local M = {} + +local idrisChords = { + sc = "case_split", + mc = "make_case", + ml = "make_lemma", + es = "expr_search", + gd = "generate_def", + rh = "refine_hole", + ac = "add_clause" +} + +function M.setup() + require("idris2").setup({ + server = { + on_attach = function(client, bufnr) + lspconfig.on_attach(client, bufnr) + + for key, value in pairs(idrisChords) do + arpeggio.chord("n", "i" .. key, + ":lua require('idris2.code_action')." .. + value .. "()") + end + end + }, + client = {hover = {use_split = true}} + }) +end + +return M diff --git a/dotfiles/neovim/lua/my/plugins/init.lua b/dotfiles/neovim/lua/my/plugins/init.lua index f98fc16..5acf41f 100644 --- a/dotfiles/neovim/lua/my/plugins/init.lua +++ b/dotfiles/neovim/lua/my/plugins/init.lua @@ -4,21 +4,25 @@ function M.setup() -- Other unconfigured plugins require('nvim-autopairs').setup() require("startup").setup({theme = "dashboard"}) - require("presence"):setup({}) + require("presence"):setup({}) -- wtf does the : do here? -- Plugins with their own configs: + -- require("my.plugins.fzf-lua").setup() + -- require("my.plugins.nerdtree").setup() require("my.plugins.cmp").setup() require("my.plugins.lspconfig").setup() require("my.plugins.null-ls").setup() require("my.plugins.lualine").setup() - -- require("my.plugins.fzf-lua").setup() require("my.plugins.treesitter").setup() require("my.plugins.comment").setup() - -- require("my.plugins.nerdtree").setup() require("my.plugins.nvim-tree").setup() require("my.plugins.vimtex").setup() require("my.plugins.telescope").setup() require("my.plugins.vimux").setup() + require("my.plugins.idris").setup() + require("my.plugins.lean").setup() + require("my.plugins.vim-tmux-navigator").setup() + require("my.plugins.lh-brackets").setup() end return M diff --git a/dotfiles/neovim/lua/my/plugins/lean.lua b/dotfiles/neovim/lua/my/plugins/lean.lua new file mode 100644 index 0000000..9de9032 --- /dev/null +++ b/dotfiles/neovim/lua/my/plugins/lean.lua @@ -0,0 +1,13 @@ +local lspconfig = require("my.plugins.lspconfig") +local M = {} + +function M.setup() + require('lean').setup { + abbreviations = {builtin = true, cmp = true}, + lsp = {on_attach = lspconfig.on_attach}, + lsp3 = {on_attach = lspconfig.on_attach}, + mappings = true + } +end + +return M diff --git a/dotfiles/neovim/lua/my/plugins/lh-brackets.lua b/dotfiles/neovim/lua/my/plugins/lh-brackets.lua new file mode 100644 index 0000000..9580c9d --- /dev/null +++ b/dotfiles/neovim/lua/my/plugins/lh-brackets.lua @@ -0,0 +1,38 @@ +local A = require("my.helpers.augroup") +local map = require("my.keymaps").mapSilent +local M = {} + +local extraBrackets = {lean = {{"⟨", "⟩"}}} + +function M.createBracketCommand(lhs, rhs, isGlobal, opts) + local suffix = "" + if isGlobal then suffix = "!" end + + return ":Brackets" .. suffix .. " " .. lhs .. " " .. rhs .. " " .. + (opts or "") +end + +function M.createBracket(lhs, rhs, isGlobal, opts) + vim.cmd(M.createBracketCommand(lhs, rhs, isGlobal, opts)) +end + +function M.setup() + vim.g.marker_define_jump_mappings = 0 -- disable automatic binding of marker jumping (conflicts with tmux-vim-navigator) + + map("inv", "sf", 'MarkersJumpF') + map("inv", "fs", 'MarkersJumpB') + map("inv", "mi", 'MarkersMark') + map("inv", "ml", 'MarkersCloseAllAndJumpToLast') + map("inv", "mo", 'MarkersJumpOutside') + + for key, brackets in pairs(extraBrackets) do + for _, v in ipairs(brackets) do + A.augroup('custom-brackets' .. key, function() + local action = M.createBracketCommand(v[1], v[2], 0, v[3] or "") + A.autocmd('BufEnter', '*.' .. key, action) + end) + end + end +end + +return M diff --git a/dotfiles/neovim/lua/my/plugins/lspconfig.lua b/dotfiles/neovim/lua/my/plugins/lspconfig.lua index 7349d4c..05445a7 100644 --- a/dotfiles/neovim/lua/my/plugins/lspconfig.lua +++ b/dotfiles/neovim/lua/my/plugins/lspconfig.lua @@ -25,8 +25,10 @@ function M.on_attach(client, bufnr) map(bufnr, 'n', 'gi', 'lua vim.lsp.buf.implementation()') -- Hover + map(bufnr, 'n', 'J', + "lua vim.lsp.diagnostic.show_line_diagnostics()") map(bufnr, 'n', 'K', 'lua vim.lsp.buf.hover()') - map(bufnr, 'n', '', 'lua vim.lsp.buf.signature_help()') + map(bufnr, 'n', 'L', 'lua vim.lsp.buf.signature_help()') -- Workspace stuff map(bufnr, 'n', 'wa', @@ -88,6 +90,7 @@ local servers = { } }, rnix = {} + -- agda = {}, Haven't gotten this one to work yet } function M.setup() diff --git a/dotfiles/neovim/lua/my/plugins/telescope.lua b/dotfiles/neovim/lua/my/plugins/telescope.lua index 49f858b..c31326d 100644 --- a/dotfiles/neovim/lua/my/plugins/telescope.lua +++ b/dotfiles/neovim/lua/my/plugins/telescope.lua @@ -1,4 +1,5 @@ local mapSilent = require("my.keymaps").mapSilent +local arpeggio = require("my.plugins.arpeggio") local M = {} @@ -25,19 +26,42 @@ local bindings = { git_commits = "gj", git_branches = "gk" }, - ["extensions.file_browser.file_browser"] = "p" + ["extensions.file_browser.file_browser"] = "p", + extensions = { + unicode = {picker = {mode = "i", kind = "dropdown", key = "uu"}} + } } local function setupKeybinds(obj, path) if path == nil then path = "" end for name, keybinds in pairs(obj) do - if (type(keybinds) == "table") then + if (type(keybinds) == "table") and keybinds.key == nil then -- This means we found a table of keybinds, so we go deeper setupKeybinds(keybinds, path .. "." .. name) else + local config = keybinds + local pickerArgument = "" + local key = config + local mode = "n" + local bind = mapSilent + + if type(config) == "table" then + key = config.key + if config.mode ~= nil then mode = config.mode end + if config.kind ~= nil then + pickerArgument = "require('telescope.themes').get_" .. + config.kind .. "({})" + end + if config.chord then + -- Useful for insert mode bindings + bind = arpeggio.chordSilent + end + end + -- Maps the keybind to the action - mapSilent('n', keybinds, "lua require('telescope" .. path .. - "')." .. name .. "()") + bind(mode, key, + "lua require('telescope" .. path .. "')." .. name .. "(" .. + pickerArgument .. ")") end end end @@ -47,6 +71,7 @@ function M.setup() local settings = { defaults = {mappings = {i = {[""] = "which_key"}}}, + pickers = {find_files = {hidden = true}}, extensions = { file_browser = { mappings = { diff --git a/dotfiles/neovim/lua/my/plugins/vim-tmux-navigator.lua b/dotfiles/neovim/lua/my/plugins/vim-tmux-navigator.lua new file mode 100644 index 0000000..70c896a --- /dev/null +++ b/dotfiles/neovim/lua/my/plugins/vim-tmux-navigator.lua @@ -0,0 +1,15 @@ +local map = require("my.keymaps").mapSilent + +local M = {} + +-- For some reason the default mappings do not work for me +function M.setup() + vim.g.tmux_navigator_no_mappings = 1 + + map("", "", ":TmuxNavigateLeft") + map("", "", ":TmuxNavigateDown") + map("", "", ":TmuxNavigateUp") + map("", "", ":TmuxNavigateRight") +end + +return M diff --git a/dotfiles/neovim/lua/telescope/extensions/unicode.lua b/dotfiles/neovim/lua/telescope/extensions/unicode.lua new file mode 100644 index 0000000..4fe3b8c --- /dev/null +++ b/dotfiles/neovim/lua/telescope/extensions/unicode.lua @@ -0,0 +1,80 @@ +local M = {} +local pickers = require "telescope.pickers" +local finders = require "telescope.finders" +local conf = require("telescope.config").values +local actions = require "telescope.actions" +local action_state = require "telescope.actions.state" +local previewers = require "telescope.previewers" +local utils = require "telescope.utils" + +local add_abbreviations = false + +local unicodeChars = { + nats = "ℕ", + rationals = "ℚ", + reals = "ℝ", + integers = "ℤ", + forall = "∀", + lambda = "λ", + arrow = "→", + compose = "∘", + inverse = "⁻¹", + dots = "…" +} + +-- our picker function for unicode chars +function M.picker(opts) + opts = opts or {} + local results = {} + + for key, value in pairs(unicodeChars) do + -- Name: char pair + table.insert(results, {key, value}) + end + + print(results) + + pickers.new(opts, { + prompt_title = "Unicode characters", + finder = finders.new_table { + results = results, + entry_maker = function(entry) + return {value = entry, display = entry[1], ordinal = entry[1]} + end + }, + sorter = conf.generic_sorter(opts), + previewer = previewers.new { + preview_fn = function(_, entry) return entry.value[2] end + }, + attach_mappings = function(prompt_bufnr) + actions.select_default:replace(function() + actions.close(prompt_bufnr) + local selection = action_state.get_selected_entry() + + if selection == nil then + utils.__warn_no_selection "builtin.planets" + return + end + + vim.api.nvim_put({selection.value[2]}, "", false, true) + vim.cmd("startinsert") + end) + return true + end + }):find() +end + +function M.setupAbbreviations(ending) + ending = ending or "" + + if not add_abbreviations then return end + + local abbreviate = require("my.abbreviations").abbr + + for key, value in pairs(unicodeChars) do + -- By default abbreviations are triggered using "_" + abbreviate(key .. ending, value) + end +end + +return M diff --git a/dotfiles/tmux/tmux.conf b/dotfiles/tmux/tmux.conf index 5fe8340..79bcfba 100644 --- a/dotfiles/tmux/tmux.conf +++ b/dotfiles/tmux/tmux.conf @@ -19,12 +19,6 @@ unbind % unbind C-z bind -n C-z resize-pane -Z -# Vim-like keybinds for switching between panes -bind -n C-h select-pane -L -bind -n C-l select-pane -R -bind -n C-k select-pane -U -bind -n C-j select-pane -D - # Vim-mode set-window-option -g mode-keys vi diff --git a/flake.lock b/flake.lock index ad9eced..2b1a675 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,85 @@ { "nodes": { + "Prettier": { + "flake": false, + "locked": { + "lastModified": 1639310097, + "narHash": "sha256-+eSLEJDuy2ZRkh1h0Y5IF6RUeHEcWhAHpWhwdwW65f0=", + "owner": "Z-snails", + "repo": "prettier", + "rev": "4a90663b1d586f6d6fce25873aa0f0d7bc633b89", + "type": "github" + }, + "original": { + "owner": "Z-snails", + "repo": "prettier", + "type": "github" + } + }, + "collie": { + "flake": false, + "locked": { + "lastModified": 1631011321, + "narHash": "sha256-goYctB+WBoLgsbjA0DlqGjD8i9wr1K0lv0agqpuwflU=", + "owner": "ohad", + "repo": "collie", + "rev": "ed2eda5e04fbd02a7728e915d396e14cc7ec298e", + "type": "github" + }, + "original": { + "owner": "ohad", + "repo": "collie", + "type": "github" + } + }, + "comonad": { + "flake": false, + "locked": { + "lastModified": 1638093386, + "narHash": "sha256-kxmN6XuszFLK2i76C6LSGHe5XxAURFu9NpzJbi3nodk=", + "owner": "stefan-hoeck", + "repo": "idris2-comonad", + "rev": "06d6b551db20f1f940eb24c1dae051c957de97ad", + "type": "github" + }, + "original": { + "owner": "stefan-hoeck", + "repo": "idris2-comonad", + "type": "github" + } + }, + "dom": { + "flake": false, + "locked": { + "lastModified": 1639041519, + "narHash": "sha256-4ZYc0qaUEVARxhWuH3JgejIeT+GEDNxdS6zIGhBCk34=", + "owner": "stefan-hoeck", + "repo": "idris2-dom", + "rev": "01ab52d0ffdb3b47481413a949b8f0c0688c97e4", + "type": "github" + }, + "original": { + "owner": "stefan-hoeck", + "repo": "idris2-dom", + "type": "github" + } + }, + "dot-parse": { + "flake": false, + "locked": { + "lastModified": 1638264571, + "narHash": "sha256-VJQITz+vuQgl5HwR5QdUGwN8SRtGcb2/lJaAVfFbiSk=", + "owner": "CodingCellist", + "repo": "idris2-dot-parse", + "rev": "48fbda8bf8adbaf9e8ebd6ea740228e4394154d9", + "type": "github" + }, + "original": { + "owner": "CodingCellist", + "repo": "idris2-dot-parse", + "type": "github" + } + }, "easy-dhall-nix": { "flake": false, "locked": { @@ -32,6 +112,38 @@ "type": "github" } }, + "effect": { + "flake": false, + "locked": { + "lastModified": 1637477153, + "narHash": "sha256-Ta2Vogg/IiSBkfhhD57jjPTEf3S4DOiVRmof38hmwlM=", + "owner": "russoul", + "repo": "idris2-effect", + "rev": "ea1daf53b2d7e52f9917409f5653adc557f0ee1a", + "type": "github" + }, + "original": { + "owner": "russoul", + "repo": "idris2-effect", + "type": "github" + } + }, + "elab-util": { + "flake": false, + "locked": { + "lastModified": 1639041013, + "narHash": "sha256-K61s/xifFiTDXJTak5NZmZL6757CTYCY+TGywRZMD7M=", + "owner": "stefan-hoeck", + "repo": "idris2-elab-util", + "rev": "7a381c7c5dc3adb7b97c8b8be17e4fb4cc63027d", + "type": "github" + }, + "original": { + "owner": "stefan-hoeck", + "repo": "idris2-elab-util", + "type": "github" + } + }, "fish-plugin-z": { "flake": false, "locked": { @@ -129,6 +241,21 @@ } }, "flake-utils": { + "locked": { + "lastModified": 1638122382, + "narHash": "sha256-sQzZzAbvKEqN9s0bzWuYmRaA03v40gaJ4+iL1LXjaeI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "74f7e4319258e287b0f9cb95426c9853b282730b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_2": { "locked": { "lastModified": 1644229661, "narHash": "sha256-1YdnJAsNy69bpcjuoKdOYQX0YxZBiCYZo4Twxerqv7k=", @@ -143,7 +270,22 @@ "type": "github" } }, - "flake-utils_2": { + "flake-utils_3": { + "locked": { + "lastModified": 1644229661, + "narHash": "sha256-1YdnJAsNy69bpcjuoKdOYQX0YxZBiCYZo4Twxerqv7k=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "3cecb5b042f7f209c56ffd8371b2711a290ec797", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_4": { "locked": { "lastModified": 1638122382, "narHash": "sha256-sQzZzAbvKEqN9s0bzWuYmRaA03v40gaJ4+iL1LXjaeI=", @@ -158,6 +300,38 @@ "type": "github" } }, + "frex": { + "flake": false, + "locked": { + "lastModified": 1637410704, + "narHash": "sha256-BthU1t++n0ZvS76p0fCHsE33QSoXYxf0hMUSKajDY8w=", + "owner": "frex-project", + "repo": "idris-frex", + "rev": "22c480e879c757a5cebca7bb555ec3d21ae3ac28", + "type": "github" + }, + "original": { + "owner": "frex-project", + "repo": "idris-frex", + "type": "github" + } + }, + "fvect": { + "flake": false, + "locked": { + "lastModified": 1633247988, + "narHash": "sha256-zElIze03XpcrYL4H5Aj0ZGNplJGbtOx+iWnivJMzHm0=", + "owner": "mattpolzin", + "repo": "idris-fvect", + "rev": "1c5e3761e0cd83e711a3535ef9051bea45e6db3f", + "type": "github" + }, + "original": { + "owner": "mattpolzin", + "repo": "idris-fvect", + "type": "github" + } + }, "githubNvimTheme": { "flake": false, "locked": { @@ -174,6 +348,38 @@ "type": "github" } }, + "hashable": { + "flake": false, + "locked": { + "lastModified": 1633965157, + "narHash": "sha256-Dggf5K//RCZ7uvtCyeiLNJS6mm+8/n0RFW3zAc7XqPg=", + "owner": "z-snails", + "repo": "idris2-hashable", + "rev": "d6fec8c878057909b67f3d4da334155de4f37907", + "type": "github" + }, + "original": { + "owner": "z-snails", + "repo": "idris2-hashable", + "type": "github" + } + }, + "hedgehog": { + "flake": false, + "locked": { + "lastModified": 1639041435, + "narHash": "sha256-893cPy7gGSQpVmm9co3QCpWsgjukafZHy8YFk9xts30=", + "owner": "stefan-hoeck", + "repo": "idris2-hedgehog", + "rev": "a66b1eb0bf84c4a7b743cfb217be69866bc49ad8", + "type": "github" + }, + "original": { + "owner": "stefan-hoeck", + "repo": "idris2-hedgehog", + "type": "github" + } + }, "home-manager": { "inputs": { "nixpkgs": [ @@ -194,9 +400,227 @@ "type": "github" } }, + "idrall": { + "flake": false, + "locked": { + "lastModified": 1636495701, + "narHash": "sha256-aOdCRd4XsSxwqVGta1adlZBy8TVTxTwFDnJ1dyMZK8M=", + "owner": "alexhumphreys", + "repo": "idrall", + "rev": "13ef174290169d05c9e9abcd77c53412e3e0c944", + "type": "github" + }, + "original": { + "owner": "alexhumphreys", + "ref": "13ef174", + "repo": "idrall", + "type": "github" + } + }, + "idris-server": { + "flake": false, + "locked": { + "lastModified": 1634507315, + "narHash": "sha256-ulo23yLJXsvImoMB/1C6yRRTqmn/Odo+aUaVi+tUhJo=", + "owner": "avidela", + "repo": "idris-server", + "rev": "661a4ecf0fadaa2bd79c8e922c2d4f79b0b7a445", + "type": "gitlab" + }, + "original": { + "owner": "avidela", + "repo": "idris-server", + "type": "gitlab" + } + }, + "idris2": { + "flake": false, + "locked": { + "lastModified": 1639427352, + "narHash": "sha256-C1K2FM1Kio8vi9FTrivdacYCX4cywIsLBeNCsZ6ft4g=", + "owner": "idris-lang", + "repo": "idris2", + "rev": "36918e618646177b1e0c2fd01f21cc8d04d9da30", + "type": "github" + }, + "original": { + "owner": "idris-lang", + "repo": "idris2", + "type": "github" + } + }, + "idris2-pkgs": { + "inputs": { + "Prettier": "Prettier", + "collie": "collie", + "comonad": "comonad", + "dom": "dom", + "dot-parse": "dot-parse", + "effect": "effect", + "elab-util": "elab-util", + "flake-utils": "flake-utils", + "frex": "frex", + "fvect": "fvect", + "hashable": "hashable", + "hedgehog": "hedgehog", + "idrall": "idrall", + "idris-server": "idris-server", + "idris2": "idris2", + "indexed": "indexed", + "inigo": "inigo", + "ipkg-to-json": "ipkg-to-json", + "json": "json", + "katla": "katla", + "lsp": "lsp", + "nixpkgs": [ + "nixpkgs" + ], + "odf": "odf", + "pretty-show": "pretty-show", + "python": "python", + "rhone": "rhone", + "rhone-js": "rhone-js", + "snocvect": "snocvect", + "sop": "sop", + "tailrec": "tailrec", + "xml": "xml" + }, + "locked": { + "lastModified": 1642030375, + "narHash": "sha256-J1uXnpPR72mjFjLBuYcvDHStBxVya6/MjBNNwqxGeD0=", + "owner": "claymager", + "repo": "idris2-pkgs", + "rev": "ac33a49d4d4bd2b50fddb040cd889733a02c8f09", + "type": "github" + }, + "original": { + "owner": "claymager", + "repo": "idris2-pkgs", + "type": "github" + } + }, + "indexed": { + "flake": false, + "locked": { + "lastModified": 1638685238, + "narHash": "sha256-FceB7o88yKYzjTfRC6yfhOL6oDPMmCQAsJZu/pjE2uA=", + "owner": "mattpolzin", + "repo": "idris-indexed", + "rev": "ff3ba99b0063da6a74c96178e7f3c58a4ac1693e", + "type": "github" + }, + "original": { + "owner": "mattpolzin", + "repo": "idris-indexed", + "type": "github" + } + }, + "inigo": { + "flake": false, + "locked": { + "lastModified": 1637596767, + "narHash": "sha256-LNx30LO0YWDVSPTxRLWGTFL4f3d5ANG6c60WPdmiYdY=", + "owner": "idris-community", + "repo": "Inigo", + "rev": "57f5b5c051222d8c630010a0a3cf7d7138910127", + "type": "github" + }, + "original": { + "owner": "idris-community", + "repo": "Inigo", + "type": "github" + } + }, + "ipkg-to-json": { + "flake": false, + "locked": { + "lastModified": 1634937414, + "narHash": "sha256-LhSmWRpI7vyIQE7QTo38ZTjlqYPVSvV/DIpIxzPmqS0=", + "owner": "claymager", + "repo": "ipkg-to-json", + "rev": "2969b6b83714eeddc31e41577a565778ee5922e6", + "type": "github" + }, + "original": { + "owner": "claymager", + "repo": "ipkg-to-json", + "type": "github" + } + }, + "json": { + "flake": false, + "locked": { + "lastModified": 1639041459, + "narHash": "sha256-TP/V1jBBP1hFPm/cJ5O2EJiaNoZ19KvBOAI0S9lvAR4=", + "owner": "stefan-hoeck", + "repo": "idris2-json", + "rev": "7c0c028acad0ba0b63b37b92199f37e6ec73864a", + "type": "github" + }, + "original": { + "owner": "stefan-hoeck", + "repo": "idris2-json", + "type": "github" + } + }, + "katla": { + "flake": false, + "locked": { + "lastModified": 1636542431, + "narHash": "sha256-X83NA/P3k1iPcBa8g5z8JldEmFEz/jxVeViJX0/FikY=", + "owner": "idris-community", + "repo": "katla", + "rev": "d841ec243f96b4762074211ee81033e28884c858", + "type": "github" + }, + "original": { + "owner": "idris-community", + "repo": "katla", + "type": "github" + } + }, + "kmonad": { + "inputs": { + "flake-utils": "flake-utils_2", + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "dir": "nix", + "lastModified": 1647852712, + "narHash": "sha256-glteo+r5qz/O9BirpK/ziigpYbGjZIY5UFuxsADC4qY=", + "owner": "kmonad", + "repo": "kmonad", + "rev": "65b501defdd0049563752f8af8c8c57f5a1ae38b", + "type": "github" + }, + "original": { + "dir": "nix", + "owner": "kmonad", + "repo": "kmonad", + "type": "github" + } + }, + "lsp": { + "flake": false, + "locked": { + "lastModified": 1639486283, + "narHash": "sha256-po396FnUu8iqiipwPxqpFZEU4rtpX3jnt3cySwjLsH8=", + "owner": "idris-community", + "repo": "idris2-lsp", + "rev": "7ebb6caf6bb4b57c5107579aba2b871408e6f183", + "type": "github" + }, + "original": { + "owner": "idris-community", + "repo": "idris2-lsp", + "type": "github" + } + }, "neovim-flake": { "inputs": { - "flake-utils": "flake-utils", + "flake-utils": "flake-utils_3", "nixpkgs": [ "neovim-nightly-overlay", "nixpkgs" @@ -304,6 +728,54 @@ "type": "github" } }, + "nvim-plugin-agda": { + "flake": false, + "locked": { + "lastModified": 1642289590, + "narHash": "sha256-c7UjrVbfaagIJS7iGdjWiFlpLUDHGc0I3ZGoUPECL00=", + "owner": "isti115", + "repo": "agda.nvim", + "rev": "c7da627547e978b4ac3780af1b8f418c8b12ff98", + "type": "github" + }, + "original": { + "owner": "isti115", + "repo": "agda.nvim", + "type": "github" + } + }, + "nvim-plugin-idris2": { + "flake": false, + "locked": { + "lastModified": 1645883550, + "narHash": "sha256-paIQIUdEOHkJaKWf7TS523VFBmRtmnguM0+gM7Sm9vg=", + "owner": "ShinKage", + "repo": "idris2-nvim", + "rev": "011b932079cd10e674821020b36e717998c1d3d3", + "type": "github" + }, + "original": { + "owner": "ShinKage", + "repo": "idris2-nvim", + "type": "github" + } + }, + "odf": { + "flake": false, + "locked": { + "lastModified": 1638184051, + "narHash": "sha256-usSdPx+UqOGImHHdHcrytdzi2LXtIRZuUW0fkD/Wwnk=", + "owner": "madman-bob", + "repo": "idris2-odf", + "rev": "d2f532437321c8336f1ca786b44b6ebef4117126", + "type": "github" + }, + "original": { + "owner": "madman-bob", + "repo": "idris2-odf", + "type": "github" + } + }, "oh-my-fish": { "flake": false, "locked": { @@ -320,6 +792,70 @@ "type": "github" } }, + "pretty-show": { + "flake": false, + "locked": { + "lastModified": 1639041411, + "narHash": "sha256-BzEe1fpX+lqGEk8b1JZoQT1db5I7s7SZnLCttRVGXdY=", + "owner": "stefan-hoeck", + "repo": "idris2-pretty-show", + "rev": "a4bc6156b9dac43699f87504cbdb8dada5627863", + "type": "github" + }, + "original": { + "owner": "stefan-hoeck", + "repo": "idris2-pretty-show", + "type": "github" + } + }, + "python": { + "flake": false, + "locked": { + "lastModified": 1635936936, + "narHash": "sha256-c9mcMApN0qgu0AXQVu0V+NXt2poP258wCPkyvtQvv4I=", + "owner": "madman-bob", + "repo": "idris2-python", + "rev": "0eab028933c65bebe744e879881416f5136d6943", + "type": "github" + }, + "original": { + "owner": "madman-bob", + "repo": "idris2-python", + "type": "github" + } + }, + "rhone": { + "flake": false, + "locked": { + "lastModified": 1639041532, + "narHash": "sha256-2g43shlWQIT/1ogesUBUBV9N8YiD3RwaCbbhdKLVp1s=", + "owner": "stefan-hoeck", + "repo": "idris2-rhone", + "rev": "c4d828b0b8efea495d9a5f1e842a9c67cad57724", + "type": "github" + }, + "original": { + "owner": "stefan-hoeck", + "repo": "idris2-rhone", + "type": "github" + } + }, + "rhone-js": { + "flake": false, + "locked": { + "lastModified": 1639041546, + "narHash": "sha256-ddWVsSRbfA6ghmwiRMzDpHBPM+esGdutuqm1qQZgs88=", + "owner": "stefan-hoeck", + "repo": "idris2-rhone-js", + "rev": "520dd59549f5b14075045314b6805c7492ed636e", + "type": "github" + }, + "original": { + "owner": "stefan-hoeck", + "repo": "idris2-rhone-js", + "type": "github" + } + }, "root": { "inputs": { "easy-dhall-nix": "easy-dhall-nix", @@ -330,15 +866,20 @@ "fish-theme-harleen": "fish-theme-harleen", "githubNvimTheme": "githubNvimTheme", "home-manager": "home-manager", + "idris2-pkgs": "idris2-pkgs", + "kmonad": "kmonad", "neovim-nightly-overlay": "neovim-nightly-overlay", "nixos-unstable": "nixos-unstable", "nixpkgs": "nixpkgs", "nixpkgs-unstable": "nixpkgs-unstable", + "nvim-plugin-agda": "nvim-plugin-agda", + "nvim-plugin-idris2": "nvim-plugin-idris2", "oh-my-fish": "oh-my-fish", "sddm-theme-chili": "sddm-theme-chili", "telescope-file-browser-nvim": "telescope-file-browser-nvim", "vim-extra-plugins": "vim-extra-plugins", - "vim-plugin-arpeggio": "vim-plugin-arpeggio" + "vim-plugin-arpeggio": "vim-plugin-arpeggio", + "vim-plugin-kmonad": "vim-plugin-kmonad" } }, "sddm-theme-chili": { @@ -357,6 +898,54 @@ "type": "github" } }, + "snocvect": { + "flake": false, + "locked": { + "lastModified": 1641633224, + "narHash": "sha256-6zTU4sDzd/R/dFCTNZaX41H4L3/USGLFghMS0Oc9liY=", + "owner": "mattpolzin", + "repo": "idris-snocvect", + "rev": "ff1e7afba360a62f7e522e9bbb856096a79702c4", + "type": "github" + }, + "original": { + "owner": "mattpolzin", + "repo": "idris-snocvect", + "type": "github" + } + }, + "sop": { + "flake": false, + "locked": { + "lastModified": 1639041379, + "narHash": "sha256-PDTf1Wx6EygiWszguvoVPiqIISYFLabI4e0lXHlrjcA=", + "owner": "stefan-hoeck", + "repo": "idris2-sop", + "rev": "e4354d1883cd73616019457cb9ebf864d99df6a0", + "type": "github" + }, + "original": { + "owner": "stefan-hoeck", + "repo": "idris2-sop", + "type": "github" + } + }, + "tailrec": { + "flake": false, + "locked": { + "lastModified": 1637146655, + "narHash": "sha256-0yi7MQIrISPvAwkgDC1M5PHDEeVyIaISF0HjKDaT0Rw=", + "owner": "stefan-hoeck", + "repo": "idris2-tailrec", + "rev": "dd0bc6381b3a2e69aa37f9a8c1b165d4b1516ad7", + "type": "github" + }, + "original": { + "owner": "stefan-hoeck", + "repo": "idris2-tailrec", + "type": "github" + } + }, "telescope-file-browser-nvim": { "flake": false, "locked": { @@ -376,7 +965,7 @@ "vim-extra-plugins": { "inputs": { "flake-compat": "flake-compat_2", - "flake-utils": "flake-utils_2", + "flake-utils": "flake-utils_4", "nixpkgs": "nixpkgs_2" }, "locked": { @@ -408,6 +997,38 @@ "repo": "vim-arpeggio", "type": "github" } + }, + "vim-plugin-kmonad": { + "flake": false, + "locked": { + "lastModified": 1647812451, + "narHash": "sha256-7PKVOsb3jvuGEnP/LsrDr96wFSQMou2dgnV+hRaI444=", + "owner": "kmonad", + "repo": "kmonad-vim", + "rev": "37978445197ab00edeb5b731e9ca90c2b141723f", + "type": "github" + }, + "original": { + "owner": "kmonad", + "repo": "kmonad-vim", + "type": "github" + } + }, + "xml": { + "flake": false, + "locked": { + "lastModified": 1637939752, + "narHash": "sha256-yYJBhPfwYoi7amlHmeNGrVCOAc3BjZpKTCd9wDs3XEM=", + "owner": "madman-bob", + "repo": "idris2-xml", + "rev": "1292ccfcd58c551089ef699e4560343d5c473d64", + "type": "github" + }, + "original": { + "owner": "madman-bob", + "repo": "idris2-xml", + "type": "github" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index ecf0ed0..342f05e 100644 --- a/flake.nix +++ b/flake.nix @@ -6,9 +6,21 @@ nixos-unstable.url = "github:nixos/nixpkgs/nixos-unstable"; nixpkgs-unstable.url = "github:nixos/nixpkgs/nixpkgs-unstable"; - home-manager.url = "github:nix-community/home-manager"; - home-manager.inputs.nixpkgs.follows = "nixpkgs"; + home-manager = { + url = "github:nix-community/home-manager"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + # keyboard layout configuration + kmonad = { + url = "github:kmonad/kmonad?dir=nix"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + + idris2-pkgs = { + url = "github:claymager/idris2-pkgs"; + inputs.nixpkgs.follows = "nixpkgs"; + }; #### Nvim stuff neovim-nightly-overlay = { @@ -24,6 +36,21 @@ flake = false; }; + vim-plugin-kmonad = { + url = "github:kmonad/kmonad-vim"; + flake = false; + }; + + nvim-plugin-agda = { + url = "github:isti115/agda.nvim"; + flake = false; + }; + + nvim-plugin-idris2 = { + url = "github:ShinKage/idris2-nvim"; + flake = false; + }; + # Create / delete files within telescope telescope-file-browser-nvim = { url = "github:nvim-telescope/telescope-file-browser.nvim"; @@ -80,7 +107,7 @@ }; }; - outputs = inputs@{ self, nixpkgs, home-manager, ... }: + outputs = inputs@{ self, nixpkgs, ... }: let system = "x86_64-linux"; provideInputs = @@ -91,6 +118,7 @@ nixpkgs.overlays = [ inputs.vim-extra-plugins.overlay inputs.neovim-nightly-overlay.overlay + inputs.idris2-pkgs.overlay provideInputs ]; }; @@ -100,7 +128,8 @@ inherit system; modules = [ - home-manager.nixosModules.home-manager + inputs.home-manager.nixosModules.home-manager + inputs.kmonad.nixosModule overlays ./hardware/laptop.nix ./configuration.nix diff --git a/modules/applications/default.nix b/modules/applications/default.nix index 70b2082..29f0f35 100644 --- a/modules/applications/default.nix +++ b/modules/applications/default.nix @@ -4,7 +4,7 @@ ./shells # ./wakatime ./xmonad - ./xmodmap + # ./xmodmap # ./wine.nix ./kdeconnect.nix @@ -18,6 +18,7 @@ ./postgres.nix ./neovim.nix ./tmux.nix + ./kmonad.nix ]; } diff --git a/modules/applications/kmonad.nix b/modules/applications/kmonad.nix new file mode 100644 index 0000000..1f159f9 --- /dev/null +++ b/modules/applications/kmonad.nix @@ -0,0 +1,22 @@ +{ pkgs, ... }: +let kmonadRoot = ../../dotfiles/kmonad; in +{ + users.extraUsers.adrielus.extraGroups = [ "input" "uinput" ]; + + services = { + kmonad = { + enable = true; + configfiles = [ (kmonadRoot + "/keymap.kbd") ]; + }; + + xserver = { + xkbOptions = "compose:ralt"; + layout = "us"; + }; + + }; + + home-manager.users.adrielus = { + home.file.".XCompose".source = kmonadRoot + "/xcompose"; + }; +} diff --git a/modules/applications/locale.nix b/modules/applications/locale.nix index a0afb99..8029565 100644 --- a/modules/applications/locale.nix +++ b/modules/applications/locale.nix @@ -2,8 +2,13 @@ i18n.defaultLocale = "en_US.UTF-8"; time.timeZone = "Europe/Bucharest"; + i18n.inputMethod = { + enabled = "ibus"; + # ibus.engines = with pkgs.ibus-engines; [ /* any engine you want, for example */ anthy ]; + }; + console = { keyMap = "us"; - font = "Lat2-Terminus16"; + font = "SourceCodePro"; }; } diff --git a/modules/applications/misc.nix b/modules/applications/misc.nix index 3022050..bb9f2bc 100644 --- a/modules/applications/misc.nix +++ b/modules/applications/misc.nix @@ -29,6 +29,7 @@ zathura cmake # kdeconnect + sloc # line of code counter # editors # vscodium @@ -64,7 +65,7 @@ # blueman # bluetooth manager # freesweep # minesweeper I can play w the keyboard. # multimc - sloc # line of code counter + lmms # music software # Nes emulators and stuff # zsnes diff --git a/modules/applications/neovim.nix b/modules/applications/neovim.nix index 62082e2..4202897 100644 --- a/modules/applications/neovim.nix +++ b/modules/applications/neovim.nix @@ -34,10 +34,12 @@ in extraPackages = with pkgs; [ # Language servers + # haskellPackages.agda-language-server # agda nodePackages.typescript-language-server # typescript easy-purescript-nix.purescript-language-server # purescript + idris2 # idris2 lang + idris2-pkgs.lsp # idris2 sumneko-lua-language-server # lua - efm-langserver # auto-formatting rnix-lsp # nix # Formatters @@ -77,6 +79,14 @@ in vim-tmux-navigator # easly switch between tmux and vim panes arpeggio # allows me to setup chord keybinds (keybinds where all the keys are pressed at the same time) presence-nvim # discord rich presence + agda-nvim # agda support + unicode-vim # better unicode support + nui-nvim # ui lib required by idris plugin + idris2-nvim # idris2 support + lean-nvim # lean support + kmonad-vim # support for the kmonad config language + lh-vim-lib # dependency for lh-brackets + lh-brackets # bracket customization # Cmp related stuff. See https://github.com/hrsh7th/nvim-cmp cmp-nvim-lsp diff --git a/modules/applications/tmux.nix b/modules/applications/tmux.nix index 92081ff..fe60804 100644 --- a/modules/applications/tmux.nix +++ b/modules/applications/tmux.nix @@ -5,7 +5,7 @@ in { home-manager.users.adrielus.programs = { # Add tmux-navigator plugin to neovim - neovim.extraPackages = [ pkgs.vimPlugins.vim-tmux-navigator ]; + # neovim.extraPackages = [ pkgs.vimPlugins.vim-tmux-navigator ]; tmux = { enable = true; diff --git a/modules/applications/xmodmap/.Xmodmap b/modules/applications/xmodmap/.Xmodmap index 0ab19eb..20807b2 100644 --- a/modules/applications/xmodmap/.Xmodmap +++ b/modules/applications/xmodmap/.Xmodmap @@ -1,5 +1,8 @@ ! Remap caps lock to control -clear lock -clear control -add control = Caps_Lock Control_L Control_R -keycode 66 = Control_L Caps_Lock NoSymbol NoSymbol \ No newline at end of file +clear Lock +! clear control +! add control = Caps_Lock Control_L Control_R +! New way of hitting caps lock +keycode 66 = Control_L Caps_Lock NoSymbol NoSymbol +keycode 0x42 = backslash + diff --git a/modules/dev/agda.nix b/modules/dev/agda.nix new file mode 100644 index 0000000..b626b84 --- /dev/null +++ b/modules/dev/agda.nix @@ -0,0 +1,3 @@ +{ pkgs, ... }: { + home-manager.users.adrielus.home.packages = [ pkgs.agda ]; +} diff --git a/modules/dev/default.nix b/modules/dev/default.nix index 762b277..1655665 100644 --- a/modules/dev/default.nix +++ b/modules/dev/default.nix @@ -4,12 +4,16 @@ ./nix.nix ./purescript.nix ./javascript.nix - ./fsharp.nix ./rust.nix - # ./idris.nix - # ./racket.nix - # ./elm.nix ./dhall.nix ./haskell + ./fsharp.nix + # ./racket.nix + # ./elm.nix + + # Proof assistants + ./agda.nix + ./idris.nix + ./lean.nix ]; } diff --git a/modules/dev/idris.nix b/modules/dev/idris.nix index 47798cd..81e7e61 100644 --- a/modules/dev/idris.nix +++ b/modules/dev/idris.nix @@ -1,3 +1,6 @@ { pkgs, ... }: { - home-manager.users.adrielus.home.packages = with pkgs; [ idris2 ]; + home-manager.users.adrielus.home.packages = with pkgs; [ + idris2 + idris2-pkgs.lsp # idris2 + ]; } diff --git a/modules/dev/lean.nix b/modules/dev/lean.nix new file mode 100644 index 0000000..84d6fd8 --- /dev/null +++ b/modules/dev/lean.nix @@ -0,0 +1,5 @@ +{ pkgs, ... }: { + home-manager.users.adrielus.home.packages = with pkgs; [ + elan # lean version manager + ]; +} diff --git a/modules/nix.nix b/modules/nix.nix index 7a81f9f..7cdafc4 100644 --- a/modules/nix.nix +++ b/modules/nix.nix @@ -2,18 +2,27 @@ nix = { trustedUsers = [ "root" "adrielus" "@wheel" ]; autoOptimiseStore = true; - gc.automatic = true; optimise.automatic = true; - binaryCaches = [ "https://cache.nixos.org" "https://all-hies.cachix.org" ]; - binaryCachePublicKeys = [ - "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=" - "all-hies.cachix.org-1:JjrzAOEUsD9ZMt8fdFbzo3jNAyEWlPAwdVuHw4RD43k=" - ]; + gc.automatic = false; # Emanble nix flakes package = pkgs.nixFlakes; extraOptions = '' experimental-features = nix-command flakes ''; + + # Caching and whatnot + binaryCaches = [ + "https://nix-community.cachix.org" + "https://cm-idris2-pkgs.cachix.org" + "https://cache.nixos.org" + "https://all-hies.cachix.org" # Do I even use all-hies anymore? + ]; + + binaryCachePublicKeys = [ + "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" + "cm-idris2-pkgs.cachix.org-1:YB2oJSEsD5oMJjAESxolC2GQtE6B5I6jkWhte2gtXjk=" + "all-hies.cachix.org-1:JjrzAOEUsD9ZMt8fdFbzo3jNAyEWlPAwdVuHw4RD43k=" + ]; }; } diff --git a/modules/overlays/flakes.nix b/modules/overlays/flakes.nix index 8acb35d..d45272a 100644 --- a/modules/overlays/flakes.nix +++ b/modules/overlays/flakes.nix @@ -1,18 +1,33 @@ { system }: { home-manager + + # nixos stuff , nixpkgs , nixpkgs-unstable , nixos-unstable + + # easy-* , easy-purescript-nix , easy-dhall-nix + + # fish plugins , fish-plugin-z , fish-theme-harleen , fish-theme-agnoster , fish-theme-dangerous + , oh-my-fish , githubNvimTheme + + # vim plugins , vim-plugin-arpeggio -, telescope-file-browser-nvim +, vim-plugin-kmonad + + # nvim plugins +, nvim-plugin-agda +, nvim-plugin-idris2 + +, telescope-file-browser-nvim # TODO: rename this one , sddm-theme-chili , ... }: self: super: @@ -63,10 +78,11 @@ in myVimPlugins = { githubNvimTheme = githubNvimTheme; - telescope-file-browser-nvim = - plugin "file_browser" telescope-file-browser-nvim; - + telescope-file-browser-nvim = plugin "file_browser" telescope-file-browser-nvim; + agda-nvim = plugin "agda" nvim-plugin-agda; + idris2-nvim = plugin "idris" nvim-plugin-idris2; arpeggio = plugin "arpeggio" vim-plugin-arpeggio; + kmonad-vim = plugin "kmonad-vim" vim-plugin-kmonad; }; sddm-theme-chili = sddm-theme-chili; diff --git a/modules/themes/themes.nix b/modules/themes/themes.nix index 2ce3fd4..e4a1af0 100644 --- a/modules/themes/themes.nix +++ b/modules/themes/themes.nix @@ -10,7 +10,7 @@ lib.lists.map (theme: pkgs.callPackage theme { }) [ }) (githubVariant { variant = "dark"; - wallpaper = ./wallpapers/spaceship.jpg; + wallpaper = ./wallpapers/synthwave.jpg; transparency = 0.8; }) ] diff --git a/modules/users.nix b/modules/users.nix index 73d90a1..a365563 100644 --- a/modules/users.nix +++ b/modules/users.nix @@ -1,5 +1,26 @@ { pkgs, ... }: with import ../secrets.nix; { + # options = { + # myUser = { + # type = lib.types.string; + # default = ""; + # }; + # }; + + # config = { + # myUser = "adrielus"; + + # Disable asking for password for sudo + security.sudo.extraRules = [ + { + users = [ "adrielus" ]; + commands = [{ + command = "ALL"; + options = [ "SETENV" "NOPASSWD" ]; + }]; + } + ]; + users = { mutableUsers = false; users.adrielus = { @@ -10,4 +31,5 @@ with import ../secrets.nix; { shell = pkgs.fish; }; }; + # }; } diff --git a/rebuild.sh b/rebuild.sh new file mode 100644 index 0000000..45d4aec --- /dev/null +++ b/rebuild.sh @@ -0,0 +1,2 @@ +# TODO: run tests and only rebuild on success + diff --git a/test.sh b/test.sh new file mode 100755 index 0000000..2c6386a --- /dev/null +++ b/test.sh @@ -0,0 +1,3 @@ +# Test kmonad config +echo "Testing kmonad..." +./dotfiles/kmonad/test.sh