diff --git a/home/common/fish.nix b/home/common/fish.nix index d80a35b..f83fec0 100644 --- a/home/common/fish.nix +++ b/home/common/fish.nix @@ -1,4 +1,5 @@ -{ config, pkgs, lib, ... }: +{ pkgs, ... }: + { programs.fish = let nom-compat = pkgs.runCommand "any-shell-nom-compat" {} '' @@ -24,7 +25,9 @@ ${pkgs.any-nix-shell}/bin/.any-nix-shell-wrapper fish $argv end function nix - if test $argv[1] = shell + if not set -q argv[1] + command nix + else if test $argv[1] = shell set argv[1] fish ${pkgs.any-nix-shell}/bin/.any-nix-wrapper $argv else if test $argv[1] = develop @@ -39,169 +42,177 @@ PATH="${nom-compat}/bin:$PATH" ${pkgs.any-nix-shell}/bin/.any-nix-shell-wrapper fish $argv end function nom - if test $argv[1] = shell + if not set -q argv[1] + command nom + else if test $argv[1] = shell set argv[1] fish PATH="${nom-compat}/bin:$PATH" ${pkgs.any-nix-shell}/bin/.any-nix-wrapper $argv else if test $argv[1] = develop set argv[1] fish - ${pkgs.nix-output-monitor}/bin/nom develop --command $argv + command nom develop --command $argv + else if test $argv[1] = build + command nom $argv else - command nix $argv + command nix --log-format internal-json -v $argv &| command nom --json end end - export NOMCOMPAT=${nom-compat} + set -gx NOMCOMPAT ${nom-compat} # for posix compatibility set -gx SHELL zsh - set -gx fish_color_autosuggestion 777 brblack - set -gx fish_color_command green - set -gx fish_color_operator white - set -gx fish_color_param white + set -g fish_color_autosuggestion 777 brblack + set -g fish_color_command green + set -g fish_color_operator white + set -g fish_color_param white - set -gx fish_key_bindings fish_vi_key_bindings - set -gx fish_cursor_insert line - set -gx fish_cursor_replace underscore + set -g fish_key_bindings fish_vi_key_bindings + set -g fish_cursor_insert line + set -g fish_cursor_replace underscore - # set -gx doesn't work in this case for whatever reason - set -Ux _tide_left_items pwd git vi_mode - set -Ux _tide_prompt_69105 \x1b\x28B\x1b\x5bm\x1b\x28B\x1b\x5bm\x1b\x5b34m\x1b\x5b44m\x20\x40PWD\x40\x20\x1b\x5b34m\x1b\x5b40m\ue0b0\x1b\x5b32m\x1b\x5b40m\x20\u276f\x20\x1b\x28B\x1b\x5bm\x1b\x28B\x1b\x5bm\x1b\x5b30m\ue0b0 \x1b\x28B\x1b\x5bm\x1b\x28B\x1b\x5bm\x1b\x5b30m\ue0b2\x1b\x5b32m\x1b\x5b40m\x20\uf00c\x20\x1b\x5b33m\x1b\x5b40m\ue0b2\x1b\x5b30m\x1b\x5b43m\x2021m\x2023s\x20\x1b\x28B\x1b\x5bm\x1b\x28B\x1b\x5bm\x1b\x5b33m - set -Ux _tide_prompt_79899 \x1b\x28B\x1b\x5bm\x1b\x28B\x1b\x5bm\x1b\x5b34m\x1b\x5b44m\x20\x40PWD\x40\x20\x1b\x5b34m\x1b\x5b40m\ue0b0\x1b\x5b32m\x1b\x5b40m\x20\u276f\x20\x1b\x28B\x1b\x5bm\x1b\x28B\x1b\x5bm\x1b\x5b30m\ue0b0 \x1b\x28B\x1b\x5bm\x1b\x28B\x1b\x5bm\x1b\x5b30m\ue0b2\x1b\x5b32m\x1b\x5b40m\x20\uf00c\x20\x1b\x5b33m\x1b\x5b40m\ue0b2\x1b\x5b30m\x1b\x5b43m\x2015s\x20\x1b\x28B\x1b\x5bm\x1b\x28B\x1b\x5bm\x1b\x5b33m - set -Ux _tide_right_items status cmd_duration context jobs virtual_env rustc nix_shell + # the following 4 values are special in some way + # (e.g. even if you use -gx to set them, it won't work) + set -U _tide_left_items pwd git vi_mode + set -U _tide_prompt_69105 \x1b\x28B\x1b\x5bm\x1b\x28B\x1b\x5bm\x1b\x5b34m\x1b\x5b44m\x20\x40PWD\x40\x20\x1b\x5b34m\x1b\x5b40m\ue0b0\x1b\x5b32m\x1b\x5b40m\x20\u276f\x20\x1b\x28B\x1b\x5bm\x1b\x28B\x1b\x5bm\x1b\x5b30m\ue0b0 \x1b\x28B\x1b\x5bm\x1b\x28B\x1b\x5bm\x1b\x5b30m\ue0b2\x1b\x5b32m\x1b\x5b40m\x20\uf00c\x20\x1b\x5b33m\x1b\x5b40m\ue0b2\x1b\x5b30m\x1b\x5b43m\x2021m\x2023s\x20\x1b\x28B\x1b\x5bm\x1b\x28B\x1b\x5bm\x1b\x5b33m + set -U _tide_prompt_79899 \x1b\x28B\x1b\x5bm\x1b\x28B\x1b\x5bm\x1b\x5b34m\x1b\x5b44m\x20\x40PWD\x40\x20\x1b\x5b34m\x1b\x5b40m\ue0b0\x1b\x5b32m\x1b\x5b40m\x20\u276f\x20\x1b\x28B\x1b\x5bm\x1b\x28B\x1b\x5bm\x1b\x5b30m\ue0b0 \x1b\x28B\x1b\x5bm\x1b\x28B\x1b\x5bm\x1b\x5b30m\ue0b2\x1b\x5b32m\x1b\x5b40m\x20\uf00c\x20\x1b\x5b33m\x1b\x5b40m\ue0b2\x1b\x5b30m\x1b\x5b43m\x2015s\x20\x1b\x28B\x1b\x5bm\x1b\x28B\x1b\x5bm\x1b\x5b33m + set -U _tide_right_items status cmd_duration context jobs virtual_env rustc nix_shell - set -gx tide_aws_bg_color yellow - set -gx tide_aws_color brblack - set -gx tide_aws_icon \uf270 - set -gx tide_character_color brgreen - set -gx tide_character_color_failure brred - set -gx tide_character_icon \u276f - set -gx tide_character_vi_icon_default \u276e - set -gx tide_character_vi_icon_replace \u25b6 - set -gx tide_character_vi_icon_visual V - set -gx tide_chruby_bg_color red - set -gx tide_chruby_color black - set -gx tide_chruby_icon \ue23e - set -gx tide_cmd_duration_bg_color yellow - set -gx tide_cmd_duration_color black - set -gx tide_cmd_duration_decimals 0 - set -gx tide_cmd_duration_icon \x1d - set -gx tide_cmd_duration_threshold 3000 - set -gx tide_context_always_display false - set -gx tide_context_bg_color brblack - set -gx tide_context_color_default yellow - set -gx tide_context_color_root yellow - set -gx tide_context_color_ssh yellow - set -gx tide_context_hostname_parts 1 - set -gx tide_crystal_bg_color brwhite - set -gx tide_crystal_color black - set -gx tide_crystal_icon \u2b22 - set -gx tide_docker_bg_color blue - set -gx tide_docker_color black - set -gx tide_docker_default_contexts default colima - set -gx tide_docker_icon \uf308 - set -gx tide_git_bg_color green - set -gx tide_git_bg_color_unstable yellow - set -gx tide_git_bg_color_urgent red - set -gx tide_git_color_branch black - set -gx tide_git_color_conflicted black - set -gx tide_git_color_dirty black - set -gx tide_git_color_operation black - set -gx tide_git_color_staged black - set -gx tide_git_color_stash black - set -gx tide_git_color_untracked black - set -gx tide_git_color_upstream black - set -gx tide_git_icon \x1d - set -gx tide_git_truncation_length 24 - set -gx tide_go_bg_color brcyan - set -gx tide_go_color black - set -gx tide_go_icon \ue627 - set -gx tide_java_bg_color yellow - set -gx tide_java_color black - set -gx tide_java_icon \ue256 - set -gx tide_jobs_bg_color brblack - set -gx tide_jobs_color green - set -gx tide_jobs_icon \uf013 - set -gx tide_kubectl_bg_color blue - set -gx tide_kubectl_color black - set -gx tide_kubectl_icon \u2388 - set -gx tide_left_prompt_frame_enabled false - set -gx tide_left_prompt_items pwd git vi_mode - set -gx tide_left_prompt_prefix - set -gx tide_left_prompt_separator_diff_color \ue0b0 - set -gx tide_left_prompt_separator_same_color \ue0b1 - set -gx tide_left_prompt_suffix \ue0b0 - set -gx tide_nix_shell_bg_color brblue - set -gx tide_nix_shell_color white - set -gx tide_nix_shell_icon \uf313 - set -gx tide_node_bg_color green - set -gx tide_node_color black - set -gx tide_node_icon \u2b22 - set -gx tide_os_bg_color white - set -gx tide_os_color black - set -gx tide_os_icon \uf313 - set -gx tide_php_bg_color blue - set -gx tide_php_color black - set -gx tide_php_icon \ue608 - set -gx tide_private_mode_bg_color brwhite - set -gx tide_private_mode_color black - set -gx tide_private_mode_icon \ufaf8 - set -gx tide_prompt_add_newline_before true - set -gx tide_prompt_color_frame_and_connection brblack - set -gx tide_prompt_color_separator_same_color brblack - set -gx tide_prompt_icon_connection \x20 - set -gx tide_prompt_min_cols 34 - set -gx tide_prompt_pad_items true - set -gx tide_pwd_bg_color blue - set -gx tide_pwd_color_anchors brwhite - set -gx tide_pwd_color_dirs brwhite - set -gx tide_pwd_color_truncated_dirs white - set -gx tide_pwd_icon \x1d - set -gx tide_pwd_icon_home \uf015 - set -gx tide_pwd_icon_unwritable \uf023 - set -gx tide_pwd_markers \x2ebzr \x2ecitc \x2egit \x2ehg \x2enode\x2dversion \x2epython\x2dversion \x2eruby\x2dversion \x2eshorten_folder_marker \x2esvn \x2eterraform Cargo\x2etoml composer\x2ejson CVS go\x2emod package\x2ejson - set -gx tide_right_prompt_frame_enabled false - set -gx tide_right_prompt_items status cmd_duration context jobs node virtual_env rustc java php chruby go kubectl toolbox terraform aws nix_shell crystal - set -gx tide_right_prompt_prefix \ue0b2 - set -gx tide_right_prompt_separator_diff_color \ue0b2 - set -gx tide_right_prompt_separator_same_color \ue0b3 - set -gx tide_right_prompt_suffix - set -gx tide_rustc_bg_color red - set -gx tide_rustc_color black - set -gx tide_rustc_icon \ue7a8 - set -gx tide_shlvl_bg_color yellow - set -gx tide_shlvl_color black - set -gx tide_shlvl_icon \uf120 - set -gx tide_shlvl_threshold 1 - set -gx tide_status_bg_color black - set -gx tide_status_bg_color_failure red - set -gx tide_status_color green - set -gx tide_status_color_failure brwhite - set -gx tide_status_icon \uf00c - set -gx tide_status_icon_failure \u2718 - set -gx tide_terraform_bg_color magenta - set -gx tide_terraform_color black - set -gx tide_terraform_icon \x1d - set -gx tide_time_bg_color white - set -gx tide_time_color black - set -gx tide_time_format - set -gx tide_toolbox_bg_color magenta - set -gx tide_toolbox_color black - set -gx tide_toolbox_icon \u2b22 - set -gx tide_vi_mode_bg_color_default black - set -gx tide_vi_mode_bg_color_insert black - set -gx tide_vi_mode_bg_color_replace black - set -gx tide_vi_mode_bg_color_visual black - set -gx tide_vi_mode_color_default green - set -gx tide_vi_mode_color_insert green - set -gx tide_vi_mode_color_replace green - set -gx tide_vi_mode_color_visual green - set -gx tide_vi_mode_icon_default \u276e - set -gx tide_vi_mode_icon_insert \u276f - set -gx tide_vi_mode_icon_replace R - set -gx tide_vi_mode_icon_visual V - set -gx tide_virtual_env_bg_color brblack - set -gx tide_virtual_env_color cyan - set -gx tide_virtual_env_icon \ue73c + # for the following values, -gx works too (-g doesn't) + # but it pollutes children's env, so do -U + # might as well make this an activation script? + set -U tide_aws_bg_color yellow + set -U tide_aws_color brblack + set -U tide_aws_icon \uf270 + set -U tide_character_color brgreen + set -U tide_character_color_failure brred + set -U tide_character_icon \u276f + set -U tide_character_vi_icon_default \u276e + set -U tide_character_vi_icon_replace \u25b6 + set -U tide_character_vi_icon_visual V + set -U tide_chruby_bg_color red + set -U tide_chruby_color black + set -U tide_chruby_icon \ue23e + set -U tide_cmd_duration_bg_color yellow + set -U tide_cmd_duration_color black + set -U tide_cmd_duration_decimals 0 + set -U tide_cmd_duration_icon \x1d + set -U tide_cmd_duration_threshold 3000 + set -U tide_context_always_display false + set -U tide_context_bg_color brblack + set -U tide_context_color_default yellow + set -U tide_context_color_root yellow + set -U tide_context_color_ssh yellow + set -U tide_context_hostname_parts 1 + set -U tide_crystal_bg_color brwhite + set -U tide_crystal_color black + set -U tide_crystal_icon \u2b22 + set -U tide_docker_bg_color blue + set -U tide_docker_color black + set -U tide_docker_default_contexts default colima + set -U tide_docker_icon \uf308 + set -U tide_git_bg_color green + set -U tide_git_bg_color_unstable yellow + set -U tide_git_bg_color_urgent red + set -U tide_git_color_branch black + set -U tide_git_color_conflicted black + set -U tide_git_color_dirty black + set -U tide_git_color_operation black + set -U tide_git_color_staged black + set -U tide_git_color_stash black + set -U tide_git_color_untracked black + set -U tide_git_color_upstream black + set -U tide_git_icon \x1d + set -U tide_git_truncation_length 24 + set -U tide_go_bg_color brcyan + set -U tide_go_color black + set -U tide_go_icon \ue627 + set -U tide_java_bg_color yellow + set -U tide_java_color black + set -U tide_java_icon \ue256 + set -U tide_jobs_bg_color brblack + set -U tide_jobs_color green + set -U tide_jobs_icon \uf013 + set -U tide_kubectl_bg_color blue + set -U tide_kubectl_color black + set -U tide_kubectl_icon \u2388 + set -U tide_left_prompt_frame_enabled false + set -U tide_left_prompt_items pwd git vi_mode + set -U tide_left_prompt_prefix + set -U tide_left_prompt_separator_diff_color \ue0b0 + set -U tide_left_prompt_separator_same_color \ue0b1 + set -U tide_left_prompt_suffix \ue0b0 + set -U tide_nix_shell_bg_color brblue + set -U tide_nix_shell_color white + set -U tide_nix_shell_icon \uf313 + set -U tide_node_bg_color green + set -U tide_node_color black + set -U tide_node_icon \u2b22 + set -U tide_os_bg_color white + set -U tide_os_color black + set -U tide_os_icon \uf313 + set -U tide_php_bg_color blue + set -U tide_php_color black + set -U tide_php_icon \ue608 + set -U tide_private_mode_bg_color brwhite + set -U tide_private_mode_color black + set -U tide_private_mode_icon \ufaf8 + set -U tide_prompt_add_newline_before true + set -U tide_prompt_color_frame_and_connection brblack + set -U tide_prompt_color_separator_same_color brblack + set -U tide_prompt_icon_connection \x20 + set -U tide_prompt_min_cols 34 + set -U tide_prompt_pad_items true + set -U tide_pwd_bg_color blue + set -U tide_pwd_color_anchors brwhite + set -U tide_pwd_color_dirs brwhite + set -U tide_pwd_color_truncated_dirs white + set -U tide_pwd_icon \x1d + set -U tide_pwd_icon_home \uf015 + set -U tide_pwd_icon_unwritable \uf023 + set -U tide_pwd_markers \x2ebzr \x2ecitc \x2egit \x2ehg \x2enode\x2dversion \x2epython\x2dversion \x2eruby\x2dversion \x2eshorten_folder_marker \x2esvn \x2eterraform Cargo\x2etoml composer\x2ejson CVS go\x2emod package\x2ejson + set -U tide_right_prompt_frame_enabled false + set -U tide_right_prompt_items status cmd_duration context jobs node virtual_env rustc java php chruby go kubectl toolbox terraform aws nix_shell crystal + set -U tide_right_prompt_prefix \ue0b2 + set -U tide_right_prompt_separator_diff_color \ue0b2 + set -U tide_right_prompt_separator_same_color \ue0b3 + set -U tide_right_prompt_suffix + set -U tide_rustc_bg_color red + set -U tide_rustc_color black + set -U tide_rustc_icon \ue7a8 + set -U tide_shlvl_bg_color yellow + set -U tide_shlvl_color black + set -U tide_shlvl_icon \uf120 + set -U tide_shlvl_threshold 1 + set -U tide_status_bg_color black + set -U tide_status_bg_color_failure red + set -U tide_status_color green + set -U tide_status_color_failure brwhite + set -U tide_status_icon \uf00c + set -U tide_status_icon_failure \u2718 + set -U tide_terraform_bg_color magenta + set -U tide_terraform_color black + set -U tide_terraform_icon \x1d + set -U tide_time_bg_color white + set -U tide_time_color black + set -U tide_time_format + set -U tide_toolbox_bg_color magenta + set -U tide_toolbox_color black + set -U tide_toolbox_icon \u2b22 + set -U tide_vi_mode_bg_color_default black + set -U tide_vi_mode_bg_color_insert black + set -U tide_vi_mode_bg_color_replace black + set -U tide_vi_mode_bg_color_visual black + set -U tide_vi_mode_color_default green + set -U tide_vi_mode_color_insert green + set -U tide_vi_mode_color_replace green + set -U tide_vi_mode_color_visual green + set -U tide_vi_mode_icon_default \u276e + set -U tide_vi_mode_icon_insert \u276f + set -U tide_vi_mode_icon_replace R + set -U tide_vi_mode_icon_visual V + set -U tide_virtual_env_bg_color brblack + set -U tide_virtual_env_color cyan + set -U tide_virtual_env_icon \ue73c ''; plugins = with pkgs.fishPlugins; [ { name = "tide"; src = tide.src; } diff --git a/home/common/helix.nix b/home/common/helix.nix index 80956d6..19cc131 100644 --- a/home/common/helix.nix +++ b/home/common/helix.nix @@ -1,17 +1,16 @@ -{ config, pkgs, lib, ... }: +{ pkgs, lib, ... }: let wrapHelix = { extraPackages ? [] , withPython3 ? true, extraPython3Packages ? (_: []) }: pkgs.symlinkJoin { postBuild = '' rm $out/bin/hx - makeWrapper ${lib.escapeShellArgs ( - [ "${pkgs.helix}/bin/hx" "${placeholder "out"}/bin/hx" ] - ++ [ "--suffix" "PATH" ":" (lib.makeBinPath (extraPackages ++ [(pkgs.python3.withPackages extraPython3Packages)])) ] - )} + makeWrapper ${lib.escapeShellArgs + [ "${pkgs.helix}/bin/hx" "${placeholder "out"}/bin/hx" + "--suffix" "PATH" ":" (lib.makeBinPath (extraPackages ++ [ (pkgs.python3.withPackages extraPython3Packages) ])) ]} ''; buildInputs = [ pkgs.makeWrapper ]; preferLocalBuild = true; name = "helix${pkgs.helix.version}"; paths = [ pkgs.helix ]; - passthru.unwrapped = pkgs.helix; meta = pkgs.helix.meta; version = pkgs.helix.version; + passthru.unwrapped = pkgs.helix; inherit (pkgs.helix) meta version; }; in { programs.helix = { diff --git a/home/common/kakoune.nix b/home/common/kakoune.nix index cd54f8c..6cd303e 100644 --- a/home/common/kakoune.nix +++ b/home/common/kakoune.nix @@ -1,17 +1,16 @@ -{ config, pkgs, lib, ... }: +{ pkgs, lib, ... }: let wrapKakoune = { extraPackages ? [] , withPython3 ? true, extraPython3Packages ? (_: []) }: pkgs.symlinkJoin { postBuild = '' rm $out/bin/kak - makeWrapper ${lib.escapeShellArgs ( - [ "${pkgs.kakoune-unwrapped}/bin/kak" "${placeholder "out"}/bin/kak" ] - ++ [ "--suffix" "PATH" ":" (lib.makeBinPath (extraPackages ++ [(pkgs.python3.withPackages extraPython3Packages)])) ] - )} + makeWrapper ${lib.escapeShellArgs + [ "${pkgs.kakoune-unwrapped}/bin/kak" "${placeholder "out"}/bin/kak" + "--suffix" "PATH" ":" (lib.makeBinPath (extraPackages ++ [ (pkgs.python3.withPackages extraPython3Packages) ])) ]} ''; buildInputs = [ pkgs.makeWrapper ]; preferLocalBuild = true; name = "kakoune${pkgs.kakoune-unwrapped.version}"; paths = [ pkgs.kakoune-unwrapped ]; - passthru.unwrapped = pkgs.kakoune-unwrapped; meta = pkgs.kakoune-unwrapped.meta; version = pkgs.kakoune-unwrapped.version; + passthru.unwrapped = pkgs.kakoune-unwrapped; inherit (pkgs.kakoune-unwrapped) meta version; }; in { programs.kakoune = { diff --git a/home/common/nvim.nix b/home/common/nvim.nix index dd70ebe..f36bffa 100644 --- a/home/common/nvim.nix +++ b/home/common/nvim.nix @@ -15,7 +15,11 @@ # welcome to my cursed DSL programs.neovim = let notlua-nvim = notlua.neovim { inherit (config.programs.neovim) plugins extraLuaPackages; }; - inherit (notlua.keywords) CALL PROP SET LET DEFUN IF APPLY OR EQ RETURN ELSE IDX LETREC; + inherit (notlua.keywords) + AND APPLY CALL DEFUN + ELSE EQ GE IDX IF + LE LET LETREC OR + PROP RETURN SET; inherit (notlua.utils) compile; inherit (notlua-nvim.stdlib) vim string require print; inherit (notlua-nvim.keywords) REQ REQ'; @@ -144,18 +148,30 @@ LET (vim.filetype.match { inherit buf; }) (filetype: L [ CALL (PROP vim.cmd "folddoc") "foldopen!" _ IF (EQ filetype "gitcommit") ( - CALL vim.cmd { - cmd = "normal"; - bang = true; + vim.cmd { + cmd = "normal"; bang = true; args = [ "gg" ]; } - ) ELSE ( - CALL vim.cmd { - cmd = "normal"; - bang = true; - args = [ "g`\"" ]; - } - ) _ + ) ELSE (LET + (IDX (vim.api.nvim_buf_get_mark buf "\"") 1) + (vim.api.nvim_buf_line_count buf) + (pos: cnt: + IF (AND (GE pos 1) (LE pos cnt)) + (vim.cmd { + cmd = "normal"; bang = true; + args = [ "g`\"" ]; + }) + /*ELIF*/ (GE pos 1) + (vim.cmd { + cmd = "normal"; bang = true; + args = [ "g$" ]; + }) + ELSE + (vim.cmd { + cmd = "normal"; bang = true; + args = [ "gg" ]; + }) + )) _ ]); } ) _ @@ -448,13 +464,7 @@ cssls = { }; tsserver = { }; jsonls = { }; - nil_ls = { - settings = { - nil.nix.binary = "${pkgs.writeShellScript "nil-nix-wrapper" '' - nix --allow-import-from-derivation "$@" - ''}"; - }; - }; + nil_ls = { }; taplo = { }; marksman = { }; rust_analyzer = {