commit ccff3036c334769257cd04478b3d2401d6084b7d Author: xenia Date: Thu Oct 12 22:51:18 2023 +0200 configure home diff --git a/alacritty/alacritty.nix b/alacritty/alacritty.nix new file mode 100644 index 00000000..1355cefc --- /dev/null +++ b/alacritty/alacritty.nix @@ -0,0 +1,154 @@ +pkgs@{stdenv, ...}: +let + tmux-menu = with pkgs; writeScript "tmux-menu" " +export LC_ALL='en_US.UTF-8' +export LC_CTYPE='UTF-8' + +SESSIONS=$(tmux ls) +SESSIONS=\"$ emacsclient +$ rink +$SESSIONS +Connect to coral.shoes (tmux) +Connect to coral.shoes (raw) +New session +Raw shell\" + +CHOICE_LINE=$(echo \"$SESSIONS\" | fzf -1) || exit +CHOICE=$(echo \"$CHOICE_LINE\" | cut -d: -f1) +case $CHOICE in + '$ rink') + ${rink}/bin/rink + ;; + '$ emacsclient') + ${emacs}/bin/emacsclient -n --create-frame -e '(x-focus-frame (selected-frame))' --alternate-editor= + ;; + 'Connect to coral.shoes (tmux)') + ${mosh}/bin/mosh web -- tmux attach + ;; + 'Connect to coral.shoes (raw)') + ${mosh}/bin/mosh web + ;; + 'Raw shell') + ${zsh}/bin/zsh + ;; + 'New session') + echo 'Name? ' ; read NAME + ${tmux}/bin/tmux new -s \"$NAME\" ${zsh}/bin/zsh + ;; + *) + ${tmux}/bin/tmux attach-session -t \"$CHOICE\" + ;; +esac"; + + base-cfg = { + window = { + padding.x = 0; + padding.y = 0; + decorations = if stdenv.isDarwin then "Buttonless" else "Full"; + startup_mode = "Windowed"; + }; + mouse.hide_when_typing = true; + font = { + normal.family = "SAX2"; + size = 15; + }; + colors.primary = { + background = "#282828"; + foreground = "#ebdbb2"; + }; + + shell.program = "${pkgs.zsh}/bin/zsh"; + shell.args = [ "--login" "-c" "${tmux-menu}" ]; + + key_bindings = import ./keybinds.nix { bind-broken-mac-keybinds = stdenv.isDarwin; }; + }; + + alt-patch-package = pkgs.fetchgit { + url = "https://github.com/loovjo/alacritty-modifiers-patch"; + rev = "36ac4031248ba132f280017bfd8bf0a32e214f9d"; + hash = "sha256-to5Tq64w8Tvt+KHjiKga3B31XC5TT/4kMR1zqp9A3AI="; + fetchSubmodules = true; + # deepClone = true; + }; + + rpathLibs = with pkgs; [ + # expat + # fontconfig + # freetype + # libGL + # xorg.libX11 + # xorg.libXcursor + # xorg.libXi + # xorg.libXrandr + # xorg.libXxf86vm + # xorg.libxcb + ]; + + alacritty-alt-patch = with pkgs; rustPlatform.buildRustPackage { + pname = "alacritty-alt-patch"; + version = "latest"; + + src = alt-patch-package; + cargoLock = { lockFile = alt-patch-package + "/Cargo.lock"; }; + + nativeBuildInputs = [ + cmake + installShellFiles + makeWrapper + ncurses + pkg-config + python3 + ]; + + buildInputs = rpathLibs + ++ (with pkgs.darwin.apple_sdk.frameworks; [ + AppKit + CoreGraphics + CoreServices + CoreText + Foundation + libiconv + OpenGL + ]); + + doCheck = false; # meow + + outputs = [ "out" "terminfo" ]; + + postPatch = lib.optionalString (!xdg-utils.meta.broken) '' + substituteInPlace alacritty/src/config/ui_config.rs \ + --replace xdg-open ${xdg-utils}/bin/xdg-open + ''; + + checkFlags = [ "--skip=term::test::mock_term" ]; # broken on aarch64 + + postInstall = '' + mkdir $out/Applications + cp -r extra/osx/Alacritty.app $out/Applications + cp -r $out/bin $out/Applications/Alacritty.app/Contents/MacOS # the original script used ln -s instead of cp -r, seems launchpad dies when having symlinks inside the application? + + installShellCompletion --zsh extra/completions/_alacritty + installShellCompletion --bash extra/completions/alacritty.bash + installShellCompletion --fish extra/completions/alacritty.fish + install -dm 755 "$out/share/man/man1" + # gzip -c extra/alacritty.man > "$out/share/man/man1/alacritty.1.gz" + # gzip -c extra/alacritty-msg.man > "$out/share/man/man1/alacritty-msg.1.gz" + install -Dm 644 alacritty.yml $out/share/doc/alacritty.yml + install -dm 755 "$terminfo/share/terminfo/a/" + tic -xe alacritty,alacritty-direct -o "$terminfo/share/terminfo" extra/alacritty.info + mkdir -p $out/nix-support + echo "$terminfo" >> $out/nix-support/propagated-user-env-packages + ''; + + dontPatchELF = true; + + passthru.tests.test = nixosTests.terminal-emulators.alacritty; + }; + +in +{ + enable = true; + settings = base-cfg; + package = if stdenv.isDarwin then alacritty-alt-patch else pkgs.alacritty; +} + diff --git a/alacritty/keybinds.nix b/alacritty/keybinds.nix new file mode 100644 index 00000000..7cb25039 --- /dev/null +++ b/alacritty/keybinds.nix @@ -0,0 +1,171 @@ +{ bind-broken-mac-keybinds }: +let + broken-options = [ + { key = ''Backslash''; mods = ''Option''; chars = ''|''; } + { key = ''Backslash''; mods = ''Shift|Option''; chars = ''\\''; } + { key = ''Key6''; mods = ''Option''; chars = ''^''; } # huh? + { key = ''Minus''; mods = ''Shift|Option''; chars = ''_''; } + { key = ''LBracket''; mods = ''Option''; chars = ''[''; } + { key = ''LBracket''; mods = ''Shift|Option''; chars = ''{''; } + { key = ''RBracket''; mods = ''Option''; chars = '']''; } + { key = ''RBracket''; mods = ''Shift|Option''; chars = ''}''; } + { key = ''Key2''; mods = ''Option''; chars = ''@''; } + ]; + + ralts = [ + { key = ''A''; mods = ''Alt''; chars = ''\x1ba''; } + { key = ''B''; mods = ''Alt''; chars = ''\x1bb''; } + { key = ''C''; mods = ''Alt''; chars = ''\x1bc''; } + { key = ''D''; mods = ''Alt''; chars = ''\x1bd''; } + { key = ''E''; mods = ''Alt''; chars = ''\x1be''; } + { key = ''F''; mods = ''Alt''; chars = ''\x1bf''; } + { key = ''G''; mods = ''Alt''; chars = ''\x1bg''; } + { key = ''H''; mods = ''Alt''; chars = ''\x1bh''; } + { key = ''I''; mods = ''Alt''; chars = ''\x1bi''; } + { key = ''J''; mods = ''Alt''; chars = ''\x1bj''; } + { key = ''K''; mods = ''Alt''; chars = ''\x1bk''; } + { key = ''L''; mods = ''Alt''; chars = ''\x1bl''; } + { key = ''M''; mods = ''Alt''; chars = ''\x1bm''; } + { key = ''N''; mods = ''Alt''; chars = ''\x1bn''; } + { key = ''O''; mods = ''Alt''; chars = ''\x1bo''; } + { key = ''P''; mods = ''Alt''; chars = ''\x1bp''; } + { key = ''Q''; mods = ''Alt''; chars = ''\x1bq''; } + { key = ''R''; mods = ''Alt''; chars = ''\x1br''; } + { key = ''S''; mods = ''Alt''; chars = ''\x1bs''; } + { key = ''T''; mods = ''Alt''; chars = ''\x1bt''; } + { key = ''U''; mods = ''Alt''; chars = ''\x1bu''; } + { key = ''V''; mods = ''Alt''; chars = ''\x1bv''; } + { key = ''W''; mods = ''Alt''; chars = ''\x1bw''; } + { key = ''X''; mods = ''Alt''; chars = ''\x1bx''; } + { key = ''Y''; mods = ''Alt''; chars = ''\x1by''; } + { key = ''Z''; mods = ''Alt''; chars = ''\x1bz''; } + { key = ''A''; mods = ''Alt|Shift''; chars = ''\x1bA''; } + { key = ''B''; mods = ''Alt|Shift''; chars = ''\x1bB''; } + { key = ''C''; mods = ''Alt|Shift''; chars = ''\x1bC''; } + { key = ''D''; mods = ''Alt|Shift''; chars = ''\x1bD''; } + { key = ''E''; mods = ''Alt|Shift''; chars = ''\x1bE''; } + { key = ''F''; mods = ''Alt|Shift''; chars = ''\x1bF''; } + { key = ''G''; mods = ''Alt|Shift''; chars = ''\x1bG''; } + { key = ''H''; mods = ''Alt|Shift''; chars = ''\x1bH''; } + { key = ''I''; mods = ''Alt|Shift''; chars = ''\x1bI''; } + { key = ''J''; mods = ''Alt|Shift''; chars = ''\x1bJ''; } + { key = ''K''; mods = ''Alt|Shift''; chars = ''\x1bK''; } + { key = ''L''; mods = ''Alt|Shift''; chars = ''\x1bL''; } + { key = ''M''; mods = ''Alt|Shift''; chars = ''\x1bM''; } + { key = ''N''; mods = ''Alt|Shift''; chars = ''\x1bN''; } + { key = ''O''; mods = ''Alt|Shift''; chars = ''\x1bO''; } + { key = ''P''; mods = ''Alt|Shift''; chars = ''\x1bP''; } + { key = ''Q''; mods = ''Alt|Shift''; chars = ''\x1bQ''; } + { key = ''R''; mods = ''Alt|Shift''; chars = ''\x1bR''; } + { key = ''S''; mods = ''Alt|Shift''; chars = ''\x1bS''; } + { key = ''T''; mods = ''Alt|Shift''; chars = ''\x1bT''; } + { key = ''U''; mods = ''Alt|Shift''; chars = ''\x1bU''; } + { key = ''V''; mods = ''Alt|Shift''; chars = ''\x1bV''; } + { key = ''W''; mods = ''Alt|Shift''; chars = ''\x1bW''; } + { key = ''X''; mods = ''Alt|Shift''; chars = ''\x1bX''; } + { key = ''Y''; mods = ''Alt|Shift''; chars = ''\x1bY''; } + { key = ''Z''; mods = ''Alt|Shift''; chars = ''\x1bZ''; } + { key = ''Key1''; mods = ''Alt''; chars = ''\x1b1''; } + { key = ''Key2''; mods = ''Alt''; chars = ''\x1b2''; } + { key = ''Key3''; mods = ''Alt''; chars = ''\x1b3''; } + { key = ''Key4''; mods = ''Alt''; chars = ''\x1b4''; } + { key = ''Key5''; mods = ''Alt''; chars = ''\x1b5''; } + { key = ''Key6''; mods = ''Alt''; chars = ''\x1b6''; } + { key = ''Key7''; mods = ''Alt''; chars = ''\x1b7''; } + { key = ''Key8''; mods = ''Alt''; chars = ''\x1b8''; } + { key = ''Key9''; mods = ''Alt''; chars = ''\x1b9''; } + { key = ''Key0''; mods = ''Alt''; chars = ''\x1b0''; } + { key = ''Grave''; mods = ''Alt''; chars = ''\x1b`''; } # Alt + ` + { key = ''Grave''; mods = ''Alt|Shift''; chars = ''\x1b~''; } # Alt + ~ + { key = ''Period''; mods = ''Alt''; chars = ''\x1b.''; } # Alt + . + { key = ''Key8''; mods = ''Alt|Shift''; chars = ''\x1b*''; } # Alt + * + { key = ''Key3''; mods = ''Alt|Shift''; chars = ''\x1b#''; } # Alt + # + { key = ''Period''; mods = ''Alt|Shift''; chars = ''\x1b>''; } # Alt + > + { key = ''Comma''; mods = ''Alt|Shift''; chars = ''\x1b<''; } # Alt + < + { key = ''Minus''; mods = ''Alt|Shift''; chars = ''\x1b_''; } # Alt + _ + { key = ''Key5''; mods = ''Alt|Shift''; chars = ''\x1b%''; } # Alt + % + { key = ''Key6''; mods = ''Alt|Shift''; chars = ''\x1b^''; } # Alt + ^ + { key = ''Backslash''; mods = ''Alt''; chars = ''\x1b\\''; } # Alt + \ + { key = ''Backslash''; mods = ''Alt|Shift''; chars = ''\x1b|''; } # Alt + | + ]; + + alt-arrows = [ + { key = ''Left''; mods = ''Option''; chars = ''\x1bb''; } + { key = ''Right''; mods = ''Option''; chars = ''\x1bf''; } + ]; + + ctrl-binds = [ + # { key = ''A''; mods = ''Control''; chars = ''\x01''; } + { key = ''A''; mods = ''Control''; chars = ''\x01''; } + { key = ''B''; mods = ''Control''; chars = ''\x02''; } + { key = ''C''; mods = ''Control''; chars = ''\x03''; } + { key = ''D''; mods = ''Control''; chars = ''\x04''; } + { key = ''E''; mods = ''Control''; chars = ''\x05''; } + { key = ''F''; mods = ''Control''; chars = ''\x06''; } + { key = ''G''; mods = ''Control''; chars = ''\x07''; } + { key = ''H''; mods = ''Control''; chars = ''\x08''; } + { key = ''I''; mods = ''Control''; chars = ''\x09''; } + { key = ''J''; mods = ''Control''; chars = ''\x0A''; } + { key = ''K''; mods = ''Control''; chars = ''\x0B''; } + { key = ''L''; mods = ''Control''; chars = ''\x0C''; } + { key = ''M''; mods = ''Control''; chars = ''\x0D''; } + { key = ''N''; mods = ''Control''; chars = ''\x0E''; } + { key = ''O''; mods = ''Control''; chars = ''\x0F''; } + { key = ''P''; mods = ''Control''; chars = ''\x10''; } + { key = ''Q''; mods = ''Control''; chars = ''\x11''; } + { key = ''R''; mods = ''Control''; chars = ''\x12''; } + { key = ''S''; mods = ''Control''; chars = ''\x13''; } + { key = ''T''; mods = ''Control''; chars = ''\x14''; } + { key = ''U''; mods = ''Control''; chars = ''\x15''; } + { key = ''V''; mods = ''Control''; chars = ''\x16''; } + { key = ''W''; mods = ''Control''; chars = ''\x17''; } + { key = ''X''; mods = ''Control''; chars = ''\x18''; } + { key = ''Y''; mods = ''Control''; chars = ''\x19''; } + { key = ''Z''; mods = ''Control''; chars = ''\x1A''; } + ]; + + tmux-binds = [ + { key = ''Period''; mods = ''Control''; chars = ''\x1D''; } # tmux escape + + { key = ''Period''; mods = ''Shift|Command''; chars = ''\x1D:''; } + { key = ''Key0''; mods = ''Command''; chars = ''\x1D0''; } + { key = ''Key1''; mods = ''Command''; chars = ''\x1D1''; } + { key = ''Key2''; mods = ''Command''; chars = ''\x1D2''; } + { key = ''Key3''; mods = ''Command''; chars = ''\x1D3''; } + { key = ''Key4''; mods = ''Command''; chars = ''\x1D4''; } + { key = ''Key5''; mods = ''Command''; chars = ''\x1D5''; } + { key = ''Key6''; mods = ''Command''; chars = ''\x1D6''; } + { key = ''Key7''; mods = ''Command''; chars = ''\x1D7''; } + { key = ''Key8''; mods = ''Command''; chars = ''\x1D8''; } + { key = ''Key9''; mods = ''Command''; chars = ''\x1D9''; } + + { key = ''T''; mods = ''Command''; chars = ''\x1Dc''; } + { key = ''R''; mods = ''Command''; chars = ''\x1D$''; } + { key = ''W''; mods = ''Shift|Command''; chars = ''\x1D&''; } # kill window + { key = ''W''; mods = ''Command''; chars = ''\x1Dx''; } # kill pane + + { key = ''Left''; mods = ''Command''; chars = ''\x1Dp''; } + { key = ''Right''; mods = ''Command''; chars = ''\x1Dn''; } + + { key = ''Right''; mods = ''Shift|Command''; chars = ''\x1D\x1b[C''; } + { key = ''Left''; mods = ''Shift|Command''; chars = ''\x1D\x1b[D''; } + + { key = ''O''; mods = ''Command''; chars = ''\x1Dw''; } # ''open'', open a window + + { key = ''A''; mods = ''Command''; chars = ''\x1D;''; } # Last pane + ]; + + others = [ + { key = ''Escape''; chars = ''\x1B''; } + ]; + + std-binds = tmux-binds; + mac-binds = + ralts + ; +in + if bind-broken-mac-keybinds then + std-binds ++ mac-binds + else + std-binds + diff --git a/dotfiles/init.el b/dotfiles/init.el new file mode 100644 index 00000000..3cb9b966 --- /dev/null +++ b/dotfiles/init.el @@ -0,0 +1,169 @@ +(load "server") +(unless (server-running-p) (server-start)) + +(setenv "PATH" (concat (getenv "PATH") ":todo!(")) +(setq exec-path (append exec-path '("/run/current-system/sw/bin" "/nix/var/nix/profiles/default/bin"))) + +(add-to-list 'default-frame-alist '(font . "SAX2")) +(set-face-attribute 'default nil :height 150) +(load-theme 'wombat t) + +(tool-bar-mode -1) +(pixel-scroll-mode 1) +(scroll-bar-mode -1) +(setq mac-option-modifier 'none) +(setq mac-right-option-modifier 'meta) +(setq frame-resize-pixelwise t) + +(setq make-backup-files nil) + +(setq-default indent-tabs-mode nil) +(setq-default tab-width 4) +(setq-default sgml-basic-offset 4) +(setq whitespace-style '(trailing tabs newline tab-mark)) +(setq-default show-trailing-whitespace t) + +(global-whitespace-mode) + +(setq backup-directory-alist `(("." . "~/.emacs/saves"))) +(setq backup-by-copying t) + +(add-hook 'shell-mode-hook + (lambda () + (local-set-key (kbd "C-p") 'comint-previous-input) + (local-set-key (kbd "C-n") 'comint-next-input) + )) + +(require 'agda2) + +(require 'bind-key) +; (bind-key* "M-p" 'pixel-scroll-down) +; (bind-key* "M-n" 'pixel-scroll-up) +(bind-key* "s-a" 'other-window) +(bind-key* "s-q" 'save-buffers-kill-terminal) +(bind-key* "s-" 'windmove-right) +(bind-key* "s-" 'windmove-left) +(bind-key* "s-" 'windmove-up) +(bind-key* "s-" 'windmove-down) + +(setq lsp-keymap-prefix "M-l") +(require 'lsp-mode) + +(require 'company) + +(require'meow) +(meow-global-mode 1) +(defun meow-setup () + (setq meow-expand-hint-counts + '((word . 10) + (line . 10) + (block . 10) + (find . 10) + (till . 10)) + ) + (meow-leader-define-key + '("1" . meow-digit-argument) + '("2" . meow-digit-argument) + '("3" . meow-digit-argument) + '("4" . meow-digit-argument) + '("5" . meow-digit-argument) + '("6" . meow-digit-argument) + '("7" . meow-digit-argument) + '("8" . meow-digit-argument) + '("9" . meow-digit-argument) + '("0" . meow-digit-argument) + '("/" . meow-keypad-describe-key) + '("?" . meow-cheatsheet)) + (meow-motion-overwrite-define-key + ;; custom keybinding for motion state + '("" . ignore)) + (meow-normal-define-key + '("0" . meow-expand-0) + '("9" . meow-expand-9) + '("8" . meow-expand-8) + '("7" . meow-expand-7) + '("6" . meow-expand-6) + '("5" . meow-expand-5) + '("4" . meow-expand-4) + '("3" . meow-expand-3) + '("2" . meow-expand-2) + '("1" . meow-expand-1) + '("-" . negative-argument) + '(";" . meow-reverse) + '("," . meow-inner-of-thing) + '("." . meow-bounds-of-thing) + '("<" . meow-beginning-of-thing) + '(">" . meow-end-of-thing) + '("a" . meow-append) + '("A" . meow-open-below) + '("b" . meow-back-word) + '("B" . meow-back-symbol) + '("c" . meow-change) + ; '("d" . meow-delete) + ; '("D" . meow-backward-delete) + '("d" . meow-kill) + '("e" . meow-line) + '("E" . meow-goto-line) + '("f" . meow-find) + '("g" . meow-cancel-selection) + '("G" . meow-grab) + '("h" . meow-left) + '("H" . meow-left-expand) + '("i" . meow-insert) + '("I" . meow-open-above) + ; '("j" . meow-join) + '("j" . meow-next) + '("J" . meow-next-expand) + ; '("k" . meow-kill) + '("k" . meow-prev) + '("K" . meow-prev-expand) + ; '("l" . meow-till) + '("l" . meow-right) + '("L" . meow-right-expand) + '("m" . meow-mark-word) + '("M" . meow-mark-symbol) + ; '("n" . meow-next) + ; '("N" . meow-next-expand) + '("o" . meow-block) + '("O" . meow-to-block) + ; '("p" . meow-prev) + ; '("P" . meow-prev-expand) + ; '("q" . meow-quit) + ; '("Q" . meow-goto-line) + '("r" . meow-replace) + '("R" . meow-swap-grab) + '("s" . meow-search) + ; '("t" . meow-right) + ; '("T" . meow-right-expand) + '("t" . meow-till) + '("u" . undo) + '("U" . undo-redo) + '("v" . meow-visit) + '("w" . meow-next-word) + '("W" . meow-next-symbol) + '("x" . meow-save) + '("X" . meow-sync-grab) + '("y" . meow-yank) + '("z" . meow-pop-selection) + '("'" . repeat) + '("" . ignore))) +(meow-setup) + +(setq mark-even-if-inactive nil) +(put 'downcase-region 'disabled nil) +(put 'upcase-region 'disabled nil) +(put 'narrow-to-region 'disabled nil) + +(require 'agda-input) + +(setq agda-input-tweak-all + '(agda-input-compose + (agda-input-prepend "!") + (agda-input-nonempty)) + ) +(agda-input-setup) + +(setq default-input-method "Agda") +(add-to-list 'auto-mode-alist '("\\.lagda.md\\'" . agda2-mode)) + +; (setq ring-bell-function (lambda () (call-process "sh" nil 0 nil "-c" "find /Users/xenia/cloud/configs/resources -type f | egrep -v '/_' | shuf -n 1 | xargs afplay"))) diff --git a/dotfiles/kakrc b/dotfiles/kakrc new file mode 100644 index 00000000..ff285dd4 --- /dev/null +++ b/dotfiles/kakrc @@ -0,0 +1,173 @@ +## Highlight whitespace at end of line +add-highlighter global/ regex '^.*[^ ]( +)$' 1:black,red +add-highlighter global/ number-lines -relative -hlcursor + +hook global WinSetOption .* %{ + remove-highlighter global/show-ws + add-highlighter global/show-ws show-whitespaces -tabpad ' ' + + face global Whitespace rgb:3c3836+f + face global comment rgb:665c54+f +} + +add-highlighter global/ show-matching + +set global indentwidth 4 + +hook global WinSetOption filetype=(verilog|nix|vhdl) %{ + set buffer tabstop 2 + set buffer indentwidth 2 +} + +hook global WinSetOption filetype=vhdl %{ + set buffer comment_block_begin '/*' + set buffer comment_block_end '/*' + set buffer comment_line '--' +} + +## == keybinds == + +map global normal 'J' "Jx" +map global normal 'K' "Kx" + +# tabs +map global insert '' '' +map global insert '' '' + +define-command W w + +# Commenting +map global normal '#' ':comment-line' +map global user '#' ':comment-block' -docstring 'Block comment' + +# Clipboard commands +map global normal '' '|pbcopyu:echo "Copied text to clipboard"' +map global normal '' '!pbpaste' + +# Buffer user mode +map global user 'b' ':enter-user-mode buffers' -docstring 'buffer mode' +map global user 'B' ':enter-user-mode -lock buffers' -docstring 'buffer mode (lock)' + +# command to copy : into the clipboard (useful for pasting into debugger) +define-command copy-location -docstring "Copies : for the current cursor into the clipboard" %{ + evaluate-commands %sh{ + set -e + printf "%s" "$kak_bufname:$kak_cursor_line" | pbcopy + echo "echo 'Copied $kak_bufname:$kak_cursor_line into clipboard'" + } +} + +define-command copy-location-path -docstring "Copies : for the current cursor into the clipboard" %{ + evaluate-commands %sh{ + set -e + printf "%s" "$kak_buffile:$kak_cursor_line" | pbcopy + echo "echo 'Copied $kak_buffile:$kak_cursor_line into clipboard'" + } +} + +map global user 'y' ':copy-location' -docstring "Copy location" +map global user 'Y' ':copy-location-path' -docstring "Copy location (full path)" + +## == plugin configuration == + +# Custom function surround +define-command -hidden surround-function %{ + prompt 'function: ' %{ + execute-keys "Z;ha%val{text}(Lua)" + } +} +define-command -hidden surround-tag %{ + prompt 'tag: ' %{ + execute-keys "Z;ha%val{text}Lua/%val{text}" + } +} +define-command -hidden surround-Tag %{ + prompt 'tag: ' %{ + execute-keys "xZgihyzxZO""%val{text}zo""%val{text}z" + } +} +define-command -hidden surround-ins %{ + prompt 'prefix: ' %{ + execute-keys "Z;ha%val{text}Lu" + } +} + +map global mirror 'f' ':surround-function' -docstring 'function' +map global mirror 't' ':surround-tag' -docstring 'function' +map global mirror 'T' ':surround-Tag' -docstring 'function' +map global mirror 'i' ':surround-ins' -docstring 'function' + +map global normal ö ':enter-user-mode mirror' -docstring 'mirror mode' + +# LSP stuff +map global normal 'Å' ':lsp-enable' -docstring 'Enable LSP' +map global normal 'å' ':enter-user-mode lsp' -docstring 'LSP mode' +map global lsp 'R' ':lsp-rename-prompt' -docstring 'Rename symbol' + +define-command lsp-clear-references %{ + set-option window lsp_references # empty +} +map global lsp '"' ':lsp-clear-references' -docstring "Clear references" + +face global Reference white,rgb:550055 +face global ReferenceBind white,rgb:552200 + +map global insert '' ':enter-user-mode lsps' + +#TODO +# map global user '&' ':qhl-word' -docstring "Highlight current word" +# map global user '"' ':unqhl' -docstring "Remove highlight" + +## == Colors == + +define-command update-cursor-style %{ + evaluate-commands %sh{ + if [ $(echo "$kak_selection" | wc -c) -eq 2 ] ; then + echo 'face buffer PrimaryCursor white,+uiF' + else + echo 'face buffer PrimaryCursor white,rgb:b05fde+uiF' + fi + } +} + +hook global NormalKey .* %{ + update-cursor-style +} + +hook global WinCreate .* %{ + update-cursor-style +} + +face global PrimaryCursorEol PrimaryCursor +face global SecondaryCursorEol SecondaryCursor + +face global operator blue +face global type rgb:aa66ee+b + +face global MenuBackground rgb:eecc44+i +face global MenuForeground blue+bi +face global Information rgb:44ccee+b + +face global MatchingChar ,rgb:665c54+bF + +## Filetype formatting + +hook global BufSetOption filetype=rust %{ + set-option buffer formatcmd 'rustfmt' + + hook buffer -group rust-inlay-hints BufReload .* rust-analyzer-inlay-hints + hook buffer -group rust-inlay-hints NormalIdle .* rust-analyzer-inlay-hints +} + +hook global WinSetOption filetype=python %{ + set-option window formatcmd 'black -q -' +} + +set-option global ignored_files "^(\..*|.*\.(o|so|a)|__pycache__)$" + +## APL execute on = + +define-command -hidden dyalog-execute %{ + execute-keys -itersel 'i⎕←HH|dyalogscript /dev/fd/0' +} +map global normal '=' ':dyalog-execute' diff --git a/dotfiles/zshrc b/dotfiles/zshrc new file mode 100755 index 00000000..2bd23fc2 --- /dev/null +++ b/dotfiles/zshrc @@ -0,0 +1,85 @@ +#!/bin/zsh + +export PATH="$HOME/.cargo/bin:$PATH" +export PATH="/Applications/ARM/bin:$PATH" + +mkdir -p "$XDG_RUNTIME_DIR" + +alias ls="ls -G" +alias bashcols="python3 ~/cloud/Projekt/Programmering/Python/BashCols.py" +alias bashcurmov="python3 ~/cloud/Projekt/Programmering/Python/Bashcurmoves.py" +alias objdump="objdump -M intel" +alias atsc="patscc -cleanaft -DATS_MEMALLOC_LIBC" +alias i2="idris2" +alias py="python" +alias ipy="ipython" +alias c="cargo" +alias bqn="rlwrap BQN" +alias nix-zsh="nix-shell --run zsh" +alias z=nix-zsh + +_BLUE="\033[38;5;4m" +_GREEN="\033[38;5;2m" +_RED="\033[38;5;1m" +_RESET="\033[0m" +function activate { + ( + cd ~/cloud/Projekt + F=$( fd '' -t d -d 4 . | fzf -1 -q "$1" ) || return + LINKEE=$(realpath "$F") + DEFAULT_NAME=$(basename "$LINKEE") + LINK="${2:-${DEFAULT_NAME}}" + cd ~/cloud/A-Aktivta + if [[ -d "$LINK" ]] then + echo "Project ${_BLUE}$LINK${_RESET} already exists!" + else + echo "${_BLUE}$LINK${_RESET} -> ${_BLUE}$LINKEE${_RESET} has been ${_GREEN}activated${_RESET}" + ln -s "$LINKEE" "$LINK" + fi + ) + _check_proj_count +} + +function _check_proj_count { + ( + cd ~/cloud/A-Aktivta + N_FILES=$(ls | wc -l | tr -d ' ') + if [[ $N_FILES > 4 ]] then + echo "You have $_RED$N_FILES$_RESET active projets. Consider deactivating some" + fi + ) +} + +function deactivate { + ( + cd ~/cloud/A-Aktivta + F=$( fd '' -t l -d 1 . | fzf -1 -q "$1" ) || return + rm "$F" + echo "Deactivated $_BLUE$F$RESET" + ) + _check_proj_count +} + +function project { + pushd >/dev/null + cd ~/cloud/A-Aktivta + PROJ_NAME=$( fd '' -t l -d 1 . | fzf -1 -q "$1" ) || { popd >/dev/null ; return } + F=$(realpath "$PROJ_NAME") + + echo "In $_BLUE${PROJ_NAME}$_RESET" + cd "$F" + _check_proj_count +} + +alias p=project + +setopt prompt_subst + +# export RPROMPT='%(?.%F{green}√.%?%F{red}?)%f' + +# tmux stuff +function setwd { + tmux command-prompt -I "attach -c $(pwd)" +} + +alias nix-zsh="nix-shell --run zsh" diff --git a/emacs_build.sh b/emacs_build.sh new file mode 100755 index 00000000..0c0e37ca --- /dev/null +++ b/emacs_build.sh @@ -0,0 +1,17 @@ +PATH="/usr/bin:/bin" + +set -e + +mkdir -p "${out}/Applications" +appOut="${out}/Applications/${appName}.app" + +osacompile -o "${appOut}" <