modules: move tui, gui, cli to programs
This commit is contained in:
parent
febb421800
commit
47a79eea64
106 changed files with 3 additions and 47 deletions
1
modules/programs/editors/default.nix
Normal file
1
modules/programs/editors/default.nix
Normal file
|
@ -0,0 +1 @@
|
|||
_: {imports = [./emacs.nix ./helix.nix ./kakoune ./nvf];}
|
169
modules/programs/editors/emacs.nix
Normal file
169
modules/programs/editors/emacs.nix
Normal file
|
@ -0,0 +1,169 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
inputs,
|
||||
...
|
||||
}: let
|
||||
cfg = config.modules.system.programs.editors.emacs;
|
||||
inherit (config.modules.other.system) username;
|
||||
inherit (lib) mkIf;
|
||||
|
||||
newpkgs =
|
||||
pkgs.appendOverlays
|
||||
(with inputs.emacs-overlay.overlays; [
|
||||
emacs
|
||||
package
|
||||
|
||||
(final: prev: {
|
||||
tree-sitter = prev.tree-sitter.override {
|
||||
extraGrammars = {
|
||||
tree-sitter-qmljs = {
|
||||
version = "master";
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "yuja";
|
||||
repo = "tree-sitter-qmljs";
|
||||
rev = "35ead5b9955cdb29bcf709d622fa960ff33992b6";
|
||||
sha256 = "jT47lEGuk6YUjcHB0ZMyL3i5PqyUaCQmt0j78cUpy8Q=";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
})
|
||||
]);
|
||||
|
||||
tree-sitter-parsers = grammars:
|
||||
with grammars; [
|
||||
tree-sitter-bash
|
||||
tree-sitter-c
|
||||
tree-sitter-c-sharp
|
||||
tree-sitter-cmake
|
||||
tree-sitter-cpp
|
||||
tree-sitter-css
|
||||
tree-sitter-dot
|
||||
tree-sitter-elisp
|
||||
tree-sitter-glsl
|
||||
tree-sitter-html
|
||||
tree-sitter-java
|
||||
tree-sitter-javascript
|
||||
tree-sitter-json
|
||||
tree-sitter-json5
|
||||
tree-sitter-kotlin
|
||||
tree-sitter-latex
|
||||
tree-sitter-llvm
|
||||
tree-sitter-lua
|
||||
tree-sitter-make
|
||||
tree-sitter-markdown
|
||||
tree-sitter-markdown-inline
|
||||
tree-sitter-nickel
|
||||
tree-sitter-nix
|
||||
tree-sitter-prisma
|
||||
tree-sitter-python
|
||||
tree-sitter-qmljs
|
||||
tree-sitter-regex
|
||||
tree-sitter-rust
|
||||
tree-sitter-scss
|
||||
tree-sitter-sql
|
||||
tree-sitter-toml
|
||||
tree-sitter-tsx
|
||||
tree-sitter-typescript
|
||||
tree-sitter-typst
|
||||
tree-sitter-vim
|
||||
tree-sitter-yaml
|
||||
];
|
||||
|
||||
custom-emacs = with newpkgs; ((emacsPackagesFor (emacs29-pgtk.override {withNativeCompilation = true;})).emacsWithPackages (epkgs:
|
||||
with epkgs; let
|
||||
qml-ts-mode = trivialBuild {
|
||||
pname = "qml-ts-mode";
|
||||
version = "master";
|
||||
src = fetchFromGitHub {
|
||||
owner = "outfoxxed";
|
||||
repo = "qml-ts-mode";
|
||||
rev = "b24b9e78305ed045baa136782623ad16de01b7b8";
|
||||
sha256 = "PgXm/a92cX5zjA9blTrIRH7DfOUczRwb9oBcMMEzF2I=";
|
||||
};
|
||||
};
|
||||
in [
|
||||
alert
|
||||
all-the-icons
|
||||
all-the-icons-dired
|
||||
avy
|
||||
beacon
|
||||
catppuccin-theme
|
||||
company
|
||||
crux
|
||||
dimmer
|
||||
dired-du
|
||||
dired-open
|
||||
direnv
|
||||
doom-modeline
|
||||
editorconfig
|
||||
emacs-all-the-icons-fonts
|
||||
evil
|
||||
evil-collection
|
||||
evil-goggles
|
||||
erc
|
||||
erc-hl-nicks
|
||||
flycheck
|
||||
form-feed
|
||||
general
|
||||
hl-todo
|
||||
kotlin-mode
|
||||
ligature
|
||||
lsp-mode
|
||||
lsp-treemacs
|
||||
lsp-ui
|
||||
lsp-java
|
||||
magit
|
||||
markdown-mode
|
||||
nasm-mode
|
||||
nix-mode
|
||||
no-littering
|
||||
reformatter # required by nix mode
|
||||
pdf-tools
|
||||
peep-dired
|
||||
projectile
|
||||
qml-ts-mode
|
||||
rainbow-delimiters
|
||||
rainbow-mode
|
||||
smartparens
|
||||
string-inflection
|
||||
tldr
|
||||
toc-org
|
||||
(treesit-grammars.with-grammars (grammars: tree-sitter-parsers grammars))
|
||||
treemacs
|
||||
treemacs-evil
|
||||
treemacs-projectile
|
||||
treemacs-magit
|
||||
undo-tree
|
||||
use-package
|
||||
vertico
|
||||
vterm
|
||||
vterm-toggle
|
||||
which-key
|
||||
wakatime-mode
|
||||
ws-butler
|
||||
]));
|
||||
in {
|
||||
config = mkIf cfg.enable {
|
||||
home-manager.users.${username} = {
|
||||
home.packages = with pkgs; [
|
||||
custom-emacs
|
||||
clang-tools
|
||||
ripgrep
|
||||
fd
|
||||
ispell
|
||||
findutils
|
||||
graphviz
|
||||
djvulibre
|
||||
hunspell
|
||||
sqlite
|
||||
];
|
||||
services.emacs = {
|
||||
enable = true;
|
||||
package = custom-emacs;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
66
modules/programs/editors/helix.nix
Normal file
66
modules/programs/editors/helix.nix
Normal file
|
@ -0,0 +1,66 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
inputs',
|
||||
...
|
||||
}: let
|
||||
cfg = config.modules.system.programs.editors.helix;
|
||||
inherit (config.modules.other.system) username;
|
||||
inherit (lib) mkIf getExe makeBinPath;
|
||||
in {
|
||||
config = mkIf cfg.enable {
|
||||
home-manager.users.${username} = {
|
||||
programs.helix = {
|
||||
enable = true;
|
||||
# thanks fuf, this is great!
|
||||
package = inputs'.helix.packages.default.overrideAttrs (previousAttrs: {
|
||||
makeWrapperArgs = with pkgs;
|
||||
previousAttrs.makeWrapperArgs
|
||||
or []
|
||||
++ [
|
||||
"--suffix"
|
||||
"PATH"
|
||||
":"
|
||||
(makeBinPath [
|
||||
clang-tools
|
||||
marksman
|
||||
nil
|
||||
bash-language-server
|
||||
shellcheck
|
||||
typst-lsp
|
||||
])
|
||||
];
|
||||
});
|
||||
settings = {
|
||||
editor = {
|
||||
indent-guides.render = true;
|
||||
lsp.display-inlay-hints = true;
|
||||
line-number = "relative";
|
||||
mouse = true;
|
||||
bufferline = "multiple";
|
||||
soft-wrap.enable = true;
|
||||
lsp.display-messages = true;
|
||||
cursor-shape = {insert = "bar";};
|
||||
statusline.left = ["mode" "spinner" "version-control" "file-name"];
|
||||
};
|
||||
keys.normal = {
|
||||
C-g = [":new" ":insert-output lazygit" ":buffer-close!" ":redraw"];
|
||||
esc = ["collapse_selection" "keep_primary_selection"];
|
||||
A-H = "goto_previous_buffer";
|
||||
A-L = "goto_next_buffer";
|
||||
A-w = ":buffer-close";
|
||||
};
|
||||
};
|
||||
languages = {
|
||||
language-server = {
|
||||
nil = {
|
||||
command = getExe pkgs.nil;
|
||||
config.nil.formatting.command = ["${getExe pkgs.alejandra}" "-q"];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
113
modules/programs/editors/kakoune.nix
Normal file
113
modules/programs/editors/kakoune.nix
Normal file
|
@ -0,0 +1,113 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}: let
|
||||
cfg = config.modules.system.programs.editors;
|
||||
inherit (config.modules.other.system) username;
|
||||
inherit (lib) mkIf;
|
||||
in {
|
||||
config = mkIf cfg.enable {
|
||||
home-manager.users.${username} = {
|
||||
programs.kakoune = {
|
||||
enable = true;
|
||||
plugins = with pkgs.kakounePlugins; [
|
||||
auto-pairs-kak
|
||||
fzf-kak
|
||||
powerline-kak
|
||||
byline-kak
|
||||
kakoune-lsp
|
||||
];
|
||||
config = {
|
||||
ui = {
|
||||
statusLine = "top";
|
||||
enableMouse = true;
|
||||
assistant = "none";
|
||||
};
|
||||
scrollOff.lines = 1;
|
||||
scrollOff.columns = 3;
|
||||
keyMappings = [
|
||||
{
|
||||
mode = "normal";
|
||||
key = "<esc>";
|
||||
effect = ";,";
|
||||
docstring = "Press escape to clear highlighted text and collapse cursors";
|
||||
}
|
||||
{
|
||||
mode = "normal";
|
||||
key = "<c-v>";
|
||||
effect = ":comment-line<ret>";
|
||||
docstring = "Comment a line with <c-v>!";
|
||||
}
|
||||
{
|
||||
mode = "normal";
|
||||
key = "b";
|
||||
effect = ":db<ret>";
|
||||
docstring = "close current buffer";
|
||||
}
|
||||
|
||||
{
|
||||
mode = "normal";
|
||||
key = "n";
|
||||
effect = ":bp<ret>";
|
||||
docstring = "go to next buffer";
|
||||
}
|
||||
{
|
||||
mode = "normal";
|
||||
key = "m";
|
||||
effect = ":bn<ret>";
|
||||
docstring = "go to next buffer";
|
||||
}
|
||||
{
|
||||
mode = "normal";
|
||||
key = " f";
|
||||
effect = ":fzf-mode<ret>";
|
||||
docstring = "open fzf";
|
||||
}
|
||||
];
|
||||
};
|
||||
extraConfig = ''
|
||||
# display line numbers
|
||||
add-highlighter global/ number-lines -hlcursor -relative -separator " " -cursor-separator " |"
|
||||
# show matching symbols
|
||||
add-highlighter global/ show-matching
|
||||
# Intenting
|
||||
set-option global tabstop 4
|
||||
set-option global indentwidth 4
|
||||
# Scrolloff
|
||||
set-option global scrolloff 8,3
|
||||
# spellcheck (requires aspell)
|
||||
map -docstring "check document for spelling" global user w ": spell<ret>"
|
||||
map -docstring "clear document spelling" global user q ": spell-clear<ret>"
|
||||
plug "alexherbo2/auto-pairs.kak" config %{
|
||||
enable-auto-pairs
|
||||
}
|
||||
plug "andreyorst/fzf.kak" config %{
|
||||
require-module fzf
|
||||
require-module fzf-grep
|
||||
require-module fzf-file
|
||||
} defer fzf %{
|
||||
set-option global fzf_highlight_command "lat -r {}"
|
||||
} defer fzf-file %{
|
||||
set-option global fzf_file_command "fd . --no-ignore-vcs"
|
||||
} defer fzf-grep %{
|
||||
set-option global fzf_grep_command "fd"
|
||||
}
|
||||
plug "andreyorst/powerline.kak" defer kakoune-themes %{
|
||||
powerline-theme pastel
|
||||
} defer powerline %{
|
||||
powerline-format global "git lsp bufname filetype mode_info lsp line_column position"
|
||||
set-option global powerline_separator_thin ""
|
||||
set-option global powerline_separator ""
|
||||
} config %{
|
||||
powerline-start
|
||||
}
|
||||
plug "evanrelf/byline.kak" config %{
|
||||
require-module "byline"
|
||||
}
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
66
modules/programs/editors/kakoune/default.nix
Normal file
66
modules/programs/editors/kakoune/default.nix
Normal file
|
@ -0,0 +1,66 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}: let
|
||||
inherit (config.modules.other.system) username;
|
||||
cfg = config.modules.system.programs.editors.kakoune;
|
||||
inherit (lib) mkIf mkEnableOption;
|
||||
in {
|
||||
imports = [./mappings.nix];
|
||||
options.modules.editors.kakoune.enable = mkEnableOption "kakoune";
|
||||
config.home-manager.users.${username}.programs.kakoune = mkIf cfg.enable {
|
||||
enable = true;
|
||||
package = pkgs.kakoune-unwrapped;
|
||||
config = {
|
||||
autoComplete = ["insert"];
|
||||
autoReload = "yes";
|
||||
indentWidth = 4;
|
||||
tabStop = 4;
|
||||
incrementalSearch = false;
|
||||
numberLines = {
|
||||
enable = true;
|
||||
relative = true;
|
||||
highlightCursor = true;
|
||||
separator = "|";
|
||||
};
|
||||
|
||||
scrollOff = {
|
||||
lines = 4;
|
||||
columns = 4;
|
||||
};
|
||||
wrapLines = {
|
||||
enable = true;
|
||||
indent = true;
|
||||
word = true;
|
||||
};
|
||||
|
||||
ui = {
|
||||
enableMouse = true;
|
||||
assistant = "none";
|
||||
statusLine = "bottom";
|
||||
};
|
||||
};
|
||||
|
||||
plugins = with pkgs.kakounePlugins; [
|
||||
active-window-kak
|
||||
auto-pairs-kak
|
||||
byline-kak # ope
|
||||
prelude-kak # dependency of byline
|
||||
fzf-kak
|
||||
kakboard
|
||||
kakoune-buffer-switcher
|
||||
kakoune-buffers
|
||||
kakoune-lsp
|
||||
kakoune-rainbow
|
||||
kakoune-registers
|
||||
kakoune-vertical-selection
|
||||
powerline-kak
|
||||
quickscope-kak
|
||||
smarttab-kak
|
||||
zig-kak
|
||||
];
|
||||
# extraConfig = ./kakrc;
|
||||
};
|
||||
}
|
18
modules/programs/editors/kakoune/kak-lsp.toml
Normal file
18
modules/programs/editors/kakoune/kak-lsp.toml
Normal file
|
@ -0,0 +1,18 @@
|
|||
[language.haskell]
|
||||
filetypes = ["haskell"]
|
||||
roots = ["Setup.hs", "stack.yaml", "*.cabal"]
|
||||
command = "haskell-language-server-wrapper"
|
||||
args = ["--lsp"]
|
||||
|
||||
[language.rust]
|
||||
filetypes = ["rust"]
|
||||
roots = ["Cargo.toml"]
|
||||
command = "rust-analyzer"
|
||||
settings_section = "rust-analyzer"
|
||||
[language.rust.settings.rust-analyzer]
|
||||
"proMacro.enable" = true
|
||||
|
||||
[language.nix]
|
||||
filetypes = ["nix"]
|
||||
roots = ["shell.nix", "default.nix", "home.nix", "flake.nix"]
|
||||
command = "rnix-lsp"
|
135
modules/programs/editors/kakoune/kakoune.nix
Normal file
135
modules/programs/editors/kakoune/kakoune.nix
Normal file
|
@ -0,0 +1,135 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
buildGoModule,
|
||||
...
|
||||
}:
|
||||
with lib; let
|
||||
cfg = config.modules.programs.kakoune;
|
||||
username = config.modules.other.system.username;
|
||||
kakship = pkgs.rustPlatform.buildRustPackage rec {
|
||||
pname = "kakship";
|
||||
version = "0.2.8";
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "mesabloo";
|
||||
repo = "kakship";
|
||||
rev = "937d904a893daf59f70dc955e60209cd8866a7c3";
|
||||
sha256 = "1pk0v0b31bppjzl08qgrjld40pc7rqc257zzgdl4r8zaamqsmkz9";
|
||||
};
|
||||
cargoLock = {
|
||||
lockFile = "${src}/Cargo.lock";
|
||||
outputHashes = {
|
||||
"kak-0.1.2" = "sha256-RhtHQkC9yCSJtr/kbC5c9MavbL79acrsiEGXyoAST8U=";
|
||||
"yew-ansi-0.1.0" = "sha256-dSaEzqiOon+OqCZKQudzLRNP+Iv97kC+XZcTElKNrzs=";
|
||||
};
|
||||
};
|
||||
|
||||
# patchPhase = ''
|
||||
# substituteInPlace src/main.rs \
|
||||
# --replace '"starship"' "\"${pkgs.starship}/bin/starship\""
|
||||
# '';
|
||||
|
||||
postInstall = ''
|
||||
# Copy rc files to /share/kak/autoload
|
||||
mkdir -p $out/share/kak/autoload/plugins/${pname}
|
||||
cp $src/rc/*.kak $out/share/kak/autoload/plugins/${pname}
|
||||
'';
|
||||
};
|
||||
kak-rainbow = pkgs.kakouneUtils.buildKakounePluginFrom2Nix rec {
|
||||
pname = "kak-rainbow";
|
||||
version = "1.0.0";
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "Bodhizafa";
|
||||
repo = "kak-rainbow";
|
||||
rev = "9c3d0aa62514134ee5cb86e80855d9712c4e8c4b";
|
||||
sha256 = "sha256-ryYq4A89wVUsxgvt4YqBPXsTFMDrMJM6BDBEHrWHD1c=";
|
||||
};
|
||||
|
||||
postInstall = ''
|
||||
mkdir -p $out/lib
|
||||
mv $out/share/kak/autoload/plugins/${pname}/rainbow.kak $out/lib
|
||||
cat >$out/share/kak/autoload/plugins/${pname}/rainbow.kak <<EOF
|
||||
provide-module rainbow %{
|
||||
source $out/lib/rainbow.kak
|
||||
}
|
||||
EOF
|
||||
'';
|
||||
};
|
||||
kks = pkgs.buildGoModule rec {
|
||||
pname = "kks";
|
||||
version = "8113ea3";
|
||||
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "kkga";
|
||||
repo = pname;
|
||||
rev = "8113ea3bd718dec88b812faa1a41bacba0110fd7";
|
||||
sha256 = "sha256-/0ocgWArELGQkOZqbYRljPnzM/zQ9HCZq7gqhMD0Mq4=";
|
||||
};
|
||||
|
||||
vendorHash = "sha256-E4D9FGTpS9NkZy6tmnuI/F4dnO9bv8MVaRstxVPvEfo=";
|
||||
doCheck = false;
|
||||
|
||||
meta = with lib; {
|
||||
description = "Handy Kakoune companion.";
|
||||
homepage = "https://github.com/kkga/kks";
|
||||
license = licenses.unfree;
|
||||
maintainers = with maintainers; [kalbasit];
|
||||
};
|
||||
};
|
||||
kak-alacritty = pkgs.kakouneUtils.buildKakounePluginFrom2Nix rec {
|
||||
pname = "alacritty.kak";
|
||||
version = "10025b8";
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "Lokasku";
|
||||
repo = pname;
|
||||
rev = "66b0d2e2451c01719262effd008c40614427bb35";
|
||||
sha256 = "sha256-Ibjs6dCU8/XEjUoWNB5a8R4QW7z8w6cFBSxd7UvZrxE=";
|
||||
};
|
||||
};
|
||||
kakoune-snow = pkgs.kakouneUtils.buildKakounePluginFrom2Nix rec {
|
||||
pname = "kakoune-snow";
|
||||
version = "35f8187";
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "caksoylar";
|
||||
repo = pname;
|
||||
rev = "35f81876bcaea061982396f8071b89528940ae61";
|
||||
sha256 = "";
|
||||
};
|
||||
};
|
||||
# with lib;
|
||||
in {
|
||||
options.modules.programs.kakoune.enable = mkEnableOption "kakoune";
|
||||
config = mkIf cfg.enable {
|
||||
home-manager.users.${username} = {programs.kakoune.enable = true;};
|
||||
environment.systemPackages = with pkgs; [
|
||||
rust-analyzer
|
||||
rustfmt # Rust LSP
|
||||
|
||||
kakship
|
||||
kks
|
||||
];
|
||||
programs.kakoune = {
|
||||
plugins = with pkgs.kakounePlugins; [
|
||||
kakoune-lsp
|
||||
fzf-kak
|
||||
kak-rainbow
|
||||
kak-alacritty
|
||||
];
|
||||
config = {
|
||||
numberLines = {
|
||||
enable = true;
|
||||
# separator = "|";
|
||||
};
|
||||
scrollOff = {
|
||||
columns = 15;
|
||||
lines = 15;
|
||||
};
|
||||
};
|
||||
extraConfig = builtins.readFile ./kakrc;
|
||||
};
|
||||
|
||||
xdg.configFile."kak/starship.toml".source = ./starship.toml;
|
||||
xdg.configFile."kak-lsp/kak-lsp.toml".source = ./kak-lsp.toml;
|
||||
};
|
||||
}
|
88
modules/programs/editors/kakoune/kakrc
Normal file
88
modules/programs/editors/kakoune/kakrc
Normal file
|
@ -0,0 +1,88 @@
|
|||
# --- kks
|
||||
eval %sh{ kks init }
|
||||
|
||||
# --- kak-lsp
|
||||
eval %sh{kak-lsp --kakoune -s $kak_session}
|
||||
|
||||
hook global WinCreate .* %{
|
||||
lsp-inlay-hints-enable window
|
||||
lsp-auto-signature-help-enable
|
||||
}
|
||||
|
||||
hook global WinSetOption filetype=(nix|haskell) %{
|
||||
lsp-enable-window
|
||||
}
|
||||
|
||||
set-option global lsp_completion_trigger "execute-keys 'h<a-h><a-k>\S[^\h\n,=;*(){}\[\]]\z<ret>'"
|
||||
set-option global lsp_diagnostic_line_error_sign "!"
|
||||
set-option global lsp_diagnostic_line_warning_sign "?"
|
||||
|
||||
hook global WinSetOption filetype=(rust) %{
|
||||
map window user "l" ':enter-user-mode lsp<ret>' -docstring "LSP mode"
|
||||
lsp-enable-window
|
||||
lsp-auto-hover-insert-mode-disable
|
||||
set-option window lsp_hover_anchor true
|
||||
set-face window DiagnosticError default+u
|
||||
set-face window DiagnosticWarning default+u
|
||||
set-option window lsp_server_configuration rust.clippy_preference="on"
|
||||
}
|
||||
|
||||
# hook global WinSetOption filetype=rust %{
|
||||
# lsp-enable-window hook window BufWritePre .* lsp-formatting-sync
|
||||
# hook window -group rust-inlay-hints BufWritePost .* rust-analyzer-inlay-hints
|
||||
# hook -once -always window WinSetOption filetype=.* %{
|
||||
# remove-hooks window rust-inlay-hints
|
||||
# }
|
||||
# }
|
||||
|
||||
map global normal <a-d> ':lsp-definition<ret>'
|
||||
|
||||
# --- kakoune-rainbow
|
||||
hook global ModuleLoaded rainbow %{
|
||||
set-option global rainbow_colors rgb:FF3B2F+db rgb:FF9500+db rgb:FFCC02+db rgb:27cd41+db rgb:007AFF+db rgb:AF52DE+db
|
||||
hook global WinSetOption filetype=(rust|python|c|cpp|scheme|lisp|clojure|javascript|json|kak|haskell|python|latex|nix) %{
|
||||
rainbow-enable-window
|
||||
}
|
||||
}
|
||||
|
||||
# --- alacritty.kak
|
||||
hook global ModuleLoaded x11 %{
|
||||
alias global terminal kitty-terminal
|
||||
alias global popup alacritty-terminal-popup
|
||||
}
|
||||
|
||||
# --- Kakship
|
||||
hook global ModuleLoaded kakship %{
|
||||
kakship-enable
|
||||
}
|
||||
|
||||
# --- Broot
|
||||
define-command -override broot-oneoff-select -docstring 'focus broot' %{
|
||||
evaluate-commands %sh{
|
||||
d="$(dirname "$kak_buffile")"
|
||||
b="$(basename "$kak_buffile")"
|
||||
echo echo -debug "$d"
|
||||
broot_cmd="broot"
|
||||
if [ -d "$d" ]; then
|
||||
broot_cmd="$broot_cmd --cmd \":focus $d;:select $b\""
|
||||
fi
|
||||
echo "kks-connect ala-popup sh -c '""kks send edit $broot_cmd""'"
|
||||
}
|
||||
}
|
||||
|
||||
define-command ala-popup -params .. -shell-completion -docstring 'alacritty-terminal-popup <program> [arguments]: create a new terminal as an Alacritty window (class: popup, app_id: popup)' %{
|
||||
nop %sh{
|
||||
setsid alacritty -o window.dimensions.columns=200 window.dimensions.lines=57 --title popup --class 'alacritty-popup' --command "$@" < /dev/null > /dev/null 2>&1 &
|
||||
}
|
||||
}
|
||||
|
||||
# --- Map
|
||||
map global normal <c-f> ':fzf-mode<ret>f<ret>'
|
||||
map global normal <c-t> ':alacritty-popup<ret>'
|
||||
|
||||
require-module fzf
|
||||
set-option global fzf_terminal_command 'ala-popup kak -c %val{session} -e "%arg{@}"'
|
||||
|
||||
|
||||
require-module alacritty
|
||||
require-module rainbow
|
48
modules/programs/editors/kakoune/mappings.nix
Normal file
48
modules/programs/editors/kakoune/mappings.nix
Normal file
|
@ -0,0 +1,48 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}: let
|
||||
inherit (config.modules.other.system) username;
|
||||
in {
|
||||
config.home-manager.users.${username}.programs.kakoune.config.keyMappings = [
|
||||
{
|
||||
mode = "normal";
|
||||
key = "<esc>";
|
||||
effect = ";,";
|
||||
docstring = "Press escape to clear highlighted text and collapse cursors";
|
||||
}
|
||||
{
|
||||
mode = "normal";
|
||||
key = "<c-v>";
|
||||
effect = ":comment-line<ret>";
|
||||
docstring = "Comment a line with <c-v>!";
|
||||
}
|
||||
{
|
||||
mode = "normal";
|
||||
key = "b";
|
||||
effect = ":db<ret>";
|
||||
docstring = "close current buffer";
|
||||
}
|
||||
|
||||
{
|
||||
mode = "normal";
|
||||
key = "n";
|
||||
effect = ":bp<ret>";
|
||||
docstring = "go to next buffer";
|
||||
}
|
||||
{
|
||||
mode = "normal";
|
||||
key = "m";
|
||||
effect = ":bn<ret>";
|
||||
docstring = "go to next buffer";
|
||||
}
|
||||
{
|
||||
mode = "normal";
|
||||
key = " f";
|
||||
effect = ":fzf-mode<ret>";
|
||||
docstring = "open fzf";
|
||||
}
|
||||
];
|
||||
}
|
20
modules/programs/editors/kakoune/starship.toml
Normal file
20
modules/programs/editors/kakoune/starship.toml
Normal file
|
@ -0,0 +1,20 @@
|
|||
# add_newline = false
|
||||
|
||||
format = """
|
||||
\$directory
|
||||
\${custom.separator}
|
||||
"""
|
||||
|
||||
[directory]
|
||||
format = '[$path/]($style)'
|
||||
truncate_length = 2
|
||||
truncate_to_repo = false
|
||||
use_logical_pat = true
|
||||
style = "fg:cyan"
|
||||
truncate_symbol = "../"
|
||||
disabled = false
|
||||
|
||||
[custom.separator]
|
||||
format = "[ ||| ]($style)"
|
||||
style = "fg:purple"
|
||||
disabled = false
|
34
modules/programs/editors/nvf/default.nix
Normal file
34
modules/programs/editors/nvf/default.nix
Normal file
|
@ -0,0 +1,34 @@
|
|||
{
|
||||
pkgs,
|
||||
config,
|
||||
lib,
|
||||
inputs,
|
||||
...
|
||||
}: let
|
||||
cfg = config.modules.system.programs.editors.neovim;
|
||||
inherit (builtins) filter map toString elem;
|
||||
inherit (lib.filesystem) listFilesRecursive;
|
||||
inherit (lib.strings) hasSuffix;
|
||||
inherit (lib.lists) concatLists;
|
||||
inherit (lib) mkIf;
|
||||
|
||||
mkNeovimModule = {
|
||||
path,
|
||||
ignoredPaths ? [],
|
||||
}:
|
||||
filter (hasSuffix ".nix") (
|
||||
map toString (
|
||||
filter (path: path != ./default.nix && !elem path ignoredPaths) (listFilesRecursive path)
|
||||
)
|
||||
);
|
||||
|
||||
nvf = inputs.neovim-flake;
|
||||
in {
|
||||
imports = concatLists [
|
||||
# neovim-flake home-manager module
|
||||
[nvf.nixosModules.default]
|
||||
# construct this entire directory as a module
|
||||
# which means all default.nix files will be imported automtically
|
||||
(mkNeovimModule {path = ./.;})
|
||||
];
|
||||
}
|
134
modules/programs/editors/nvf/lua/autocmds.lua
Normal file
134
modules/programs/editors/nvf/lua/autocmds.lua
Normal file
|
@ -0,0 +1,134 @@
|
|||
-- luacheck: ignore
|
||||
-- alias for vim.api.nvim_create_autocmd
|
||||
local create_autocmd = vim.api.nvim_create_autocmd
|
||||
-- alias for vim.api.nvim_create_augroup
|
||||
local create_augroup = vim.api.nvim_create_augroup
|
||||
|
||||
create_autocmd('BufWritePre', {
|
||||
pattern = { '/tmp/*', 'COMMIT_EDITMSG', 'MERGE_MSG', '*.tmp', '*.bak' },
|
||||
callback = function()
|
||||
vim.opt_local.undofile = false
|
||||
end,
|
||||
})
|
||||
|
||||
-- Remove whitespaces on save
|
||||
-- this is normally handled by the formatter
|
||||
-- but this should help when the formatter
|
||||
-- is not working or has timed out
|
||||
-- create_autocmd('BufWritePre', {
|
||||
-- pattern = '',
|
||||
-- command = ':%s/\\s\\+$//e',
|
||||
-- })
|
||||
|
||||
-- Disable line wrapping & spell checking
|
||||
-- for the terminal buffer
|
||||
create_autocmd({ 'FileType' }, {
|
||||
pattern = { 'toggleterm' },
|
||||
callback = function()
|
||||
vim.opt_local.wrap = false
|
||||
vim.opt_local.spell = false
|
||||
end,
|
||||
})
|
||||
|
||||
-- Enable spell checking & line wrapping
|
||||
-- for git commit messages
|
||||
create_autocmd({ 'FileType' }, {
|
||||
pattern = { 'gitcommit' },
|
||||
callback = function()
|
||||
vim.opt_local.wrap = true
|
||||
vim.opt_local.spell = true
|
||||
end,
|
||||
})
|
||||
|
||||
-- Highlight yank after yanking
|
||||
local highlight_group = create_augroup('YankHighlight', { clear = true })
|
||||
create_autocmd({ 'TextYankPost' }, {
|
||||
pattern = { '*' },
|
||||
group = highlight_group,
|
||||
callback = function()
|
||||
vim.highlight.on_yank({ higroup = 'Visual', timeout = 200 })
|
||||
end,
|
||||
})
|
||||
|
||||
-- Close terminal window if process exists with code 0
|
||||
create_autocmd('TermClose', {
|
||||
callback = function()
|
||||
if not vim.b.no_auto_quit then
|
||||
vim.defer_fn(function()
|
||||
if vim.api.nvim_get_current_line() == '[Process exited 0]' then
|
||||
vim.api.nvim_buf_delete(0, { force = true })
|
||||
end
|
||||
end, 50)
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
-- Start insert mode automatically
|
||||
-- when editing a Git commit message
|
||||
create_augroup('AutoInsert', { clear = true })
|
||||
create_autocmd('FileType', {
|
||||
group = 'AutoInsert',
|
||||
pattern = 'gitcommit',
|
||||
command = 'startinsert',
|
||||
})
|
||||
|
||||
-- Disable cursorline in insert mode
|
||||
create_augroup('CursorLine', { clear = true })
|
||||
create_autocmd({ 'InsertLeave', 'WinEnter' }, {
|
||||
group = 'CursorLine',
|
||||
callback = function()
|
||||
vim.wo.cursorline = true
|
||||
end,
|
||||
})
|
||||
|
||||
create_autocmd({ 'InsertEnter', 'WinLeave' }, {
|
||||
group = 'CursorLine',
|
||||
callback = function()
|
||||
vim.wo.cursorline = false
|
||||
end,
|
||||
})
|
||||
|
||||
-- Create the necessary directory structure for the file being saved.
|
||||
create_augroup('AutoMkdir', { clear = true })
|
||||
create_autocmd('BufWritePre', {
|
||||
group = 'AutoMkdir',
|
||||
callback = function(event)
|
||||
local file = vim.loop.fs_realpath(event.match) or event.match
|
||||
vim.fn.mkdir(vim.fn.fnamemodify(file, ':p:h'), 'p')
|
||||
end,
|
||||
})
|
||||
|
||||
-- Adjust the window size when the terminal is resized
|
||||
create_autocmd('VimResized', {
|
||||
command = 'wincmd =',
|
||||
})
|
||||
|
||||
-- Allow closing certain windows with "q"
|
||||
-- and remove them from the buffer list
|
||||
create_augroup('close_with_q', { clear = true })
|
||||
create_autocmd('FileType', {
|
||||
group = 'close_with_q',
|
||||
pattern = {
|
||||
'help',
|
||||
'lspinfo',
|
||||
'TelescopePrompt',
|
||||
},
|
||||
callback = function(event)
|
||||
vim.bo[event.buf].buflisted = false
|
||||
vim.keymap.set('n', 'q', '<cmd>close<cr>', { buffer = event.buf, silent = true })
|
||||
end,
|
||||
})
|
||||
|
||||
-- Mark internally when nvim is focused
|
||||
-- and when it is not
|
||||
create_autocmd('FocusGained', {
|
||||
callback = function()
|
||||
vim.g.nvim_focused = true
|
||||
end,
|
||||
})
|
||||
|
||||
create_autocmd('FocusLost', {
|
||||
callback = function()
|
||||
vim.g.nvim_focused = false
|
||||
end,
|
||||
})
|
38
modules/programs/editors/nvf/lua/core.lua
Normal file
38
modules/programs/editors/nvf/lua/core.lua
Normal file
|
@ -0,0 +1,38 @@
|
|||
local opt = vim.opt
|
||||
local options = {
|
||||
showmode = false, -- disable the -- STATUS -- line
|
||||
showtabline = 0, -- never show the tabline
|
||||
startofline = true, -- motions like "G" also move to the first char
|
||||
virtualedit = 'block', -- visual-block mode can select beyond end of line
|
||||
showmatch = true, -- when closing a bracket, briefly flash the matching one
|
||||
matchtime = 1, -- duration of that flashing n deci-seconds
|
||||
signcolumn = 'yes:1', -- static width
|
||||
report = 9001, -- disable "x more/fewer lines" messages
|
||||
diffopt = opt.diffopt:append('vertical'), -- diff mode: vertical splits
|
||||
backspace = { 'indent', 'eol', 'start' }, -- backspace through everything in insert mode
|
||||
hidden = true, -- Enable background buffers
|
||||
history = 100, -- Remember N lines in history
|
||||
lazyredraw = false, -- Faster scrolling if enabled, breaks noice
|
||||
synmaxcol = 240, -- Max column for syntax highlight
|
||||
updatetime = 250, -- ms to wait for trigger an event
|
||||
|
||||
-- If 0, move cursor line will not scroll window.
|
||||
-- If 999, cursor line will always be in middle of window.
|
||||
scrolloff = 0,
|
||||
}
|
||||
|
||||
-- iterate over the options table and set the options
|
||||
-- for each key = value pair
|
||||
for key, value in pairs(options) do
|
||||
opt[key] = value
|
||||
end
|
||||
|
||||
-- Don't auto-comment new lines automatically
|
||||
-- that happens when you press enter at the end
|
||||
-- of a comment line, and comments the next line
|
||||
-- That's annoying and we don't want it!
|
||||
-- don't continue comments automagically
|
||||
-- https://neovim.io/doc/user/options.html#'formatoptions'
|
||||
opt.formatoptions:remove('c')
|
||||
opt.formatoptions:remove('r')
|
||||
opt.formatoptions:remove('o')
|
17
modules/programs/editors/nvf/lua/display/mouse.lua
Normal file
17
modules/programs/editors/nvf/lua/display/mouse.lua
Normal file
|
@ -0,0 +1,17 @@
|
|||
-- disable the "how to disable mouse" message
|
||||
-- in right click popups
|
||||
vim.cmd.aunmenu([[PopUp.How-to\ disable\ mouse]])
|
||||
vim.cmd.aunmenu([[PopUp.-1-]])
|
||||
|
||||
vim.cmd.amenu([[PopUp.Inspect <Cmd>Inspect<CR>]])
|
||||
vim.cmd.amenu([[PopUp.Telescope <Cmd>Telescope<CR>]])
|
||||
vim.cmd.amenu([[PopUp.Code\ action <Cmd>lua vim.lsp.buf.code_action()<CR>]])
|
||||
vim.cmd.amenu([[PopUp.LSP\ Hover <Cmd>lua vim.lsp.buf.hover()<CR>]])
|
||||
|
||||
-- Add a blinking cursor in certain modes.
|
||||
vim.opt.guicursor = {
|
||||
'n-c-v:block-Cursor',
|
||||
'i-ci-ve-r-o:blinkwait250-blinkon250-blinkoff250-Cursor',
|
||||
'i-ci-ve:ver25-Cursor',
|
||||
'r-cr-o:hor20-Cursor',
|
||||
}
|
21
modules/programs/editors/nvf/lua/display/numbertoggle.lua
Normal file
21
modules/programs/editors/nvf/lua/display/numbertoggle.lua
Normal file
|
@ -0,0 +1,21 @@
|
|||
-- taken from https://github.com/sitiom/nvim-numbertoggle
|
||||
vim.api.nvim_create_autocmd({ 'BufEnter', 'FocusGained', 'InsertLeave', 'CmdlineLeave', 'WinEnter' }, {
|
||||
pattern = '*',
|
||||
group = vim.api.nvim_create_augroup('NumberToggle', {}),
|
||||
callback = function()
|
||||
if vim.o.nu and vim.api.nvim_get_mode().mode ~= 'i' then
|
||||
vim.opt.relativenumber = true
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd({ 'BufLeave', 'FocusLost', 'InsertEnter', 'CmdlineEnter', 'WinLeave' }, {
|
||||
pattern = '*',
|
||||
group = vim.api.nvim_create_augroup('NumberToggle', {}),
|
||||
callback = function()
|
||||
if vim.o.nu then
|
||||
vim.opt.relativenumber = false
|
||||
vim.cmd('redraw')
|
||||
end
|
||||
end,
|
||||
})
|
3
modules/programs/editors/nvf/lua/display/split.lua
Normal file
3
modules/programs/editors/nvf/lua/display/split.lua
Normal file
|
@ -0,0 +1,3 @@
|
|||
-- More natural pane splitting
|
||||
vim.o.splitbelow = true
|
||||
vim.o.splitright = true
|
93
modules/programs/editors/nvf/lua/display/ui.lua
Normal file
93
modules/programs/editors/nvf/lua/display/ui.lua
Normal file
|
@ -0,0 +1,93 @@
|
|||
local opt = vim.opt
|
||||
|
||||
-- luacheck: ignore
|
||||
-- When true, all the windows are automatically made the same size after splitting or closing a window.
|
||||
-- When false, splitting a window will reduce the size of the current window and leave the other windows the same.
|
||||
opt.equalalways = false
|
||||
opt.cmdheight = 1 -- Better display for messages
|
||||
opt.colorcolumn = '+0' -- Align text at 'textwidth'
|
||||
opt.showtabline = 2 -- Always show the tabs line
|
||||
opt.helpheight = 0 -- Disable help window resizing
|
||||
opt.winwidth = 30 -- Minimum width for active window
|
||||
opt.winminwidth = 1 -- Minimum width for inactive windows
|
||||
opt.winheight = 1 -- Minimum height for active window
|
||||
opt.winminheight = 1 -- Minimum height for inactive window
|
||||
opt.pumheight = 10 -- Maximum number of items to show in the popup menu
|
||||
opt.winminwidth = 1 -- min width of inactive window
|
||||
-- opt.pumblend = 100 -- Popup blend, 100 means transparent
|
||||
|
||||
opt.cursorline = true
|
||||
opt.whichwrap:append('<,>,h,l,[,]')
|
||||
|
||||
opt.list = true
|
||||
-- characters to fill the statuslines, vertical separators and special
|
||||
-- lines in the window.opt.whichwrap:append('<,>,h,l,[,]')
|
||||
opt.fillchars:append({
|
||||
-- replace window border with slightly thicker characters
|
||||
-- although taking a bit of more space, it helps me better
|
||||
-- identify the window borders
|
||||
horiz = '━',
|
||||
horizup = '┻',
|
||||
horizdown = '┳',
|
||||
vert = '┃',
|
||||
vertleft = '┫',
|
||||
vertright = '┣',
|
||||
verthoriz = '╋',
|
||||
|
||||
eob = ' ', -- suppress end of buffer lines (~)
|
||||
diff = '╱', -- deleted lines of the 'diff' option
|
||||
|
||||
msgsep = '‾',
|
||||
|
||||
-- replace fold chars
|
||||
fold = ' ',
|
||||
foldopen = '',
|
||||
foldclose = '',
|
||||
})
|
||||
|
||||
-- List chars that would b shown on all modes
|
||||
-- better kept simple, because it gets REALLY
|
||||
-- noisy in an average buffer
|
||||
local normal_listchars = {
|
||||
extends = '›', -- Alternatives: … ,»
|
||||
precedes = '‹', -- Alternatives: … ,«
|
||||
}
|
||||
|
||||
opt.listchars = normal_listchars
|
||||
|
||||
-- Show listchars while in Insert mode.
|
||||
local insert_listchars = {
|
||||
eol = nil,
|
||||
tab = '▎·',
|
||||
lead = '·',
|
||||
space = '·',
|
||||
trail = '.',
|
||||
multispace = '… ',
|
||||
nbsp = '¤',
|
||||
}
|
||||
|
||||
-- Show listchars while in Insert mode.
|
||||
vim.api.nvim_create_augroup('InsertModeListChars', { clear = true })
|
||||
vim.api.nvim_create_autocmd({ 'InsertEnter', 'InsertLeavePre' }, {
|
||||
group = 'InsertModeListChars',
|
||||
pattern = '*',
|
||||
callback = function(args)
|
||||
if vim.tbl_contains({ 'quickfix', 'prompt' }, args.match) then
|
||||
return
|
||||
end
|
||||
|
||||
if args.event == 'InsertEnter' then
|
||||
vim.opt_local.listchars = insert_listchars
|
||||
else
|
||||
vim.opt_local.listchars = normal_listchars
|
||||
end
|
||||
|
||||
-- check if ibl is enabled
|
||||
-- @diagnostic disable-next-line: no-unknown, unused-local
|
||||
local status_ok, ibl = pcall(require, 'ibl')
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
require('ibl').debounced_refresh(0)
|
||||
end,
|
||||
})
|
18
modules/programs/editors/nvf/lua/ft.lua
Normal file
18
modules/programs/editors/nvf/lua/ft.lua
Normal file
|
@ -0,0 +1,18 @@
|
|||
-- luacheck: ignore
|
||||
vim.g.markdown_fenced_languages = { 'shell=bash' }
|
||||
|
||||
local file_syntax_map = {
|
||||
{ pattern = '*.rasi', syntax = 'scss' },
|
||||
{ pattern = 'flake.lock', syntax = 'json' },
|
||||
{ pattern = '*.ignore', syntax = 'gitignore' }, -- also ignore for fd/ripgrep
|
||||
{ pattern = '*.ojs', syntax = 'javascript' },
|
||||
{ pattern = '*.astro', syntax = 'astro' },
|
||||
{ pattern = '*.mdx', syntax = 'mdx' }
|
||||
}
|
||||
|
||||
for _, elem in ipairs(file_syntax_map) do
|
||||
vim.api.nvim_create_autocmd({ 'BufNewFile', 'BufRead' }, {
|
||||
pattern = elem.pattern,
|
||||
command = 'set syntax=' .. elem.syntax,
|
||||
})
|
||||
end
|
22
modules/programs/editors/nvf/lua/misc/abbrev.lua
Normal file
22
modules/programs/editors/nvf/lua/misc/abbrev.lua
Normal file
|
@ -0,0 +1,22 @@
|
|||
local cmd = vim.cmd
|
||||
|
||||
-- luacheck: ignore
|
||||
local abbreviations = {
|
||||
Wq = 'wq', -- keep making those typos
|
||||
WQ = 'wq',
|
||||
Wqa = 'wqa',
|
||||
W = 'w',
|
||||
Q = 'q',
|
||||
Qa = 'qa',
|
||||
Bd = 'bd',
|
||||
E = 'e',
|
||||
q1 = 'q!', -- this is for when I don't want to reach to shift
|
||||
qa1 = 'qa!',
|
||||
mk = 'mark', -- make marks faster
|
||||
st = 'sort', -- sort
|
||||
}
|
||||
|
||||
-- add more abbreviations
|
||||
for left, right in pairs(abbreviations) do
|
||||
cmd.cnoreabbrev(('%s %s'):format(left, right))
|
||||
end
|
13
modules/programs/editors/nvf/lua/misc/autoread.lua
Normal file
13
modules/programs/editors/nvf/lua/misc/autoread.lua
Normal file
|
@ -0,0 +1,13 @@
|
|||
-- If the cursor has been idle for some time, check if the current buffer
|
||||
-- has been modified externally. prompt the user to reload it if has.
|
||||
local bufnr = vim.api.nvim_get_current_buf()
|
||||
|
||||
-- luacheck: ignore
|
||||
vim.opt_local.autoread = true
|
||||
vim.api.nvim_create_autocmd('CursorHold', {
|
||||
group = vim.api.nvim_create_augroup('Autoread', { clear = true }),
|
||||
buffer = bufnr,
|
||||
callback = function()
|
||||
vim.cmd('silent! checktime')
|
||||
end,
|
||||
})
|
68
modules/programs/editors/nvf/lua/misc/declutter.lua
Normal file
68
modules/programs/editors/nvf/lua/misc/declutter.lua
Normal file
|
@ -0,0 +1,68 @@
|
|||
-- luacheck: ignore
|
||||
vim.opt.spelllang:append('cjk') -- disable spellchecking for asian characters (VIM algorithm does not support it)
|
||||
|
||||
vim.opt.shortmess = {
|
||||
t = true, -- truncate file messages at start
|
||||
A = true, -- ignore annoying swap file messages
|
||||
o = true, -- file-read message overwrites previous
|
||||
O = true, -- file-read message overwrites previous
|
||||
T = true, -- truncate non-file messages in middle
|
||||
f = true, -- (file x of x) instead of just (x of x
|
||||
F = true, -- Don't give file info when editing a file, NOTE: this breaks autocommand messages
|
||||
s = true,
|
||||
c = true,
|
||||
W = true, -- Don't show [w] or written when writing
|
||||
}
|
||||
|
||||
-- Disable nvim intro
|
||||
vim.opt.shortmess:append('sI')
|
||||
|
||||
-- Some of those are already disasbled in the Neovim wrapper
|
||||
-- as configured by nvf. I'm just making sure they are disabled
|
||||
-- here as well.
|
||||
local disable_distribution_plugins = function()
|
||||
local disabled_built_ins = {
|
||||
'2html_plugin',
|
||||
'getscript',
|
||||
'getscriptPlugin',
|
||||
'gzip',
|
||||
'logipat',
|
||||
'matchit',
|
||||
'matchparen',
|
||||
'tar',
|
||||
'tarPlugin',
|
||||
'rrhelper',
|
||||
'spellfile_plugin',
|
||||
'vimball',
|
||||
'vimballPlugin',
|
||||
'zip',
|
||||
'zipPlugin',
|
||||
'tutor',
|
||||
'rplugin',
|
||||
'synmenu',
|
||||
'optwin',
|
||||
'compiler',
|
||||
'bugreport',
|
||||
'ftplugin',
|
||||
'netrw',
|
||||
'netrwPlugin',
|
||||
'netrwSettings',
|
||||
'netrwFileHandlers',
|
||||
-- "skip_ts_context_commentstring_module"
|
||||
}
|
||||
|
||||
for _, plugin in pairs(disabled_built_ins) do
|
||||
g['loaded_' .. plugin] = 1
|
||||
end
|
||||
end
|
||||
|
||||
-- https://github.com/neovim/neovim/issues/14090#issuecomment-1177933661
|
||||
-- vim.g.do_filetype_lua = 1
|
||||
-- vim.g.did_load_filetypes = 0
|
||||
|
||||
-- Neovim should not be able to load from those paths since
|
||||
-- we ultimately want to be able to *only* want the nvf config
|
||||
-- to be the effective one
|
||||
vim.opt.runtimepath:remove('/etc/xdg/nvim')
|
||||
vim.opt.runtimepath:remove('/etc/xdg/nvim/after')
|
||||
vim.opt.runtimepath:remove('/usr/share/vim/vimfiles')
|
22
modules/programs/editors/nvf/lua/misc/diagnostics.lua
Normal file
22
modules/programs/editors/nvf/lua/misc/diagnostics.lua
Normal file
|
@ -0,0 +1,22 @@
|
|||
-- Diagnostic settings:
|
||||
-- see: `:help vim.diagnostic.config`
|
||||
vim.diagnostic.config({
|
||||
update_in_insert = true,
|
||||
virtual_text = false,
|
||||
signs = true,
|
||||
underline = true,
|
||||
severity_sort = true,
|
||||
virtual_lines = {
|
||||
only_current_line = true,
|
||||
spacing = 2,
|
||||
},
|
||||
|
||||
float = {
|
||||
focusable = false,
|
||||
style = 'minimal',
|
||||
border = 'rounded',
|
||||
source = 'always',
|
||||
header = '',
|
||||
prefix = '',
|
||||
},
|
||||
})
|
34
modules/programs/editors/nvf/lua/misc/handlers.lua
Normal file
34
modules/programs/editors/nvf/lua/misc/handlers.lua
Normal file
|
@ -0,0 +1,34 @@
|
|||
-- luacheck: ignore
|
||||
local float_options = {
|
||||
border = 'single',
|
||||
max_width = math.ceil(vim.api.nvim_win_get_width(0) * 0.6),
|
||||
max_height = math.ceil(vim.api.nvim_win_get_height(0) * 0.8),
|
||||
}
|
||||
|
||||
vim.lsp.handlers['textDocument/publishDiagnostics'] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, {
|
||||
virtual_text = true,
|
||||
signs = false,
|
||||
underline = true,
|
||||
update_in_insert = false,
|
||||
severity_sort = true,
|
||||
})
|
||||
|
||||
vim.lsp.handlers['textDocument/show_line_diagnostics'] = vim.lsp.with(vim.lsp.handlers.hover, float_options)
|
||||
|
||||
-- Prevent show notification
|
||||
-- <https://github.com/neovim/neovim/issues/20457#issuecomment-1266782345>
|
||||
vim.lsp.handlers['textDocument/hover'] = function(_, result, ctx, config)
|
||||
config = config or float_options
|
||||
config.focus_id = ctx.method
|
||||
if not result then
|
||||
return
|
||||
end
|
||||
local markdown_lines = vim.lsp.util.convert_input_to_markdown_lines(result.contents)
|
||||
markdown_lines = vim.lsp.util.trim_empty_lines(markdown_lines)
|
||||
if vim.tbl_isempty(markdown_lines) then
|
||||
return
|
||||
end
|
||||
return vim.lsp.util.open_floating_preview(markdown_lines, 'markdown', config)
|
||||
end
|
||||
|
||||
vim.lsp.handlers['textDocument/signatureHelp'] = vim.lsp.with(vim.lsp.handlers.signature_help, float_options)
|
30
modules/programs/editors/nvf/lua/misc/neovide.lua
Normal file
30
modules/programs/editors/nvf/lua/misc/neovide.lua
Normal file
|
@ -0,0 +1,30 @@
|
|||
if vim.g.neovide then
|
||||
local vks = vim.keymap.set
|
||||
|
||||
vim.g.neovide_scale_factor = 1.0
|
||||
vim.g.minianimate_disable = true
|
||||
vim.g.neovide_window_blurred = true
|
||||
vim.g.neovide_transparency = 0.80
|
||||
vim.g.neovide_show_border = true
|
||||
vim.g.neovide_input_macos_alt_is_meta = true
|
||||
vim.g.neovide_cursor_animate_command_line = false -- noice incompat
|
||||
vim.g.neovide_cursor_smooth_blink = true
|
||||
vim.g.neovide_cursor_vfx_mode = 'ripple'
|
||||
|
||||
-- keymaps
|
||||
vks('v', '<D-c>', '"+y') -- Copy
|
||||
vks({ 'n', 'v' }, '<D-v>', '"+P') -- Paste
|
||||
vks({ 'i', 'c' }, '<D-v>', '<C-R>+') -- Paste
|
||||
vks('t', '<D-v>', [[<C-\><C-N>"+P]]) -- Paste
|
||||
vks('n', '<D-+>', function()
|
||||
vim.g.neovide_scale_factor = vim.g.neovide_scale_factor * 1.1
|
||||
end)
|
||||
vks('n', '<D-->', function()
|
||||
vim.g.neovide_scale_factor = vim.g.neovide_scale_factor / 1.1
|
||||
end)
|
||||
vks({ 'n', 'v', 't', 'i' }, '<D-}>', [[<C-\><C-N><Cmd>tabnext<CR>]])
|
||||
vks({ 'n', 'v', 't', 'i' }, '<D-{>', [[<C-\><C-N><Cmd>tabprev<CR>]])
|
||||
vks({ 'n', 'v', 't', 'i' }, '<D-l>', [[<C-\><C-N><Cmd>tabnext #<CR>]])
|
||||
vks({ 'n', 'v', 't', 'i' }, '<D-t>', [[<C-\><C-N><Cmd>tabnew<CR>]])
|
||||
vks({ 'n', 'v', 't', 'i' }, '<D-w>', [[<C-\><C-N><Cmd>tabclose<CR>]])
|
||||
end
|
33
modules/programs/editors/nvf/lua/misc/vscode.lua
Normal file
33
modules/programs/editors/nvf/lua/misc/vscode.lua
Normal file
|
@ -0,0 +1,33 @@
|
|||
-- https://github.com/asvetliakov/vscode-neovim#normal-mode-control-keys
|
||||
-- available by default
|
||||
-- CTRL-a
|
||||
-- CTRL-b
|
||||
-- CTRL-c
|
||||
-- CTRL-d
|
||||
-- CTRL-e
|
||||
-- CTRL-f
|
||||
-- CTRL-i
|
||||
-- CTRL-o
|
||||
-- CTRL-r
|
||||
-- CTRL-u
|
||||
-- CTRL-v
|
||||
-- CTRL-w
|
||||
-- CTRL-x
|
||||
-- CTRL-y
|
||||
-- CTRL-]
|
||||
-- CTRL-j
|
||||
-- CTRL-k
|
||||
-- CTRL-l
|
||||
-- CTRL-h
|
||||
-- CTRL-/
|
||||
|
||||
if vim.g.vscode then
|
||||
vim.keymap.set('n', 'H', '<Cmd>Tabprevious<CR>', { noremap = true, silent = true })
|
||||
vim.keymap.set('n', 'L', '<Cmd>Tabnext<CR>', { noremap = true, silent = true })
|
||||
vim.keymap.set(
|
||||
'n',
|
||||
'<Leader>p',
|
||||
"<<Cmd>call VSCodeNotify('workbench.action.quickOpen')<CR>>",
|
||||
{ noremap = true, silent = true }
|
||||
)
|
||||
end
|
70
modules/programs/editors/nvf/lua/plugins/notify.lua
Normal file
70
modules/programs/editors/nvf/lua/plugins/notify.lua
Normal file
|
@ -0,0 +1,70 @@
|
|||
local noice = require('noice')
|
||||
local no_top_text = {
|
||||
opts = {
|
||||
border = {
|
||||
text = { top = '' },
|
||||
},
|
||||
},
|
||||
}
|
||||
-- luacheck: ignore
|
||||
noice.setup({
|
||||
cmdline = {
|
||||
format = {
|
||||
cmdline = no_top_text,
|
||||
filter = no_top_text,
|
||||
lua = no_top_text,
|
||||
search_down = no_top_text,
|
||||
search_up = no_top_text,
|
||||
},
|
||||
},
|
||||
lsp = {
|
||||
override = {
|
||||
['cmp.entry.get_documentation'] = true,
|
||||
['vim.lsp.util.convert_input_to_markdown_lines'] = true,
|
||||
['vim.lsp.util.stylize_markdown'] = true,
|
||||
},
|
||||
progress = {
|
||||
enabled = false,
|
||||
},
|
||||
},
|
||||
|
||||
popupmenu = {
|
||||
backend = 'cmp',
|
||||
},
|
||||
|
||||
routes = {
|
||||
{
|
||||
filter = {
|
||||
event = 'msg_show',
|
||||
kind = 'search_count',
|
||||
},
|
||||
opts = { skip = true },
|
||||
},
|
||||
{
|
||||
-- skip progress messages from noisy servers
|
||||
filter = {
|
||||
event = 'lsp',
|
||||
kind = 'progress',
|
||||
cond = function(message)
|
||||
local client = vim.tbl_get(message.opts, 'progress', 'client')
|
||||
return client == 'ltex'
|
||||
end,
|
||||
},
|
||||
opts = { skip = true },
|
||||
},
|
||||
},
|
||||
|
||||
views = {
|
||||
cmdline_popup = {
|
||||
border = {
|
||||
style = 'single',
|
||||
},
|
||||
},
|
||||
confirm = {
|
||||
border = {
|
||||
style = 'single',
|
||||
text = { top = '' },
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
9
modules/programs/editors/nvf/mappings/insert.nix
Normal file
9
modules/programs/editors/nvf/mappings/insert.nix
Normal file
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
programs.neovim-flake.settings.vim.maps = {
|
||||
insert = {
|
||||
# vsnip
|
||||
#"<C-jn>".action = "<Plug>(vsnip-jump-next)";
|
||||
#"<C-jp>".action = "<Plug>(vsnip-jump-prev)";
|
||||
};
|
||||
};
|
||||
}
|
57
modules/programs/editors/nvf/mappings/normal.nix
Normal file
57
modules/programs/editors/nvf/mappings/normal.nix
Normal file
|
@ -0,0 +1,57 @@
|
|||
{
|
||||
programs.neovim-flake.settings.vim.maps = {
|
||||
normal = {
|
||||
# "<leader>gg".action = "<cmd>LazyGit<CR>";
|
||||
# General
|
||||
"<leader>fd".action = "<cmd>lua vim.g.formatsave = not vim.g.formatsave<CR>";
|
||||
"<leader>zt".action = ":<C-U>let g:default_terminal = v:count1<CR>";
|
||||
# "<leader>ld".action = ":lua vim.diagnostic.setqflist({open = true})<CR>";
|
||||
# "<leader>lf".action = ":lua vim.lsp.buf.format()<CR>";
|
||||
# "<leader>li".action = ":lua vim.lsp.buf.implementation()<CR>";
|
||||
"<leader>;".action = "A;<esc>"; # Append #
|
||||
|
||||
# Diffview
|
||||
"<leader>gdq".action = "<cmd>DiffviewClose<CR>";
|
||||
"<leader>gdd".action = "<cmd>DiffviewOpen ";
|
||||
"<leader>gdm".action = "<cmd>DiffviewOpen<CR>";
|
||||
"<leader>gdh".action = "<cmd>DiffviewFileHistory %<CR>";
|
||||
"<leader>gde".action = "<cmd>DiffviewToggleFiles<CR>";
|
||||
|
||||
# Git
|
||||
"<leader>gu".action = "<cmd>Gitsigns undo_stage_hunk<CR>";
|
||||
"<leader>g<C-w>".action = "<cmd>Gitsigns preview_hunk<CR>";
|
||||
"<leader>gp".action = "<cmd>Gitsigns prev_hunk<CR>";
|
||||
"<leader>gn".action = "<cmd>Gitsigns next_hunk<CR>";
|
||||
"<leader>gP".action = "<cmd>Gitsigns preview_hunk_inline<CR>";
|
||||
"<leader>gR".action = "<cmd>Gitsigns reset_buffer<CR>";
|
||||
"<leader>gb".action = "<cmd>Gitsigns blame_line<CR>";
|
||||
"<leader>gD".action = "<cmd>Gitsigns diffthis HEAD<CR>";
|
||||
"<leader>gw".action = "<cmd>Gitsigns toggle_word_diff<CR>";
|
||||
# Movement
|
||||
"<C-h>".action = "<C-W>h";
|
||||
"<C-j>".action = "<C-W>j";
|
||||
"<C-k>".action = "<C-W>k";
|
||||
"<C-l>".action = "<C-W>l";
|
||||
# Telescope
|
||||
"<M-f>".action = "<cmd>Telescope resume<CR>";
|
||||
"<leader>fq".action = "<cmd>Telescope quickfix<CR>";
|
||||
"<leader>f/".action = "<cmd>Telescope live_grep<cr>";
|
||||
};
|
||||
|
||||
normalVisualOp = {
|
||||
"<leader>gs".action = "<cmd>Gitsigns stage_hunk<CR>";
|
||||
"<leader>gr".action = "<cmd>Gitsigns reset_hunk<CR>";
|
||||
"<leader>lr".action = "<cmd>lua vim.lsp.buf.references()<CR>";
|
||||
|
||||
# ssr.nvim
|
||||
"<leader>sr".action = ":lua require('ssr').open()<CR>";
|
||||
|
||||
# Toggleterm
|
||||
"<leader>ct" = {
|
||||
# action = ":<C-U>ToggleTermSendVisualLines v:count<CR>";
|
||||
action = "':ToggleTermSendVisualLines ' . v:count == 0 ? g:default_terminal : v:count";
|
||||
expr = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
9
modules/programs/editors/nvf/mappings/select.nix
Normal file
9
modules/programs/editors/nvf/mappings/select.nix
Normal file
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
programs.neovim-flake.settings.vim.maps = {
|
||||
select = {
|
||||
# vsnip
|
||||
#"<C-jn>".action = "<Plug>(vsnip-jump-next)";
|
||||
#"<C-jp>".action = "<Plug>(vsnip-jump-prev)";
|
||||
};
|
||||
};
|
||||
}
|
7
modules/programs/editors/nvf/mappings/terminal.nix
Normal file
7
modules/programs/editors/nvf/mappings/terminal.nix
Normal file
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
programs.neovim-flake.settings.vim.maps = {
|
||||
terminal = {
|
||||
"<M-x>".action = "<cmd>q<CR>";
|
||||
};
|
||||
};
|
||||
}
|
206
modules/programs/editors/nvf/plugins/extra.nix
Normal file
206
modules/programs/editors/nvf/plugins/extra.nix
Normal file
|
@ -0,0 +1,206 @@
|
|||
{
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}: let
|
||||
inherit (config.modules.other.system) username;
|
||||
inherit (pkgs.vimPlugins) friendly-snippets aerial-nvim nvim-surround undotree mkdir-nvim ssr-nvim direnv-vim legendary-nvim lazygit-nvim;
|
||||
inherit (pkgs) fetchFromGitHub;
|
||||
inherit (pkgs.vimUtils) buildVimPlugin;
|
||||
|
||||
pluginSources = {
|
||||
smart-splits = buildVimPlugin {
|
||||
name = "smart-splits";
|
||||
src = fetchFromGitHub {
|
||||
owner = "mrjones2014";
|
||||
repo = "smart-splits.nvim";
|
||||
rev = "95833675cd92538bf9cded1d2d58d1fc271c5428";
|
||||
hash = "sha256-TsEzHalLTLp9USV0aGRadAObViC/OpIJeuEJ95lJUL8=";
|
||||
};
|
||||
};
|
||||
|
||||
regexplainer = buildVimPlugin {
|
||||
name = "nvim-regexplainer";
|
||||
src = fetchFromGitHub {
|
||||
owner = "bennypowers";
|
||||
repo = "nvim-regexplainer";
|
||||
rev = "4250c8f3c1307876384e70eeedde5149249e154f";
|
||||
hash = "sha256-15DLbKtOgUPq4DcF71jFYu31faDn52k3P1x47GL3+b0=";
|
||||
};
|
||||
};
|
||||
|
||||
specs-nvim = buildVimPlugin {
|
||||
name = "specs.nvim";
|
||||
src = fetchFromGitHub {
|
||||
owner = "notashelf";
|
||||
repo = "specs.nvim";
|
||||
rev = "0792aaebf8cbac0c8545c43ad648b98deb83af42";
|
||||
hash = "sha256-doHE/3bRuC8lyYxMk927JmwLfiy7aR22+i+BNefEGJ4=";
|
||||
};
|
||||
};
|
||||
|
||||
deferred-clipboard = buildVimPlugin {
|
||||
name = "deferred-clipboard";
|
||||
src = fetchFromGitHub {
|
||||
owner = "EtiamNullam";
|
||||
repo = "deferred-clipboard.nvim";
|
||||
rev = "810a29d166eaa41afc220cc7cd85eeaa3c43b37f";
|
||||
hash = "sha256-nanNQEtpjv0YKEkkrPmq/5FPxq+Yj/19cs0Gf7YgKjU=";
|
||||
};
|
||||
};
|
||||
/*
|
||||
data-viewer-nvim = buildVimPlugin {
|
||||
name = "data-viewer.nvim";
|
||||
src = fetchFromGitHub {
|
||||
owner = "VidocqH";
|
||||
repo = "data-viewer.nvim";
|
||||
rev = "40ddf37bb7ab6c04ff9e820812d1539afe691668";
|
||||
hash = "sha256-D5hvLhsYski11H9qiDDL2zlZMtYmbpHgpewiWR6C7rE=";
|
||||
};
|
||||
};
|
||||
*/
|
||||
vim-nftables = buildVimPlugin {
|
||||
name = "vim-nftables";
|
||||
src = fetchFromGitHub {
|
||||
owner = "awisse";
|
||||
repo = "vim-nftables";
|
||||
rev = "bc29309080b4c7e1888ffb1a830846be16e5b8e7";
|
||||
hash = "sha256-L1x3Hv95t/DBBrLtPBKrqaTbIPor/NhVuEHVIYo/OaA=";
|
||||
};
|
||||
};
|
||||
|
||||
neotab-nvim = buildVimPlugin {
|
||||
name = "neotab.nvim";
|
||||
src = fetchFromGitHub {
|
||||
owner = "kawre";
|
||||
repo = "neotab.nvim";
|
||||
rev = "6c6107dddaa051504e433608f59eca606138269b";
|
||||
hash = "sha256-bSFKbjj8fJHdfBzYoQ9l3NU0GAYfdfCbESKbwdbLNSw=";
|
||||
};
|
||||
};
|
||||
};
|
||||
in {
|
||||
programs.neovim-flake.settings.vim.extraPlugins = {
|
||||
# plugins that are pulled from nixpkgs
|
||||
direnv = {package = direnv-vim;};
|
||||
friendly-snippets = {package = friendly-snippets;};
|
||||
mkdir-nvim = {package = mkdir-nvim;};
|
||||
lazygit-nvim = {package = lazygit-nvim;};
|
||||
aerial = {
|
||||
package = aerial-nvim;
|
||||
setup = "require('aerial').setup {}";
|
||||
};
|
||||
|
||||
nvim-surround = {
|
||||
package = nvim-surround;
|
||||
setup = "require('nvim-surround').setup {}";
|
||||
};
|
||||
|
||||
undotree = {
|
||||
package = undotree;
|
||||
setup = ''
|
||||
vim.g.undotree_ShortIndicators = true
|
||||
vim.g.undotree_TreeVertShape = '│'
|
||||
'';
|
||||
};
|
||||
|
||||
ssr-nvim = {
|
||||
package = ssr-nvim;
|
||||
setup = "require('ssr').setup {}";
|
||||
};
|
||||
|
||||
legendary = {
|
||||
package = legendary-nvim;
|
||||
setup = ''
|
||||
require('legendary').setup {};
|
||||
'';
|
||||
};
|
||||
|
||||
# plugins that are built from their sources
|
||||
# regexplainer = {package = pluginSources.regexplainer;};
|
||||
# vim-nftables = {package = pluginSources.vim-nftables;};
|
||||
/*
|
||||
data-view = {
|
||||
package = pluginSources.data-viewer-nvim;
|
||||
setup = ''
|
||||
-- open data files in data-viewer.nvim
|
||||
vim.api.nvim_exec([[
|
||||
autocmd BufReadPost,BufNewFile *.sqlite,*.csv,*.tsv DataViewer
|
||||
]], false)
|
||||
|
||||
|
||||
-- keybinds
|
||||
vim.api.nvim_set_keymap('n', '<leader>dv', ':DataViewer<CR>', {noremap = true})
|
||||
vim.api.nvim_set_keymap('n', '<leader>dvn', ':DataViewerNextTable<CR>', {noremap = true})
|
||||
vim.api.nvim_set_keymap('n', '<leader>dvp', ':DataViewerPrevTable<CR>', {noremap = true})
|
||||
vim.api.nvim_set_keymap('n', '<leader>dvc', ':DataViewerClose<CR>', {noremap = true})
|
||||
'';
|
||||
};
|
||||
*/
|
||||
smart-splits = {
|
||||
package = pluginSources.smart-splits;
|
||||
setup = "require('smart-splits').setup {}";
|
||||
};
|
||||
|
||||
neotab-nvim = {
|
||||
package = pluginSources.neotab-nvim;
|
||||
setup = ''
|
||||
require('neotab').setup {
|
||||
tabkey = "<Tab>",
|
||||
act_as_tab = true,
|
||||
behavior = "nested", ---@type ntab.behavior
|
||||
pairs = { ---@type ntab.pair[]
|
||||
{ open = "(", close = ")" },
|
||||
{ open = "[", close = "]" },
|
||||
{ open = "{", close = "}" },
|
||||
{ open = "'", close = "'" },
|
||||
{ open = '"', close = '"' },
|
||||
{ open = "`", close = "`" },
|
||||
{ open = "<", close = ">" },
|
||||
},
|
||||
exclude = {},
|
||||
smart_punctuators = {
|
||||
enabled = false,
|
||||
semicolon = {
|
||||
enabled = false,
|
||||
ft = { "cs", "c", "cpp", "java" },
|
||||
},
|
||||
escape = {
|
||||
enabled = false,
|
||||
triggers = {}, ---@type table<string, ntab.trigger>
|
||||
},
|
||||
},
|
||||
}
|
||||
'';
|
||||
};
|
||||
|
||||
specs-nvim = {
|
||||
package = pluginSources.specs-nvim;
|
||||
setup = ''
|
||||
require('specs').setup {
|
||||
show_jumps = true,
|
||||
popup = {
|
||||
delay_ms = 0,
|
||||
inc_ms = 15,
|
||||
blend = 15,
|
||||
width = 10,
|
||||
winhl = "PMenu",
|
||||
fader = require('specs').linear_fader,
|
||||
resizer = require('specs').shrink_resizer
|
||||
},
|
||||
|
||||
ignore_filetypes = {'NvimTree', 'undotree'},
|
||||
|
||||
ignore_buftypes = {nofile = true},
|
||||
}
|
||||
|
||||
-- toggle specs using the <C-b> keybind
|
||||
vim.api.nvim_set_keymap('n', '<C-b>', ':lua require("specs").show_specs()', { noremap = true, silent = true })
|
||||
|
||||
-- bind specs to navigation keys
|
||||
vim.api.nvim_set_keymap('n', 'n', 'n:lua require("specs").show_specs()<CR>', { noremap = true, silent = true })
|
||||
vim.api.nvim_set_keymap('n', 'N', 'N:lua require("specs").show_specs()<CR>', { noremap = true, silent = true })
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
_: {
|
||||
programs.neovim-flake.settings.vim = {
|
||||
assistant.copilot = {
|
||||
enable = false;
|
||||
cmp.enable = false;
|
||||
};
|
||||
};
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
_: {
|
||||
programs.neovim-flake.settings.vim = {
|
||||
autocomplete = {
|
||||
enable = true;
|
||||
type = "nvim-cmp";
|
||||
mappings = {
|
||||
# close = "<C-e>";
|
||||
# confirm = "<tab>";
|
||||
next = "<C-n>";
|
||||
previous = "<C-p>";
|
||||
scrollDocsDown = "<C-j>";
|
||||
scrollDocsUp = "<C-k>";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
_: {
|
||||
programs.neovim-flake.settings.vim = {
|
||||
autopairs.enable = true;
|
||||
};
|
||||
}
|
8
modules/programs/editors/nvf/plugins/settings/binds.nix
Normal file
8
modules/programs/editors/nvf/plugins/settings/binds.nix
Normal file
|
@ -0,0 +1,8 @@
|
|||
_: {
|
||||
programs.neovim-flake.settings.vim = {
|
||||
binds = {
|
||||
whichKey.enable = true;
|
||||
cheatsheet.enable = true;
|
||||
};
|
||||
};
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
_: {
|
||||
programs.neovim-flake.settings.vim = {
|
||||
comments.comment-nvim.enable = true;
|
||||
};
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
_: {
|
||||
programs.neovim-flake.settings.vim = {
|
||||
dashboard = {
|
||||
alpha.enable = true;
|
||||
};
|
||||
};
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
_: {
|
||||
programs.neovim-flake.settings.vim = {
|
||||
debugger.nvim-dap = {
|
||||
enable = true;
|
||||
ui.enable = true;
|
||||
};
|
||||
};
|
||||
}
|
64
modules/programs/editors/nvf/plugins/settings/filetree.nix
Normal file
64
modules/programs/editors/nvf/plugins/settings/filetree.nix
Normal file
|
@ -0,0 +1,64 @@
|
|||
_: {
|
||||
programs.neovim-flake.settings.vim = {
|
||||
filetree = {
|
||||
nvimTree = {
|
||||
enable = true;
|
||||
openOnSetup = true;
|
||||
|
||||
mappings = {
|
||||
#toggle = "<C-w>";
|
||||
toggle = "<leader>e";
|
||||
};
|
||||
|
||||
setupOpts = {
|
||||
disable_netrw = true;
|
||||
update_focused_file.enable = true;
|
||||
|
||||
hijack_unnamed_buffer_when_opening = true;
|
||||
hijack_cursor = true;
|
||||
hijack_directories = {
|
||||
enable = true;
|
||||
auto_open = true;
|
||||
};
|
||||
|
||||
git = {
|
||||
enable = true;
|
||||
show_on_dirs = false;
|
||||
timeout = 500;
|
||||
};
|
||||
|
||||
view = {
|
||||
cursorline = false;
|
||||
width = 35;
|
||||
};
|
||||
|
||||
renderer = {
|
||||
indent_markers.enable = true;
|
||||
root_folder_label = false; # inconsistent
|
||||
|
||||
icons = {
|
||||
modified_placement = "after";
|
||||
git_placement = "after";
|
||||
show.git = true;
|
||||
show.modified = true;
|
||||
};
|
||||
};
|
||||
|
||||
diagnostics.enable = true;
|
||||
|
||||
modified = {
|
||||
enable = true;
|
||||
show_on_dirs = false;
|
||||
show_on_open_dirs = true;
|
||||
};
|
||||
|
||||
actions = {
|
||||
change_dir.enable = false;
|
||||
change_dir.global = false;
|
||||
open_file.window_picker.enable = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
_: {
|
||||
programs.neovim-flake.settings.vim = {
|
||||
gestures.gesture-nvim.enable = false;
|
||||
};
|
||||
}
|
12
modules/programs/editors/nvf/plugins/settings/git.nix
Normal file
12
modules/programs/editors/nvf/plugins/settings/git.nix
Normal file
|
@ -0,0 +1,12 @@
|
|||
_: {
|
||||
programs.neovim-flake.settings.vim = {
|
||||
git = {
|
||||
enable = true;
|
||||
vim-fugitive.enable = true;
|
||||
gitsigns = {
|
||||
enable = true;
|
||||
codeActions.enable = false; # no.
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
47
modules/programs/editors/nvf/plugins/settings/languages.nix
Normal file
47
modules/programs/editors/nvf/plugins/settings/languages.nix
Normal file
|
@ -0,0 +1,47 @@
|
|||
_: {
|
||||
programs.neovim-flake.settings.vim = {
|
||||
languages = {
|
||||
enableLSP = true;
|
||||
enableFormat = true;
|
||||
enableTreesitter = true;
|
||||
enableExtraDiagnostics = true;
|
||||
|
||||
markdown.enable = true;
|
||||
html.enable = true;
|
||||
java.enable = true;
|
||||
css.enable = true;
|
||||
tailwind.enable = true;
|
||||
ts.enable = true;
|
||||
go.enable = true;
|
||||
python.enable = true;
|
||||
bash.enable = true;
|
||||
typst.enable = false;
|
||||
zig.enable = true;
|
||||
dart.enable = false;
|
||||
elixir.enable = false;
|
||||
svelte.enable = false;
|
||||
sql.enable = false;
|
||||
lua = {
|
||||
enable = true;
|
||||
lsp.neodev.enable = true;
|
||||
};
|
||||
|
||||
nix = {
|
||||
enable = true;
|
||||
lsp.enable = true;
|
||||
};
|
||||
rust = {
|
||||
enable = true;
|
||||
crates.enable = true;
|
||||
};
|
||||
|
||||
clang = {
|
||||
enable = true;
|
||||
lsp = {
|
||||
enable = true;
|
||||
server = "clangd";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
15
modules/programs/editors/nvf/plugins/settings/lsp.nix
Normal file
15
modules/programs/editors/nvf/plugins/settings/lsp.nix
Normal file
|
@ -0,0 +1,15 @@
|
|||
_: {
|
||||
programs.neovim-flake.settings.vim = {
|
||||
lsp = {
|
||||
formatOnSave = true;
|
||||
lspkind.enable = true;
|
||||
lsplines.enable = true;
|
||||
lightbulb.enable = false;
|
||||
lspsaga.enable = false;
|
||||
lspSignature.enable = true;
|
||||
nvimCodeActionMenu.enable = true;
|
||||
# trouble.enable = false;
|
||||
# nvim-docs-view.enable = true;
|
||||
};
|
||||
};
|
||||
}
|
11
modules/programs/editors/nvf/plugins/settings/minimap.nix
Normal file
11
modules/programs/editors/nvf/plugins/settings/minimap.nix
Normal file
|
@ -0,0 +1,11 @@
|
|||
{config, ...}: let
|
||||
inherit (config.modules.other.system) username;
|
||||
in {
|
||||
programs.neovim-flake.settings.vim = {
|
||||
minimap = {
|
||||
# cool for vanity but practically useless on small screens
|
||||
minimap-vim.enable = false;
|
||||
codewindow.enable = false;
|
||||
};
|
||||
};
|
||||
}
|
9
modules/programs/editors/nvf/plugins/settings/notes.nix
Normal file
9
modules/programs/editors/nvf/plugins/settings/notes.nix
Normal file
|
@ -0,0 +1,9 @@
|
|||
_: {
|
||||
programs.neovim-flake.settings.vim = {
|
||||
notes = {
|
||||
todo-comments.enable = true;
|
||||
mind-nvim.enable = false;
|
||||
obsidian.enable = false;
|
||||
};
|
||||
};
|
||||
}
|
9
modules/programs/editors/nvf/plugins/settings/notify.nix
Normal file
9
modules/programs/editors/nvf/plugins/settings/notify.nix
Normal file
|
@ -0,0 +1,9 @@
|
|||
{config, ...}: let
|
||||
inherit (config.modules.other.system) username;
|
||||
in {
|
||||
programs.neovim-flake.settings.vim = {
|
||||
notify = {
|
||||
nvim-notify.enable = true;
|
||||
};
|
||||
};
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
{config, ...}: let
|
||||
inherit (config.modules.other.system) username;
|
||||
in {
|
||||
programs.neovim-flake.settings.vim = {
|
||||
presence.neocord.enable = false;
|
||||
};
|
||||
}
|
24
modules/programs/editors/nvf/plugins/settings/projects.nix
Normal file
24
modules/programs/editors/nvf/plugins/settings/projects.nix
Normal file
|
@ -0,0 +1,24 @@
|
|||
{config, ...}: let
|
||||
inherit (config.modules.other.system) username;
|
||||
in {
|
||||
programs.neovim-flake.settings.vim = {
|
||||
projects = {
|
||||
project-nvim = {
|
||||
enable = true;
|
||||
setupOpts = {
|
||||
manualMode = false;
|
||||
detectionMethods = ["lsp" "pattern"];
|
||||
patterns = [
|
||||
".git"
|
||||
".hg"
|
||||
"Makefile"
|
||||
"package.json"
|
||||
"index.*"
|
||||
".anchor"
|
||||
"flake.nix"
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
10
modules/programs/editors/nvf/plugins/settings/session.nix
Normal file
10
modules/programs/editors/nvf/plugins/settings/session.nix
Normal file
|
@ -0,0 +1,10 @@
|
|||
{config, ...}: let
|
||||
inherit (config.modules.other.system) username;
|
||||
in {
|
||||
programs.neovim-flake.settings.vim = {
|
||||
session.nvim-session-manager = {
|
||||
enable = false;
|
||||
setupOpts.autoload_mode = "Disabled"; # misbehaves with dashboard
|
||||
};
|
||||
};
|
||||
}
|
10
modules/programs/editors/nvf/plugins/settings/statusline.nix
Normal file
10
modules/programs/editors/nvf/plugins/settings/statusline.nix
Normal file
|
@ -0,0 +1,10 @@
|
|||
_: {
|
||||
programs.neovim-flake.settings.vim = {
|
||||
statusline = {
|
||||
lualine = {
|
||||
enable = true;
|
||||
theme = "catppuccin";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
_: {
|
||||
programs.neovim-flake.settings.vim = {
|
||||
tabline = {
|
||||
nvimBufferline.enable = true;
|
||||
};
|
||||
};
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
_: {
|
||||
programs.neovim-flake.settings.vim = {
|
||||
telescope.enable = true;
|
||||
};
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
{config, ...}: let
|
||||
inherit (config.modules.other.system) username;
|
||||
in {
|
||||
programs.neovim-flake.settings.vim = {
|
||||
};
|
||||
}
|
18
modules/programs/editors/nvf/plugins/settings/terminal.nix
Normal file
18
modules/programs/editors/nvf/plugins/settings/terminal.nix
Normal file
|
@ -0,0 +1,18 @@
|
|||
_: {
|
||||
programs.neovim-flake.settings.vim = {
|
||||
terminal = {
|
||||
toggleterm = {
|
||||
enable = true;
|
||||
mappings.open = "<C-t>";
|
||||
|
||||
setupOpts = {
|
||||
direction = "tab";
|
||||
lazygit = {
|
||||
enable = true;
|
||||
direction = "tab";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
10
modules/programs/editors/nvf/plugins/settings/theme.nix
Normal file
10
modules/programs/editors/nvf/plugins/settings/theme.nix
Normal file
|
@ -0,0 +1,10 @@
|
|||
_: {
|
||||
programs.neovim-flake.settings.vim = {
|
||||
theme = {
|
||||
enable = true;
|
||||
name = "catppuccin";
|
||||
style = "mocha";
|
||||
transparent = true;
|
||||
};
|
||||
};
|
||||
}
|
20
modules/programs/editors/nvf/plugins/settings/treesitter.nix
Normal file
20
modules/programs/editors/nvf/plugins/settings/treesitter.nix
Normal file
|
@ -0,0 +1,20 @@
|
|||
{
|
||||
config,
|
||||
pkgs,
|
||||
...
|
||||
}: let
|
||||
inherit (config.modules.other.system) username;
|
||||
in {
|
||||
programs.neovim-flake.settings.vim = {
|
||||
treesitter = {
|
||||
fold = true;
|
||||
context.enable = false; # FIXME: currently broken, I do not know why.
|
||||
|
||||
# extra grammars that will be installed by Nix
|
||||
grammars = with pkgs.vimPlugins.nvim-treesitter.builtGrammars; [
|
||||
regex # for regexplainer
|
||||
kdl # zellij configurations are in KDL, I want syntax highlighting
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
34
modules/programs/editors/nvf/plugins/settings/ui.nix
Normal file
34
modules/programs/editors/nvf/plugins/settings/ui.nix
Normal file
|
@ -0,0 +1,34 @@
|
|||
_: {
|
||||
programs.neovim-flake.settings.vim = {
|
||||
ui = {
|
||||
noice.enable = true;
|
||||
colorizer.enable = true;
|
||||
modes-nvim.enable = false;
|
||||
illuminate.enable = true;
|
||||
|
||||
breadcrumbs = {
|
||||
enable = true;
|
||||
source = "nvim-navic";
|
||||
navbuddy.enable = false;
|
||||
};
|
||||
|
||||
smartcolumn = {
|
||||
enable = true;
|
||||
setupOpts = {
|
||||
columnAt.languages = {
|
||||
markdown = [80];
|
||||
nix = [150];
|
||||
ruby = 110;
|
||||
java = 120;
|
||||
go = [130];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
borders = {
|
||||
enable = true;
|
||||
globalStyle = "rounded";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
24
modules/programs/editors/nvf/plugins/settings/utility.nix
Normal file
24
modules/programs/editors/nvf/plugins/settings/utility.nix
Normal file
|
@ -0,0 +1,24 @@
|
|||
{pkgs, ...}: {
|
||||
programs.neovim-flake.settings.vim = {
|
||||
utility = {
|
||||
ccc.enable = true;
|
||||
icon-picker.enable = true;
|
||||
diffview-nvim.enable = true;
|
||||
#
|
||||
vim-wakatime = {
|
||||
enable = true;
|
||||
cli-package = pkgs.wakatime-cli;
|
||||
};
|
||||
|
||||
motion = {
|
||||
hop.enable = false;
|
||||
leap.enable = false;
|
||||
};
|
||||
|
||||
preview = {
|
||||
glow.enable = true;
|
||||
markdownPreview.enable = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
30
modules/programs/editors/nvf/plugins/settings/visuals.nix
Normal file
30
modules/programs/editors/nvf/plugins/settings/visuals.nix
Normal file
|
@ -0,0 +1,30 @@
|
|||
_: {
|
||||
programs.neovim-flake.settings.vim = {
|
||||
visuals = {
|
||||
enable = true;
|
||||
nvimWebDevicons.enable = true;
|
||||
scrollBar.enable = false;
|
||||
smoothScroll.enable = false;
|
||||
cellularAutomaton.enable = true;
|
||||
highlight-undo.enable = true;
|
||||
|
||||
indentBlankline.enable = true;
|
||||
|
||||
cursorline = {
|
||||
enable = true;
|
||||
lineTimeout = 0;
|
||||
};
|
||||
|
||||
fidget-nvim = {
|
||||
enable = true;
|
||||
setupOpts = {
|
||||
notification.window = {
|
||||
winblend = 0;
|
||||
border = "none";
|
||||
render_limit = 10;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
-- luacheck: ignore
|
||||
vim.api.nvim_create_autocmd({ 'BufNewFile', 'BufRead' }, {
|
||||
pattern = 'gitconfig*,.gitconfig*',
|
||||
callback = function()
|
||||
vim.bo.filetype = 'gitconfig'
|
||||
end,
|
||||
once = false,
|
||||
})
|
|
@ -0,0 +1,8 @@
|
|||
-- luacheck: ignore
|
||||
vim.api.nvim_create_autocmd({ 'BufNewFile', 'BufRead' }, {
|
||||
pattern = '*.graphql,*.graphqls,*.gql',
|
||||
callback = function()
|
||||
vim.bo.filetype = 'graphql'
|
||||
end,
|
||||
once = false,
|
||||
})
|
|
@ -0,0 +1,4 @@
|
|||
-- luacheck: ignore
|
||||
vim.filetype.add({
|
||||
filename = { ['.envrc'] = 'bash' },
|
||||
})
|
|
@ -0,0 +1,2 @@
|
|||
-- luacheck: ignore
|
||||
vim.opt_local.textwidth = 80
|
|
@ -0,0 +1,5 @@
|
|||
-- luacheck: ignore
|
||||
vim.opt_local.tabstop = 4
|
||||
vim.opt_local.shiftwidth = 0
|
||||
vim.opt_local.expandtab = false
|
||||
vim.opt_local.list = false
|
14
modules/programs/editors/nvf/runtime/after/ftplugin/json.lua
Normal file
14
modules/programs/editors/nvf/runtime/after/ftplugin/json.lua
Normal file
|
@ -0,0 +1,14 @@
|
|||
vim.keymap.set('n', '<leader>jf', '<cmd>%!jq<cr>', { noremap = true, silent = true, desc = 'Format with jq' })
|
||||
vim.keymap.set('n', '<leader>jm', '<cmd>%!jq -c<cr>', { noremap = true, silent = true, desc = 'Minify with jq' })
|
||||
|
||||
-- add comma to the end of the line on new line
|
||||
vim.keymap.set('n', 'o', function()
|
||||
local line = vim.api.nvim_get_current_line()
|
||||
|
||||
local should_add_comma = string.find(line, '[^,{[]$')
|
||||
if should_add_comma then
|
||||
return 'A,<cr>'
|
||||
else
|
||||
return 'o'
|
||||
end
|
||||
end, { buffer = true, expr = true })
|
13
modules/programs/editors/nvf/runtime/after/ftplugin/man.lua
Normal file
13
modules/programs/editors/nvf/runtime/after/ftplugin/man.lua
Normal file
|
@ -0,0 +1,13 @@
|
|||
-- luacheck: ignore
|
||||
local opts = { noremap = true, silent = true, buffer = 0 }
|
||||
local wincmd = vim.b.pager and 'q' or 'c'
|
||||
vim.keymap.set('n', 'q', '<cmd>lclose<CR><C-W>' .. wincmd, opts)
|
||||
vim.keymap.set('n', '<Leader>o', function()
|
||||
-- TODO: can this be done in a floating window?
|
||||
require('man').show_toc()
|
||||
end, opts)
|
||||
|
||||
vim.b.undo_ftplugin = (vim.b.undo_ftplugin or '')
|
||||
.. (vim.b.undo_ftplugin ~= nil and ' | ' or '')
|
||||
.. 'sil! nunmap <buffer> <Leader>o'
|
||||
.. ' | sil! nunmap <buffer> q'
|
|
@ -0,0 +1,30 @@
|
|||
-- luacheck: ignore
|
||||
vim.opt_local.textwidth = 80
|
||||
|
||||
local CR = vim.api.nvim_replace_termcodes('<cr>', true, true, true)
|
||||
local function toggle_checkbox()
|
||||
local cursor = vim.api.nvim_win_get_cursor(0)
|
||||
local lineno = cursor[1]
|
||||
local line = vim.api.nvim_buf_get_lines(0, lineno - 1, lineno, false)[1] or ''
|
||||
if string.find(line, '%[ %]') then
|
||||
line = line:gsub('%[ %]', '%[x%]')
|
||||
else
|
||||
line = line:gsub('%[x%]', '%[ %]')
|
||||
end
|
||||
vim.api.nvim_buf_set_lines(0, lineno - 1, lineno, false, { line })
|
||||
vim.api.nvim_win_set_cursor(0, cursor)
|
||||
pcall(vim.fn['repeat#set'], ':ToggleCheckbox' .. CR)
|
||||
end
|
||||
|
||||
vim.api.nvim_create_user_command(
|
||||
'ToggleCheckbox',
|
||||
toggle_checkbox,
|
||||
vim.tbl_extend('force', { desc = 'toggle checkboxes' }, {})
|
||||
)
|
||||
|
||||
vim.keymap.set('n', '<leader>op', toggle_checkbox, {
|
||||
noremap = true,
|
||||
silent = true,
|
||||
desc = 'Toggle checkbox',
|
||||
buffer = 0,
|
||||
})
|
|
@ -0,0 +1,2 @@
|
|||
-- luacheck: ignore
|
||||
vim.wo.wrap = true
|
|
@ -0,0 +1,2 @@
|
|||
-- luacheck: ignore
|
||||
vim.opt_local.shiftwidth = 2
|
|
@ -0,0 +1,30 @@
|
|||
; extends
|
||||
|
||||
; inject sql into any const string with word query in the name
|
||||
; e.g. const query = `SELECT * FROM users WHERE name = 'John'`;
|
||||
(const_spec
|
||||
name: (identifier) @_name (#match? @_name "[Qq]uery")
|
||||
value: (expression_list
|
||||
(raw_string_literal) @injection.content)
|
||||
(#offset! @injection.content 0 1 0 -1)
|
||||
(#set! injection.language "sql"))
|
||||
|
||||
; inject sql in single line strings
|
||||
(call_expression
|
||||
(selector_expression
|
||||
field: (field_identifier) @_field (#any-of? @_field "GetContext" "Get" "ExecContext" "Exec" "SelectContext" "Select" "In" "Rebind"))
|
||||
(argument_list
|
||||
(raw_string_literal) @injection.content)
|
||||
(#offset! @injection.content 0 1 0 -1)
|
||||
(#set! injection.language "sql")
|
||||
)
|
||||
|
||||
; inject sql in multi line strings
|
||||
(call_expression
|
||||
(selector_expression
|
||||
field: (field_identifier) @_field (#any-of? @_field "GetContext" "Get" "ExecContext" "Exec" "SelectContext" "Select" "In" "Rebind"))
|
||||
(argument_list
|
||||
(interpreted_string_literal) @injection.content)
|
||||
(#offset! @injection.content 0 1 0 -1)
|
||||
(#set! injection.language "sql")
|
||||
)
|
|
@ -0,0 +1,2 @@
|
|||
;; extends
|
||||
(( jsx_text ) @injection.content (#set! injection.language "markdown") )
|
|
@ -0,0 +1,5 @@
|
|||
;extends
|
||||
|
||||
(fenced_code_block (code_fence_content) @class.inner) @class.outer
|
||||
|
||||
(paragraph) @function.outer @function.inner
|
|
@ -0,0 +1,12 @@
|
|||
;extends
|
||||
|
||||
[
|
||||
(shortcut_link)
|
||||
] @nospell
|
||||
|
||||
(strikethrough
|
||||
(emphasis_delimiter)
|
||||
(strikethrough
|
||||
(emphasis_delimiter)
|
||||
(emphasis_delimiter))
|
||||
(emphasis_delimiter))@markup.doublestrikethrough
|
|
@ -0,0 +1,9 @@
|
|||
((jsx_section)
|
||||
@injection.content
|
||||
(#set! injection.language "tsx")
|
||||
(#set! injection.include-children))
|
||||
|
||||
((markdown_section)
|
||||
@injection.content
|
||||
(#set! injection.language "markdown")
|
||||
(#set! injection.combined))
|
|
@ -0,0 +1,14 @@
|
|||
;extends
|
||||
(macro_invocation
|
||||
(scoped_identifier
|
||||
path: (identifier) @path (#eq? @path "sqlx")
|
||||
name: (identifier) @name (#match? @name "^query.*")
|
||||
)
|
||||
|
||||
(token_tree
|
||||
(raw_string_literal) @injection.content
|
||||
(#set! injection.language "sql")
|
||||
(#set! injection.include-children)
|
||||
)
|
||||
(#offset! @injection.content 0 3 0 -2)
|
||||
)
|
|
@ -0,0 +1,5 @@
|
|||
;; extends
|
||||
((ident) @constant
|
||||
(#eq? @constant "lambda")
|
||||
(#set! conceal "λ")
|
||||
)
|
BIN
modules/programs/editors/nvf/runtime/spell/de.utf-8.spl
Normal file
BIN
modules/programs/editors/nvf/runtime/spell/de.utf-8.spl
Normal file
Binary file not shown.
42
modules/programs/editors/nvf/runtime/spell/en.utf-8.add
Normal file
42
modules/programs/editors/nvf/runtime/spell/en.utf-8.add
Normal file
|
@ -0,0 +1,42 @@
|
|||
contrib
|
||||
Contrib
|
||||
gitignore
|
||||
dotfiles
|
||||
nyx
|
||||
notashelf
|
||||
utils
|
||||
neovim
|
||||
glab
|
||||
gh
|
||||
ripgrep
|
||||
wip
|
||||
thoughtbot
|
||||
kubectl
|
||||
CoC
|
||||
config
|
||||
Capybara
|
||||
mailserver
|
||||
Mailserver
|
||||
anyrun
|
||||
ags
|
||||
spicetify
|
||||
Spicetify
|
||||
firefox
|
||||
Firefox
|
||||
Hyprland
|
||||
Hyprwm
|
||||
Xorg
|
||||
X11
|
||||
devShell
|
||||
devshell
|
||||
nixos
|
||||
NixOS
|
||||
nixpkgs
|
||||
Nixpkgs
|
||||
filetree
|
||||
sourcetree
|
||||
url
|
||||
uri
|
||||
|
||||
|
||||
|
BIN
modules/programs/editors/nvf/runtime/spell/en.utf-8.add.spl
Normal file
BIN
modules/programs/editors/nvf/runtime/spell/en.utf-8.add.spl
Normal file
Binary file not shown.
95
modules/programs/editors/nvf/settings.nix
Normal file
95
modules/programs/editors/nvf/settings.nix
Normal file
|
@ -0,0 +1,95 @@
|
|||
# Credits to raf aka Notashelf, link to his repo is in the README.md
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
inputs,
|
||||
...
|
||||
}: let
|
||||
inherit (builtins) filter map toString;
|
||||
inherit (lib.filesystem) listFilesRecursive;
|
||||
inherit (lib.strings) hasSuffix fileContents;
|
||||
inherit (lib.attrsets) genAttrs;
|
||||
inherit (lib) mkIf;
|
||||
|
||||
cfg = config.modules.system.programs.editors.neovim;
|
||||
nvf = inputs.neovim-flake;
|
||||
inherit (nvf.lib.nvim.dag) entryBefore;
|
||||
in {
|
||||
config = mkIf cfg.enable {
|
||||
programs.neovim-flake = {
|
||||
enable = true;
|
||||
|
||||
defaultEditor = true;
|
||||
enableManpages = true;
|
||||
|
||||
settings = {
|
||||
vim = {
|
||||
# use neovim-unwrapped from nixpkgs
|
||||
# alternatively, neovim-nightly from the neovim-nightly overlay
|
||||
# via inputs.neovim-nightly.packages.${pkgs.stdenv.system}.neovim
|
||||
package = pkgs.neovim-unwrapped;
|
||||
viAlias = true;
|
||||
vimAlias = true;
|
||||
|
||||
withNodeJs = false;
|
||||
withPython3 = false;
|
||||
withRuby = false;
|
||||
|
||||
preventJunkFiles = true;
|
||||
useSystemClipboard = true;
|
||||
tabWidth = 4;
|
||||
autoIndent = true;
|
||||
spellcheck = {
|
||||
enable = true;
|
||||
languages = ["en" "de"];
|
||||
};
|
||||
|
||||
enableLuaLoader = true;
|
||||
enableEditorconfig = true;
|
||||
|
||||
debugMode = {
|
||||
enable = false;
|
||||
logFile = "/tmp/nvim.log";
|
||||
};
|
||||
|
||||
additionalRuntimePaths = [
|
||||
#(mkRuntimeDir "after")
|
||||
#(mkRuntimeDir "spell")
|
||||
./runtime
|
||||
./runtime
|
||||
];
|
||||
|
||||
# while I should be doing this in luaConfigRC below
|
||||
# I have come to realise that spellfile contents are
|
||||
# actually **not** loaded when luaConfigRC is used.
|
||||
# as spellfile is a vim thing, this should be fine
|
||||
# configRC.spellfile = entryAnywhere ''
|
||||
# set spellfile=${toString ./runtime/spell/en.utf-8.add} " toString sanitizes the path
|
||||
# '';
|
||||
|
||||
# additional lua configuration that I can append
|
||||
# or, to be more precise, randomly inject into
|
||||
# the lua configuration of my Neovim configuration
|
||||
# wrapper. This is recursively read from the lua
|
||||
# directory, so we do not need to use require
|
||||
|
||||
luaConfigRC = let
|
||||
# get the name of each lua file in the lua directory, where setting files reside
|
||||
# and import them recursively
|
||||
configPaths = filter (hasSuffix ".lua") (map toString (listFilesRecursive ./lua));
|
||||
|
||||
# generates a key-value pair that looks roughly as follows:
|
||||
# `<filePath> = entryAnywhere ''<contents of filePath>''`
|
||||
# which is expected by neovim-flake's modified DAG library
|
||||
luaConfig = genAttrs configPaths (file:
|
||||
entryBefore ["luaScript"] ''
|
||||
${fileContents "${file}"}
|
||||
'');
|
||||
in
|
||||
luaConfig;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue