Compare commits
2 Commits
51ccb26c4b
...
cd54ba5eb9
| Author | SHA1 | Date | |
|---|---|---|---|
| cd54ba5eb9 | |||
| 40bfd1cdf6 |
@@ -823,6 +823,13 @@
|
|||||||
(setq major-mode-remap-alist
|
(setq major-mode-remap-alist
|
||||||
'((python-mode . python-ts-mode)))
|
'((python-mode . python-ts-mode)))
|
||||||
|
|
||||||
|
(use-package lsp-pyright
|
||||||
|
:ensure t
|
||||||
|
:custom (lsp-pyright-langserver-command "basedpyright")
|
||||||
|
:hook (python-ts-mode . (lambda ()
|
||||||
|
(require 'lsp-pyright)
|
||||||
|
(lsp))))
|
||||||
|
|
||||||
(setq lsp-pylsp-plugins-flake8-ignore '("D100" "D101" "D102"))
|
(setq lsp-pylsp-plugins-flake8-ignore '("D100" "D101" "D102"))
|
||||||
|
|
||||||
|
|
||||||
@@ -1047,40 +1054,7 @@ any directory proffered by `consult-dir'."
|
|||||||
(eshell/cd (substring-no-properties
|
(eshell/cd (substring-no-properties
|
||||||
(consult-dir--pick "Switch directory: ")))))
|
(consult-dir--pick "Switch directory: ")))))
|
||||||
(t (eshell/cd (if regexp (eshell-find-previous-directory regexp)
|
(t (eshell/cd (if regexp (eshell-find-previous-directory regexp)
|
||||||
(completing-read "cd: " eshell-dirs)))))))
|
(completing-read "cd: " eshell-dirs))))))))
|
||||||
|
|
||||||
(defun eshell/mkenv (&rest args)
|
|
||||||
"Initialize a devenv environment or configure its .envrc.
|
|
||||||
|
|
||||||
With optional argument --here or -h, forces execution in the
|
|
||||||
current directory instead of the project root."
|
|
||||||
(interactive)
|
|
||||||
(let* ((here-flag (or (member "--here" args) (member "-h" args)))
|
|
||||||
(project-root
|
|
||||||
;; Use Projectile to find the root if available, otherwise fallback to git.
|
|
||||||
(cond
|
|
||||||
((fboundp 'project-root) (project-root (project-current)))
|
|
||||||
((shell-command-to-string "git rev-parse --is-inside-work-tree")
|
|
||||||
(string-trim (shell-command-to-string "git rev-parse --show-toplevel")))))
|
|
||||||
(target-dir
|
|
||||||
(if (or here-flag (not project-root))
|
|
||||||
default-directory
|
|
||||||
project-root))
|
|
||||||
;; Localize all file operations to the target directory
|
|
||||||
(default-directory target-dir))
|
|
||||||
|
|
||||||
(if (not (file-exists-p "devenv.nix"))
|
|
||||||
;; If it doesn't exist, we assume this is a new project.
|
|
||||||
(call-process "devenv" nil 0 nil "init"))
|
|
||||||
|
|
||||||
(when (not (file-exists-p ".envrc"))
|
|
||||||
;; If .envrc is missing, create and configure it for devenv.
|
|
||||||
(with-temp-file ".envrc"
|
|
||||||
(insert "eval \"$(devenv direnvrc)\"")))
|
|
||||||
|
|
||||||
(if (file-exists-p "devenv.nix")
|
|
||||||
(find-file (expand-file-name "devenv.nix" target-dir))
|
|
||||||
(message "Could not open devenv.nix as it was not created.")))))
|
|
||||||
|
|
||||||
(use-package eshell
|
(use-package eshell
|
||||||
:bind (:map eshell-hist-mode-map
|
:bind (:map eshell-hist-mode-map
|
||||||
|
|||||||
@@ -28,7 +28,6 @@
|
|||||||
aider-chat
|
aider-chat
|
||||||
sops
|
sops
|
||||||
just
|
just
|
||||||
devenv
|
|
||||||
];
|
];
|
||||||
|
|
||||||
imports = [
|
imports = [
|
||||||
|
|||||||
@@ -64,40 +64,6 @@ let tide_conf = builtins.readFile ./tide_config.fish; in
|
|||||||
command ssh $argv
|
command ssh $argv
|
||||||
end
|
end
|
||||||
|
|
||||||
function mkenv --description "Initialize a devenv environment or configure its .envrc"
|
|
||||||
argparse --name=mkenv h/here -- $argv
|
|
||||||
or return 1 # Exit if parsing fails
|
|
||||||
|
|
||||||
# Default target directory is the current directory.
|
|
||||||
set -l target_dir "."
|
|
||||||
|
|
||||||
# Check if we are inside a Git repository's working tree.
|
|
||||||
if git rev-parse --is-inside-work-tree >/dev/null 2>&1
|
|
||||||
if not set -q _flag_here; and not test -f devenv.nix
|
|
||||||
set target_dir (git rev-parse --show-toplevel)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
pushd "$target_dir"
|
|
||||||
|
|
||||||
# Check for the existence of the primary devenv configuration file.
|
|
||||||
if not test -f "devenv.nix"
|
|
||||||
devenv init
|
|
||||||
else
|
|
||||||
# If devenv.nix exists, check for the direnv configuration file.
|
|
||||||
if not test -f ".envrc"
|
|
||||||
echo 'eval "$(devenv direnvrc)"' > .envrc
|
|
||||||
direnv allow
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
if test -f "devenv.nix"
|
|
||||||
emacsclient devenv.nix
|
|
||||||
else
|
|
||||||
echo -e "\e[31mCould not open devenv.nix as it was not created.\e[0m"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
if test -f $HOME/.cargo/env.fish
|
if test -f $HOME/.cargo/env.fish
|
||||||
source "$HOME/.cargo/env.fish"
|
source "$HOME/.cargo/env.fish"
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user