about summary refs log tree commit diff stats
path: root/edit
Commit message (Collapse)AuthorAgeFilesLines
* 2368 - start getting edit working againKartik K. Agaram2015-11-051-16/+11
| | | | | Still seeing repeated null refinements. Maybe my approach to fixing those errors is fundamentally broken.
* 2309Kartik K. Agaram2015-10-2811-468/+468
|
* 2267Kartik K. Agaram2015-10-091-1/+1
| | | | | Introducing a new 'newlayer' tag like 'todo', to record places where a nascent new layer might be starting to bud off.
* 2260 - start tracing by depth rather than labelKartik K. Agaram2015-10-067-25/+25
| | | | Now we can collect all traces, just modulating the depth.
* 2247 - type-check products of non-primitive recipesKartik K. Agaram2015-10-053-14/+14
| | | | | | | | We still can't check ingredient types, and even this is still a run-time check. We'll need to start tracking recipe signatures at some point. I've had to introduce a hack called /skiptypecheck. Time to get generics working.
* 2234 - check type of get's productKartik K. Agaram2015-10-021-9/+9
| | | | Already I'm finding type errors in the programming environment.
* 2227 - offset-checking for containersKartik K. Agaram2015-10-011-7/+23
|
* 2226 - standardize warning formatKartik K. Agaram2015-10-011-5/+5
| | | | | | | | Always show recipe name where error occurred. But don't show internal 'interactive' name for sandboxes, that's just confusing. What started out as warnings are now ossifying into errors that halt all execution. Is this how things went with C and Unix as well?
* 2218 - check types in instructions much earlierKartik K. Agaram2015-09-301-1/+1
| | | | | | | | | Front-loads it a bit more than I'd like, but the payoff is that other recipes will now be able to describe the type checks right next to their operation. I'm also introducing a new use of /raw with literals to indicate unsafe typecasts.
* 2216Kartik K. Agaram2015-09-292-1/+13
|
* 2206 - fix missing ingredientsKartik K. Agaram2015-09-261-2/+2
| | | | | How the heck was this working until now? There must be redundant moves. And was I clobbering test data?
* 2183 - environment + external editor using tmuxKartik K. Agaram2015-09-125-18/+10
| | | | Thanks Jack and Caleb Couch for the idea.
* 2182Kartik K. Agaram2015-09-122-3/+1
|
* 2180 - render the trace even if there's warningsKartik K. Agaram2015-09-102-1/+53
|
* 2179 - undo bugfixKartik K. Agaram2015-09-102-1/+22
|
* 2177Kartik K. Agaram2015-09-071-0/+0
|
* 2176Kartik K. Agaram2015-09-061-0/+32
|
* 2173 - 'main' for 'mu edit' running layers 1 and 2Kartik K. Agaram2015-09-061-1/+42
| | | | | | Layer 2 provides an almost fully functioning interactive editor: $ ./mu edit/00[12]* -- abcdef
* 2172 - 'main' for 'mu edit' running just layer 1Kartik K. Agaram2015-09-062-1/+14
| | | | | | | | | Takes the text to render inside the editor on the commandline: $ ./mu edit/001-editor.mu -- abcdef Layer 1 has no interactivity. Just shows the text you pass in on the commandline, wrapping as you would expect. Press any key to exit.
* 2167Kartik K. Agaram2015-09-052-4/+18
|
* 2166Kartik K. Agaram2015-09-053-168/+221
|
* 2164Kartik K. Agaram2015-09-051-2/+1
|
* 2163Kartik K. Agaram2015-09-053-17/+19
| | | | | | | | `render-string` (and `render-code-string`; ugh) should start a new line after, not before, like everybody else. I've been meaning to fix this for a long time, but now I have to, to move the warnings fields out of early layers.
* 2162Kartik K. Agaram2015-09-051-16/+2
|
* 2161Kartik K. Agaram2015-09-051-8/+8
| | | | | Starting on making the basic programming environment oblivious to warnings. That should come later.
* 2160Kartik K. Agaram2015-09-054-0/+0
|
* 2159Kartik K. Agaram2015-09-052-139/+139
|
* 2157 - edit/ now contains real layersKartik K. Agaram2015-09-054-48/+74
| | | | | | | | | To run just until say layer 6, say this: $ ./mu test edit/00[0-6]* The layers are not perfect yet; there might be a few things (like the warning fields) that need to move to a later layer.
* 2156 - split edit.mu into multiple filesKartik K. Agaram2015-09-0512-0/+8903
Now you can bring up the programming environment by saying: $ mu edit The files under edit aren't yet *layers*, though, they have a few dependencies that we need to clean up.
2dd370fccfaa184b68f69107ada'>589ed39 ^
0688f25 ^
a434298 ^




ba35d6c ^

b042b51 ^
ba35d6c ^
a434298 ^











589ed39 ^
a434298 ^

5b7ad8f ^


a434298 ^
87ec731 ^
39cd18a ^







a434298 ^
87ec731 ^


















f65bef6 ^

011c3d5 ^









8d635cc ^
011c3d5 ^
8d635cc ^
011c3d5 ^
8d635cc ^
011c3d5 ^
1c46d4f ^
011c3d5 ^

c08264d ^

a434298 ^









c6f468f ^




a434298 ^





589ed39 ^

a434298 ^



589ed39 ^
a434298 ^


589ed39 ^

a434298 ^

22a857f ^


a434298 ^


22a857f ^

a434298 ^
b428418 ^









a434298 ^



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
                           


















                                
                                               



                                                        
                                           







                                 
                                   

      



                                










                                                                                           
                          
 
                                                                
 
                                                                                                                                                                                                    
                                                                                                                                                                                                                                          
 
                                                                                                                                                                                                                
                                                                                                                                                                                       
                                                                                                             
                                                                                    
 

                                                                                     

                    



                                     






                                                 
                                            







                                                                                                                                      
 


                                                                  
                  
                                   
                                                                                                                              





                                                                                             




                                        



                                                                                                                    


                                                                                                                                  
                                                                           
 
                       




                                                  

                                                                                          
                                                                                  
 











                                                                                                 
 

                                                   


                                                                 
                                                                             
                                                                                        







                                                                                                                                       
 


















                                                                              

                                                                                    









                                                     
                               
                               
                                      
            
                                                               
          
             

       

                                                    









                                                     




                                     





                                              

                                                                              



                                   
                                                                 


                                              

                                                                                     

       


                                                        


                          

                                                        
       









                                                                  



      
{ config, pkgs, lib, ... }:

{
  home.packages = with pkgs; [
    zsh-completions
  ];

  programs.fzf = {
    enable = true;
    enableZshIntegration = true;
  };
  programs.zoxide = {
    enable = true;
    enableZshIntegration = true;
  };
  programs.direnv = {
    enable = true;
    nix-direnv.enable = true;
  };
  programs.keychain = {
    enable = lib.mkIf pkgs.stdenv.isLinux true;
    agents = [ "ssh" "gpg"];
    keys = [ "id_rsa" "id_ed25519" "C171251002C200F2" ];
  #  extraFlags = [ "--quiet" "--ignore-missing" ];
  };
  programs.command-not-found.enable = true;
  programs.zsh = {
    enable = true;
    enableCompletion = true;
    enableAutosuggestions = true;
    defaultKeymap = "emacs";
    history = {
      size = 100000;
      save = 100000;
      expireDuplicatesFirst = true;
    };

    envExtra = ''
      export LSP_USE_PLISTS=true
      export LESS=-iRXF
    '';
    profileExtra = ''
      [[ -f ~/.nix-profile/etc/profile.d/nix.sh ]] && . ~/.nix-profile/etc/profile.d/nix.sh
      path=(~/bin
            ~/.local/bin
            ~/go/bin/
            $path)
    '';
    shellAliases = {
      cp = "cp -iv";
      mv = "mv -iv";
      mkdir = "mkdir -v";
      tree = "exa --tree";

      pp = "pushbullet push \"Pixel\" link \"\${1}\" \"\${1}\"";

      upgrade_emacs = "cp ~/.emacs.d/straight/versions/default.el ~/straight-versions-default-`date \"+%Y-%m-%d-%H%M%S\"`.el && emacs --batch -l \"~/.emacs.d/init.el\" -f \"my/upgrade-packages\"";
      diff_emacs = "difft --color always --context 0 $(ls -d1v ~/straight-versions-default-*.el | tail -1) ~/.emacs.d/straight/versions/default.el | grep '\\[9[12]' | egrep -v '(gnu-elpa-mirror|nongnu-elpa|melpa|emacsmirror-mirror)'";

      nix-up = "git -C ~/dotfiles pull && doas nix-channel --update && doas nixos-rebuild switch && nix-channel --update && home-manager switch && system-changes-report && hm-changes-report && df -h && date";
      _nix-up = "doas nix-channel --update && doas nixos-rebuild switch && nix-channel --update && home-manager switch && system-changes-report && hm-changes-report && df -h && date";
      home-up = "git -C ~/dotfiles pull && nix-channel --update && home-manager switch && hm-changes-report";
      _home-up = "nix-channel --update && home-manager switch && hm-changes-report";

      fb = "fzf --preview 'bat --color=always --style=numbers --line-range=:500 {}'";

      zz = "z $PWD";

      els = "ea run linear ls -- -1";
      erg = "ea run grouped rg --";
      fd = "ea run linear fd --";

      # Git log aliases from the omz git plugin
      gl = "git pull";
      glg = "git log --stat";
      glgp = "git log --stat -p";
      glgg = "git log --graph";
      glgga = "git log --graph --decorate --all";
      glgm = "git log --graph --max-count=10";
      glo_ = "git log --oneline --decorate";
      glol = "git log --graph --pretty=\"%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset\"";
      glols = "git log --graph --pretty=\"%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset\" --stat";
      glod = "git log --graph --pretty=\"%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset\"";
      glods = "git log --graph --pretty=\"%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ad) %C(bold blue)<%an>%Creset\" --date=short";
      glola = "git log --graph --pretty=\"%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%ar) %C(bold blue)<%an>%Creset\" --all";
      glog = "git log --oneline --decorate --graph";
      gloga = "git log --oneline --decorate --graph --all";
    };

    initExtraFirst = ''
      [[ $TERM == "tramp" ]] && unsetopt zle && PS1='$ ' && return
    '';
    initExtra = ''
      # Based on prezto tmux plugin
      if [[ -z "$TMUX" && -z "$EMACS" && -z "$VIM" && -z "$INSIDE_EMACS" && (-z "$SSH_TTY" || -n "$TMUX_AUTO_ATTACH") ]]; then
        tmux start-server

        if ! tmux has-session 2> /dev/null; then
          tmux new-session -d -s "0" \; set-option -t "0" destroy-unattached off &> /dev/null
        fi

        if [[ -n "$SSH_TTY" ]]; then
          exec tmux -u attach-session
        else
          exec tmux -u attach-session -d
        fi
      fi

      export FZF_DEFAULT_COMMAND='rg --files --no-ignore --hidden --follow -g "!{.git,node_modules}/*" 2> /dev/null'
      export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND"
      export FZF_ALT_C_COMMAND='rg --hidden --files --sort-files --null -g ""!{.git,node_modules}/*" | xargs -0 dirname | sort -u'
      export FZF_ALT_C_OPTS="--preview 'exa --tree {} | head -200'"
      export FZF_CTRL_R_OPTS="--preview 'echo {}' --preview-window down:3:hidden:wrap --bind 'ctrl-t:toggle-preview'"
      export FZF_DEFAULT_OPTS="--bind=ctrl-t:toggle-all --bind=ctrl-j:jump"

      eval "$(batpipe)"
      autopair-init
      enable-fzf-tab
      bindkey '^[[A' history-substring-search-up
      bindkey '^[[B' history-substring-search-down

      # make home and end work
      [[ -z "$terminfo[khome]" ]] || bindkey -M emacs "$terminfo[khome]" beginning-of-line
      [[ -z "$terminfo[kend]" ]] || bindkey -M emacs "$terminfo[kend]" end-of-line

      # disable sort when completing `git checkout`
      zstyle ''\':completion:*:git-checkout:*''\' sort false
      # set descriptions format to enable group support
      zstyle ''\':completion:*:descriptions''\' format ''\'[%d]''\'
      # Allow tab to expand aliases
      zstyle ':completion:*' completer _expand_alias _complete _ignored
      # set list-colors to enable filename colorizing
      #zstyle ''\':completion:*''\' list-colors ''${(s.:.)LS_COLORS}
      # preview directory''\'s content with exa when completing cd
      zstyle ''\':fzf-tab:complete:cd:*''\' fzf-preview ''\'exa -1 --color=always ''$realpath''\'
      # switch group using `,` and `.`
      zstyle ''\':fzf-tab:*''\' switch-group ''\',''\' ''\'.''\'

      set -o noclobber append_history share_history

      # disable flow control (so that fzf-git.sh's ^g^s can work)
      stty -ixon

      function generate () { gopass generate -s -p $1 $((RANDOM % 14 + 45)) }
      function fcd { cd $(fd -L --max-depth=''${1:-4} --type=d 2>/dev/null | fzf-tmux) }

      fif() {
        if [ ! "$#" -gt 0  ]; then
          echo "usage: fif <SEARCH_TERM>"
          return 1;
        fi
        rg --files-with-matches --no-messages "$1" | fzf $FZF_PREVIEW_WINDOW --preview "rg --ignore-case --pretty --context 10 '$1' {}"
      }

      fe() {
        IFS=$'\n' files=($(fzf-tmux --query="$1" --multi --select-1 --exit-0))
        [[ -n "$files" ]] && ''${EDITOR:-vim} "''${files[@]}"
      }

      ..() {
        local declare dirs=()
        get_parent_dirs() {
          if [[ -d "''${1}" ]]; then dirs+=("$1"); else return; fi
          if [[ "''${1}" == '/' ]]; then
            for _dir in "''${dirs[@]}"; do echo $_dir; done
          else
            get_parent_dirs $(dirname "$1")
          fi
        }
        local DIR=$(get_parent_dirs $(realpath "$PWD/..") | fzf-tmux)
        cd "$DIR"
      }

      tre () { command tre "$@" -e && source "/tmp/tre_aliases_$USER" 2>/dev/null; }

      function gcd () {
        if [ $# -eq 0 ] ; then
          echo "Number of days must be specified" >&2
          return 1
        fi
        if ! [[ $1 =~ '^[0-9]+$' ]] ; then
          echo "Number of days must be a number" >&2
          return 2
        fi

        DOAS=$(command -v doas)
        if  [ $1 -eq 0 ] ; then
          $DOAS nix-collect-garbage -d
        else
          $DOAS nix-collect-garbage --delete-older-than ''${1}d
        fi
        df -h
      }

      [[ ! -f ~/.zsh.local ]] || source ~/.zsh.local

      [[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
    '';

   plugins = with pkgs; [
      {
        name = "zsh-autopair";
        src = zsh-autopair;
        file = "share/zsh/zsh-autopair/autopair.zsh";
      }
      {
        name = "zsh-bd";
        src = zsh-bd;
        file = "share/zsh-bd/bd.zsh";
      }
      {
        name = "zsh-fzf-tab";
        src = zsh-fzf-tab;
        file = "share/fzf-tab/fzf-tab.zsh";
      }
      {
        name = "zsh-fast-syntax-highlighting";
        src = zsh-fast-syntax-highlighting;
        file = "share/zsh/site-functions/fast-syntax-highlighting.plugin.zsh";
      }
      {
        name = "zsh-powerlevel10k";
        src = zsh-powerlevel10k;
        file = "share/zsh-powerlevel10k/powerlevel10k.zsh-theme";
      }
      {
        name = "zsh-history-substring-search";
        src = zsh-history-substring-search;
        file = "share/zsh-history-substring-search/zsh-history-substring-search.zsh";
      }
      {
        name = "zsh-forgit";
        src = zsh-forgit;
        file = "share/zsh/zsh-forgit/forgit.plugin.zsh";
      }
      {
        name = "zsh-edit";
        src = zsh-edit;
        file = "share/zsh/zsh-edit/zsh-edit.plugin.zsh";
      }
      {
        name = "fzf-git.sh";
        src = fetchFromGitHub {
          owner = "junegunn";
          repo = "fzf-git.sh";
          rev = "9190e1bf7273d85f435fa759a5c3b20e588e9f7e";
          sha256 = "2CGjk1oTXip+eAJMuOk/X3e2KTwfwzcKTcGToA2xPd4=";
        };
        file = "fzf-git.sh";
      }
    ];
  };
}