diff options
author | Ben Sima <ben@bsima.me> | 2020-12-28 20:20:13 -0500 |
---|---|---|
committer | Ben Sima <ben@bsima.me> | 2020-12-28 20:20:13 -0500 |
commit | 5b6c9313d0e766899eb3f3ce634e3fdaf6d68245 (patch) | |
tree | 1be27742f079801728566882df0f8fb65fda16c0 /Biz | |
parent | 13148a011bbfc96042fbe3965d9dc2bd93a9a047 (diff) |
ide: add ftags script
Diffstat (limited to 'Biz')
-rw-r--r-- | Biz/Bild/Rules.nix | 9 | ||||
-rw-r--r-- | Biz/Bild/ShellHook.sh | 15 | ||||
-rwxr-xr-x | Biz/Ide/ftags.sh | 18 |
3 files changed, 25 insertions, 17 deletions
diff --git a/Biz/Bild/Rules.nix b/Biz/Bild/Rules.nix index a8695eb..f5f016f 100644 --- a/Biz/Bild/Rules.nix +++ b/Biz/Bild/Rules.nix @@ -3,6 +3,9 @@ with nixpkgs; let + ghcCompiler = "ghc865"; + ghcjsCompiler = "ghcjs86"; + # provided by .envrc root = builtins.getEnv "BIZ_ROOT"; @@ -50,8 +53,8 @@ let ${toString (lib.lists.subtractLists haskellDeps deps)} '')); - ghc_ = mkGhc pkgs.haskell.packages.ghc865.ghcWithHoogle; - ghcjs_ = mkGhc pkgs.haskell.packages.ghcjs86.ghcWithPackages; + ghc_ = mkGhc pkgs.haskell.packages.${ghcCompiler}.ghcWithHoogle; + ghcjs_ = mkGhc pkgs.haskell.packages.${ghcjsCompiler}.ghcWithPackages; in { ghc = main: let @@ -131,6 +134,7 @@ in { # tools nixpkgs.cmark + nixpkgs.haskell.packages.${ghcCompiler}.fast-tags nixpkgs.figlet nixpkgs.hlint nixpkgs.lolcat @@ -140,6 +144,7 @@ in { nixpkgs.python37Packages.black nixpkgs.python37Packages.pylint nixpkgs.wemux + (pkgs.writeScriptBin "ftags" (builtins.readFile ../Ide/ftags.sh)) ]; shellHook = ". ${./ShellHook.sh}"; }; diff --git a/Biz/Bild/ShellHook.sh b/Biz/Bild/ShellHook.sh index 7b43d26..7724c28 100644 --- a/Biz/Bild/ShellHook.sh +++ b/Biz/Bild/ShellHook.sh @@ -124,18 +124,3 @@ function ci() { } help - -# ftags - search ctags -ftags() { - local line - if [[ -e tags ]] - then - line=$( - awk 'BEGIN { FS="\t" } !/^!/ {print toupper($4)"\t"$1"\t"$2"\t"$3}' tags | \ - cut -c1-80 | fzf --nth=1,2 - ) - ${EDITOR:-vim} \ - $(cut -f3 <<< "$line") -c "set nocst" \ - -c "silent tag $(cut -f2 <<< "$line")" - fi -} diff --git a/Biz/Ide/ftags.sh b/Biz/Ide/ftags.sh new file mode 100755 index 0000000..daa4ca0 --- /dev/null +++ b/Biz/Ide/ftags.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env bash +# ftags - search ctags +set -euo pipefail +tags=$BIZ_ROOT/tags +if [[ ! -e $tags ]] +then + fast-tags -R $BIZ_ROOT +else + line=$( + awk 'BEGIN { FS="\t" } !/^!/ {print toupper($4)"\t"$1"\t"$2"\t"$3}' $tags \ + | cut -c1-80 \ + | fzf --nth=1,2 + ) + ${EDITOR:-vim} \ + $(cut -f3 <<< "$line") \ + -c "set nocst" \ + -c "silent tag $(cut -f2 <<< "$line")" +fi |