home | added bash_complition for doas
This commit is contained in:
parent
846d32d0eb
commit
6768888ec2
2 changed files with 54 additions and 3 deletions
50
home/bash_complition.nix
Normal file
50
home/bash_complition.nix
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
{ pkgs, ... }: {
|
||||
home.file = {
|
||||
doascomplete = {
|
||||
enable = true;
|
||||
target = ".bash_completion.d/doas.sh";
|
||||
text = ''
|
||||
_doas()
|
||||
{
|
||||
local cur prev words cword split
|
||||
_init_completion -s || return
|
||||
|
||||
local i mode=normal
|
||||
[[ ''$1 == *doasedit ]] && mode=edit
|
||||
|
||||
[[ ''$mode == normal ]] &&
|
||||
for ((i = 1; i <= cword; i++)); do
|
||||
if [[ ''${words[i]} != -* ]]; then
|
||||
local PATH=''$PATH:/sbin:/usr/sbin:/usr/local/sbin
|
||||
local root_command=''${words[i]}
|
||||
_command_offset ''$i
|
||||
return
|
||||
fi
|
||||
[[ ''${words[i]} == -@(!(-*)[uUgCp]) ]] &&
|
||||
((i++))
|
||||
done
|
||||
|
||||
case "''$prev" in
|
||||
-u)
|
||||
COMPREPLY=(''$(compgen -u -- "''$cur"))
|
||||
return
|
||||
;;
|
||||
esac
|
||||
|
||||
''$split && return
|
||||
|
||||
if [[ ''$cur == -* ]]; then
|
||||
local opts=''$(_parse_help "''$1")
|
||||
COMPREPLY=(''$(compgen -W ''${opts:-''$(_parse_usage "''$1")}' -- "''$cur"))
|
||||
[[ ''${COMPREPLY-} == *= ]] && compopt -o nospace
|
||||
return
|
||||
fi
|
||||
if [[ ''$mode == edit ]]; then
|
||||
_filedir
|
||||
fi
|
||||
} &&
|
||||
complete -F _doas doas
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -1,12 +1,13 @@
|
|||
{ config, pkgs, ... }:
|
||||
{
|
||||
imports = [
|
||||
./tmux.nix
|
||||
./neovim.nix
|
||||
./khard.nix
|
||||
./bash_complition.nix
|
||||
./khal.nix
|
||||
./khard.nix
|
||||
./liquidprompt.nix
|
||||
./neovim.nix
|
||||
./newsboat.nix
|
||||
./tmux.nix
|
||||
./vifm.nix
|
||||
];
|
||||
home.packages = with pkgs; [
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue