mirror of
https://github.com/buckley310/nixos-config.git
synced 2024-11-09 18:47:02 +00:00
Compare commits
5 commits
bb81bea4b3
...
e3f71a7985
Author | SHA1 | Date | |
---|---|---|---|
|
e3f71a7985 | ||
|
589f2b97a0 | ||
|
4d152339e8 | ||
|
4fa6ca3527 | ||
|
1b46cbc494 |
6 changed files with 108 additions and 17 deletions
|
@ -22,6 +22,7 @@ in
|
|||
"/tmp"
|
||||
"/var/lib/bluetooth"
|
||||
"/var/lib/nixos"
|
||||
"/var/lib/private"
|
||||
"/var/lib/systemd/coredump"
|
||||
"/var/log/journal"
|
||||
"/var/tmp"
|
||||
|
|
|
@ -158,7 +158,7 @@
|
|||
alias yq='yq --indent 4'
|
||||
alias p=python3
|
||||
alias h=htop
|
||||
alias nix-env="echo nix-env is disabled #"
|
||||
alias e='$EDITOR'
|
||||
alias nix-what-depends-on='nix-store --query --referrers'
|
||||
alias day='date "+%Y-%m-%d"'
|
||||
alias grep='grep --color=auto'
|
||||
|
|
95
modules/helix/default.nix
Normal file
95
modules/helix/default.nix
Normal file
|
@ -0,0 +1,95 @@
|
|||
{ pkgs, ... }:
|
||||
let
|
||||
hx-pretty = pkgs.writeShellScript "hx-pretty.sh" ''
|
||||
exec prettier --stdin-filepath "$HX_FILE"
|
||||
'';
|
||||
|
||||
prettier-formats = map
|
||||
(name: {
|
||||
inherit name;
|
||||
auto-format = true;
|
||||
indent = { tab-width = 4; unit = "\t"; };
|
||||
formatter.command = hx-pretty;
|
||||
})
|
||||
[
|
||||
"css"
|
||||
"html"
|
||||
"javascript"
|
||||
"typescript"
|
||||
];
|
||||
|
||||
in
|
||||
{
|
||||
environment.etc."bck-helix/config.toml".source =
|
||||
(pkgs.formats.toml { }).generate "config.toml" {
|
||||
theme = "dark_plus";
|
||||
editor = {
|
||||
auto-format = true;
|
||||
bufferline = "multiple";
|
||||
indent-guides.render = true;
|
||||
line-number = "relative";
|
||||
mouse = false;
|
||||
scrolloff = 10;
|
||||
true-color = true;
|
||||
};
|
||||
keys = {
|
||||
normal.A-j = ":buffer-previous";
|
||||
normal.A-k = ":buffer-next";
|
||||
normal.space.e = ":w";
|
||||
normal.space.x = ":q";
|
||||
normal.space.backspace = ":reset-diff-change";
|
||||
};
|
||||
};
|
||||
|
||||
environment.etc."bck-helix/languages.toml".source =
|
||||
(pkgs.formats.toml { }).generate "languages.toml" {
|
||||
language = prettier-formats ++ [
|
||||
{
|
||||
name = "bash";
|
||||
auto-format = true;
|
||||
indent = { tab-width = 4; unit = "\t"; };
|
||||
}
|
||||
{
|
||||
name = "lua";
|
||||
auto-format = true;
|
||||
indent = { tab-width = 4; unit = "\t"; };
|
||||
}
|
||||
{
|
||||
name = "nix";
|
||||
auto-format = true;
|
||||
formatter.command = "nixpkgs-fmt";
|
||||
}
|
||||
{
|
||||
name = "python";
|
||||
auto-format = true;
|
||||
language-servers = [ "pyright" ];
|
||||
formatter = { command = "black"; args = [ "--quiet" "-" ]; };
|
||||
}
|
||||
{
|
||||
name = "yaml";
|
||||
auto-format = true;
|
||||
formatter.command = hx-pretty;
|
||||
}
|
||||
];
|
||||
language-server = {
|
||||
pyright = {
|
||||
command = "pyright-langserver";
|
||||
args = [ "--stdio" ];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
(helix.overrideAttrs ({ patches ? [ ], ... }: {
|
||||
# Patch required for .editorconfig to work properly with formatters
|
||||
patches = patches ++ [ ./format-filepath.patch ];
|
||||
postPatch = ''
|
||||
sed 's/tab-width = .,/tab-width = 4,/' -i languages.toml
|
||||
'';
|
||||
}))
|
||||
];
|
||||
|
||||
environment.etc."bck-settings.sh".text = ''
|
||||
mkdir -p ~/.config && ln -nTfs /etc/bck-helix ~/.config/helix
|
||||
'';
|
||||
}
|
10
modules/helix/format-filepath.patch
Normal file
10
modules/helix/format-filepath.patch
Normal file
|
@ -0,0 +1,10 @@
|
|||
--- a/helix-view/src/document.rs
|
||||
+++ b/helix-view/src/document.rs
|
||||
@@ -762,6 +762,7 @@ pub fn format(&self) -> Option<BoxFuture<'static, Result<Transaction, FormatterE
|
||||
let text = self.text().clone();
|
||||
let mut process = tokio::process::Command::new(&fmt_cmd);
|
||||
process
|
||||
+ .env("HX_FILE", self.path()?.to_str().unwrap_or(""))
|
||||
.args(fmt_args)
|
||||
.stdin(Stdio::piped())
|
||||
.stdout(Stdio::piped())
|
|
@ -1,6 +1,6 @@
|
|||
{ pkgs, ... }:
|
||||
{
|
||||
environment.variables.EDITOR = "nvim";
|
||||
environment.variables.EDITOR = "hx";
|
||||
environment.systemPackages = [
|
||||
pkgs.bck-nvim-base
|
||||
pkgs.bck-nvim-tools
|
||||
|
|
|
@ -27,21 +27,6 @@ vim.keymap.set('n', "<C-Down>", "<cmd>resize +2<cr>")
|
|||
vim.keymap.set('n', "<C-Left>", "<cmd>vertical resize -2<cr>")
|
||||
vim.keymap.set('n', "<C-Right>", "<cmd>vertical resize +2<cr>")
|
||||
|
||||
vim.keymap.set('n', "<C-/>", "<cmd>:terminal<cr>")
|
||||
vim.keymap.set('n', "<C-_>", "<cmd>:terminal<cr>") -- This is Ctrl+/ on some terminals?
|
||||
|
||||
vim.cmd("autocmd TermOpen * setlocal nonumber norelativenumber signcolumn=no")
|
||||
for _, key in pairs({ 'h', 'j', 'k', 'l' }) do
|
||||
for _, mod in pairs({ 'C', 'A' }) do
|
||||
vim.keymap.set(
|
||||
't',
|
||||
'<' .. mod .. '-' .. key .. '>',
|
||||
'<C-\\><C-n><' .. mod .. '-' .. key .. '>',
|
||||
{ remap = true }
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
vim.api.nvim_create_autocmd('TextYankPost', {
|
||||
callback = function()
|
||||
vim.highlight.on_yank()
|
||||
|
|
Loading…
Reference in a new issue