1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- use str
- use prompt
- use nix-shell
- use title
- use eval-export
- use completion
- use pushd
- # don't use direlv if we're in a nix-shell to avoid nesting direlvs
- if (not (has-env IN_NIX_SHELL)) {
- use direlv
- }
- edit:add-var ls~ { |@a|
- e:ls --color=auto --group-directories-first -F --quoting-style literal $@a
- }
- if (has-external yadm) {
- set-env YADM_OVERRIDE_REPO ~/.dotfiles
- } else {
- edit:add-var yadm~ { |@a| git --git-dir=$E:HOME/.dotfiles/ --work-tree=$E:HOME $@a }
- }
- if (has-external delta) {
- set-env GIT_PAGER delta
- }
- # some additional bindings
- use readline-binding
- set edit:completion:binding[Ctrl-W] = $edit:close-mode~
- set edit:completion:binding[Tab] = $edit:completion:accept~
- var max-len = 30
- # print time if command takes longer than 5 seconds
- set edit:after-command = [{|m|
- if (> $m[duration] 5) {
- var cmd = $m[src][code]
- var len = (count $cmd)
- if (> $len $max-len) {
- set cmd = $cmd[..$max-len]…
- }
- printf "%s took %.3fs\n" $cmd $m[duration]
- }
- }]
- eval (carapace _carapace|slurp)
- # restrict completion to only directories
- set edit:completion:arg-completer[cd] = $completion:dirs~
- # import local.elv if present, for example, from ~/.config/elvish/lib/local.elv
- try {
- use local
- } catch e {
- if (not (str:contains (to-string $e[reason]) "no such module")) {
- fail $e
- }
- }
|