replace cursor with textmate

This commit is contained in:
Yan Lin 2026-01-05 21:39:14 +01:00
parent e754a9c329
commit 2db8e08136
4 changed files with 39 additions and 140 deletions

View file

@ -18,7 +18,6 @@
../../modules/tex.nix ../../modules/tex.nix
../../modules/fonts.nix ../../modules/fonts.nix
../../modules/linearmouse.nix ../../modules/linearmouse.nix
../../modules/cursor.nix
]; ];
nixpkgs.config.allowUnfree = true; nixpkgs.config.allowUnfree = true;
@ -233,44 +232,44 @@
# Uses duti to set default applications for file types via Launch Services # Uses duti to set default applications for file types via Launch Services
home.activation.setFileAssociations = config.lib.dag.entryAfter ["writeBoundary"] '' home.activation.setFileAssociations = config.lib.dag.entryAfter ["writeBoundary"] ''
# Text and code files - open with TextMate # Text and code files - open with TextMate
run ${pkgs.duti}/bin/duti -s com.todesktop.230313mzl4w4u92 .txt all run ${pkgs.duti}/bin/duti -s com.macromates.TextMate .txt all
run ${pkgs.duti}/bin/duti -s com.todesktop.230313mzl4w4u92 .md all run ${pkgs.duti}/bin/duti -s com.macromates.TextMate .md all
run ${pkgs.duti}/bin/duti -s com.todesktop.230313mzl4w4u92 .markdown all run ${pkgs.duti}/bin/duti -s com.macromates.TextMate .markdown all
run ${pkgs.duti}/bin/duti -s com.todesktop.230313mzl4w4u92 .nix all run ${pkgs.duti}/bin/duti -s com.macromates.TextMate .nix all
run ${pkgs.duti}/bin/duti -s com.todesktop.230313mzl4w4u92 .sh all run ${pkgs.duti}/bin/duti -s com.macromates.TextMate .sh all
run ${pkgs.duti}/bin/duti -s com.todesktop.230313mzl4w4u92 .bash all run ${pkgs.duti}/bin/duti -s com.macromates.TextMate .bash all
run ${pkgs.duti}/bin/duti -s com.todesktop.230313mzl4w4u92 .zsh all run ${pkgs.duti}/bin/duti -s com.macromates.TextMate .zsh all
run ${pkgs.duti}/bin/duti -s com.todesktop.230313mzl4w4u92 .fish all run ${pkgs.duti}/bin/duti -s com.macromates.TextMate .fish all
run ${pkgs.duti}/bin/duti -s com.todesktop.230313mzl4w4u92 .py all run ${pkgs.duti}/bin/duti -s com.macromates.TextMate .py all
run ${pkgs.duti}/bin/duti -s com.todesktop.230313mzl4w4u92 .js all run ${pkgs.duti}/bin/duti -s com.macromates.TextMate .js all
run ${pkgs.duti}/bin/duti -s com.todesktop.230313mzl4w4u92 .ts all run ${pkgs.duti}/bin/duti -s com.macromates.TextMate .ts all
run ${pkgs.duti}/bin/duti -s com.todesktop.230313mzl4w4u92 .jsx all run ${pkgs.duti}/bin/duti -s com.macromates.TextMate .jsx all
run ${pkgs.duti}/bin/duti -s com.todesktop.230313mzl4w4u92 .tsx all run ${pkgs.duti}/bin/duti -s com.macromates.TextMate .tsx all
run ${pkgs.duti}/bin/duti -s com.todesktop.230313mzl4w4u92 .json all run ${pkgs.duti}/bin/duti -s com.macromates.TextMate .json all
run ${pkgs.duti}/bin/duti -s com.todesktop.230313mzl4w4u92 .yaml all run ${pkgs.duti}/bin/duti -s com.macromates.TextMate .yaml all
run ${pkgs.duti}/bin/duti -s com.todesktop.230313mzl4w4u92 .yml all run ${pkgs.duti}/bin/duti -s com.macromates.TextMate .yml all
run ${pkgs.duti}/bin/duti -s com.todesktop.230313mzl4w4u92 .toml all run ${pkgs.duti}/bin/duti -s com.macromates.TextMate .toml all
run ${pkgs.duti}/bin/duti -s com.todesktop.230313mzl4w4u92 .xml all run ${pkgs.duti}/bin/duti -s com.macromates.TextMate .xml all
run ${pkgs.duti}/bin/duti -s com.todesktop.230313mzl4w4u92 .css all run ${pkgs.duti}/bin/duti -s com.macromates.TextMate .css all
run ${pkgs.duti}/bin/duti -s com.todesktop.230313mzl4w4u92 .log all run ${pkgs.duti}/bin/duti -s com.macromates.TextMate .log all
run ${pkgs.duti}/bin/duti -s com.todesktop.230313mzl4w4u92 .csv all run ${pkgs.duti}/bin/duti -s com.macromates.TextMate .csv all
run ${pkgs.duti}/bin/duti -s com.todesktop.230313mzl4w4u92 .conf all run ${pkgs.duti}/bin/duti -s com.macromates.TextMate .conf all
run ${pkgs.duti}/bin/duti -s com.todesktop.230313mzl4w4u92 .config all run ${pkgs.duti}/bin/duti -s com.macromates.TextMate .config all
run ${pkgs.duti}/bin/duti -s com.todesktop.230313mzl4w4u92 .ini all run ${pkgs.duti}/bin/duti -s com.macromates.TextMate .ini all
run ${pkgs.duti}/bin/duti -s com.todesktop.230313mzl4w4u92 .env all run ${pkgs.duti}/bin/duti -s com.macromates.TextMate .env all
run ${pkgs.duti}/bin/duti -s com.todesktop.230313mzl4w4u92 .c all run ${pkgs.duti}/bin/duti -s com.macromates.TextMate .c all
run ${pkgs.duti}/bin/duti -s com.todesktop.230313mzl4w4u92 .cpp all run ${pkgs.duti}/bin/duti -s com.macromates.TextMate .cpp all
run ${pkgs.duti}/bin/duti -s com.todesktop.230313mzl4w4u92 .h all run ${pkgs.duti}/bin/duti -s com.macromates.TextMate .h all
run ${pkgs.duti}/bin/duti -s com.todesktop.230313mzl4w4u92 .hpp all run ${pkgs.duti}/bin/duti -s com.macromates.TextMate .hpp all
run ${pkgs.duti}/bin/duti -s com.todesktop.230313mzl4w4u92 .rs all run ${pkgs.duti}/bin/duti -s com.macromates.TextMate .rs all
run ${pkgs.duti}/bin/duti -s com.todesktop.230313mzl4w4u92 .go all run ${pkgs.duti}/bin/duti -s com.macromates.TextMate .go all
run ${pkgs.duti}/bin/duti -s com.todesktop.230313mzl4w4u92 .java all run ${pkgs.duti}/bin/duti -s com.macromates.TextMate .java all
run ${pkgs.duti}/bin/duti -s com.todesktop.230313mzl4w4u92 .rb all run ${pkgs.duti}/bin/duti -s com.macromates.TextMate .rb all
run ${pkgs.duti}/bin/duti -s com.todesktop.230313mzl4w4u92 .php all run ${pkgs.duti}/bin/duti -s com.macromates.TextMate .php all
run ${pkgs.duti}/bin/duti -s com.todesktop.230313mzl4w4u92 .lua all run ${pkgs.duti}/bin/duti -s com.macromates.TextMate .lua all
run ${pkgs.duti}/bin/duti -s com.todesktop.230313mzl4w4u92 .vim all run ${pkgs.duti}/bin/duti -s com.macromates.TextMate .vim all
run ${pkgs.duti}/bin/duti -s com.todesktop.230313mzl4w4u92 .tex all run ${pkgs.duti}/bin/duti -s com.macromates.TextMate .tex all
run ${pkgs.duti}/bin/duti -s com.todesktop.230313mzl4w4u92 .bib all run ${pkgs.duti}/bin/duti -s com.macromates.TextMate .bib all
# Documents - PDF with PDF Expert # Documents - PDF with PDF Expert
run ${pkgs.duti}/bin/duti -s com.readdle.PDFExpert-Mac .pdf all run ${pkgs.duti}/bin/duti -s com.readdle.PDFExpert-Mac .pdf all

View file

@ -49,7 +49,6 @@
dashboard-in-overlay = false; # Show Dashboard as overlay dashboard-in-overlay = false; # Show Dashboard as overlay
persistent-apps = [ persistent-apps = [
"/Applications/Ghostty.app" "/Applications/Ghostty.app"
"/Applications/Cursor.app"
"/Applications/Firefox.app" "/Applications/Firefox.app"
"/Applications/Obsidian.app" "/Applications/Obsidian.app"
"/Applications/KeePassXC.app" "/Applications/KeePassXC.app"

View file

@ -1,99 +0,0 @@
{ config, pkgs, lib, ... }:
with lib;
let
cfg = config.programs.cursor;
configDir = if pkgs.stdenv.isDarwin
then "Library/Application Support/Cursor/User"
else ".config/Cursor/User";
cursorCmd = if pkgs.stdenv.isDarwin
then "/opt/homebrew/bin/cursor"
else "cursor";
extensions = [
"vscodevim.vim"
"jdinhlife.gruvbox"
"jnoortheen.nix-ide"
"tomoki1207.pdf"
];
ideSettings = {
"editor.fontFamily" = "'JetBrainsMono Nerd Font Mono', 'Noto Sans CJK SC', 'Noto Sans CJK TC', 'Noto Sans CJK JP', monospace";
"editor.fontSize" = 14;
"editor.tabSize" = 2;
"editor.insertSpaces" = true;
"editor.wordWrap" = "off";
"editor.lineNumbers" = "on";
"editor.autoIndent" = "advanced";
"workbench.colorTheme" = "Gruvbox Dark Hard";
"git.openRepositoryInParentFolders" = "never";
"extensions.ignoreRecommendations" = true;
"cursor.cpp.disabledLanguages" = [
"plaintext"
];
"vim.leader" = "<space>";
"vim.useSystemClipboard" = true;
"vim.normalModeKeyBindingsNonRecursive" = [
{ before = ["<leader>" "w"]; commands = ["workbench.action.files.save"]; }
{ before = ["<leader>" "q"]; commands = ["workbench.action.closeActiveEditor"]; }
{ before = ["<leader>" "e"]; commands = ["workbench.action.toggleSidebarVisibility"]; }
{ before = ["<S-h>"]; commands = ["workbench.action.previousEditor"]; }
{ before = ["<S-l>"]; commands = ["workbench.action.nextEditor"]; }
{ before = ["<leader>" "x"]; commands = ["workbench.action.closeActiveEditor"]; }
{ before = ["<leader>" "X"]; commands = ["workbench.action.closeOtherEditors"]; }
{ before = ["<leader>" "t"]; commands = ["workbench.action.quickOpen"]; }
{ before = ["<leader>" "g"]; commands = ["workbench.action.findInFiles"]; }
{ before = ["<leader>" "f"]; commands = ["revealFileInOS"]; }
{ before = ["<C-h>"]; commands = ["workbench.action.focusSideBar"]; }
{ before = ["<C-l>"]; commands = ["workbench.action.focusActiveEditorGroup"]; }
];
};
cliConfig = {};
in
{
options.programs.cursor = {
package = mkOption {
type = types.nullOr types.package;
default = null;
example = "pkgs.code-cursor";
description = "Cursor package to use. Set to null on Darwin to use Homebrew-installed Cursor, or pkgs.code-cursor on NixOS.";
};
};
config = {
home.packages = mkIf (cfg.package != null) [ cfg.package ];
home.file."${configDir}/settings.json" = {
text = builtins.toJSON ideSettings;
};
home.file.".cursor/cli-config.json" = {
text = builtins.toJSON cliConfig;
};
home.activation.installCursorExtensions = config.lib.dag.entryAfter ["writeBoundary"] ''
if command -v ${cursorCmd} &> /dev/null; then
desired="${lib.concatStringsSep " " extensions}"
installed=$(${cursorCmd} --list-extensions 2>/dev/null | tr '[:upper:]' '[:lower:]')
for ext in $installed; do
if ! echo "$desired" | tr '[:upper:]' '[:lower:]' | grep -qw "$ext"; then
run ${cursorCmd} --uninstall-extension "$ext" &> /dev/null || true
fi
done
for ext in ${lib.concatStringsSep " " extensions}; do
run ${cursorCmd} --install-extension "$ext" &> /dev/null || true
done
fi
'';
};
}

View file

@ -14,7 +14,7 @@
]; ];
casks = [ casks = [
# GUI applications - manually installed apps now managed by Homebrew # GUI applications - manually installed apps now managed by Homebrew
"cursor" "textmate"
"keepassxc" "keepassxc"
"keycastr" "keycastr"
"inkscape" "inkscape"