fix indents
This commit is contained in:
@@ -4,15 +4,13 @@
|
|||||||
lib,
|
lib,
|
||||||
inputs,
|
inputs,
|
||||||
...
|
...
|
||||||
}:
|
}: let
|
||||||
let
|
|
||||||
program = "nvf";
|
program = "nvf";
|
||||||
cfg = config.dots.${program};
|
cfg = config.dots.${program};
|
||||||
isLinux = pkgs.stdenv.isLinux;
|
isLinux = pkgs.stdenv.isLinux;
|
||||||
isDarwin = pkgs.stdenv.isDarwin;
|
isDarwin = pkgs.stdenv.isDarwin;
|
||||||
#sec = sops.secrets;
|
#sec = sops.secrets;
|
||||||
in
|
in {
|
||||||
{
|
|
||||||
options.dots.${program} = {
|
options.dots.${program} = {
|
||||||
enable = lib.mkEnableOption "enables ${program}";
|
enable = lib.mkEnableOption "enables ${program}";
|
||||||
};
|
};
|
||||||
@@ -28,14 +26,13 @@ in
|
|||||||
vim = {
|
vim = {
|
||||||
clipboard =
|
clipboard =
|
||||||
# On Linux, use wl-copy as you do now
|
# On Linux, use wl-copy as you do now
|
||||||
if isLinux then
|
if isLinux
|
||||||
{
|
then {
|
||||||
enable = true;
|
enable = true;
|
||||||
providers.wl-copy.enable = true;
|
providers.wl-copy.enable = true;
|
||||||
registers = "unnamed,unnamedplus";
|
registers = "unnamed,unnamedplus";
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
enable = true;
|
enable = true;
|
||||||
registers = "unnamed,unnamedplus";
|
registers = "unnamed,unnamedplus";
|
||||||
};
|
};
|
||||||
@@ -47,23 +44,46 @@ in
|
|||||||
|
|
||||||
vimAlias = true;
|
vimAlias = true;
|
||||||
|
|
||||||
lsp.enable = true;
|
# fix indents
|
||||||
|
autocmds = [
|
||||||
|
{
|
||||||
|
enable = true;
|
||||||
|
event = ["BufEnter"];
|
||||||
|
pattern = ["*"];
|
||||||
|
command = "setlocal indentexpr=nvim_treesitter#indent()";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
lsp = {
|
||||||
|
enable = true;
|
||||||
|
formatOnSave = true;
|
||||||
|
};
|
||||||
|
|
||||||
statusline.lualine.enable = true;
|
statusline.lualine.enable = true;
|
||||||
telescope.enable = true;
|
telescope.enable = true;
|
||||||
autocomplete.nvim-cmp.enable = true;
|
autocomplete.nvim-cmp.enable = true;
|
||||||
autopairs.nvim-autopairs.enable = true;
|
autopairs.nvim-autopairs.enable = true;
|
||||||
|
|
||||||
|
treesitter = {
|
||||||
|
enable = true;
|
||||||
|
grammars = pkgs.vimPlugins.nvim-treesitter.allGrammars;
|
||||||
|
|
||||||
|
indent = {
|
||||||
|
enable = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
keymaps = [
|
keymaps = [
|
||||||
# visual line movement (insert mode)
|
# visual line movement (insert mode)
|
||||||
{
|
{
|
||||||
key = "<Up>";
|
key = "<Up>";
|
||||||
mode = [ "i" ];
|
mode = ["i"];
|
||||||
action = "<C-o>gk";
|
action = "<C-o>gk";
|
||||||
desc = "Visual Line Up (Insert)";
|
desc = "Visual Line Up (Insert)";
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
key = "<Down>";
|
key = "<Down>";
|
||||||
mode = [ "i" ];
|
mode = ["i"];
|
||||||
action = "<C-o>gj";
|
action = "<C-o>gj";
|
||||||
desc = "Visual Line Down (Insert)";
|
desc = "Visual Line Down (Insert)";
|
||||||
}
|
}
|
||||||
@@ -95,7 +115,7 @@ in
|
|||||||
|
|
||||||
{
|
{
|
||||||
key = "gd";
|
key = "gd";
|
||||||
mode = [ "n" ];
|
mode = ["n"];
|
||||||
silent = true;
|
silent = true;
|
||||||
action = "<cmd>lua vim.lsp.buf.definition()<CR>";
|
action = "<cmd>lua vim.lsp.buf.definition()<CR>";
|
||||||
desc = "Go to definition";
|
desc = "Go to definition";
|
||||||
@@ -103,7 +123,7 @@ in
|
|||||||
# Hover info
|
# Hover info
|
||||||
{
|
{
|
||||||
key = "K";
|
key = "K";
|
||||||
mode = [ "n" ];
|
mode = ["n"];
|
||||||
silent = true;
|
silent = true;
|
||||||
action = "<cmd>lua vim.lsp.buf.hover()<CR>";
|
action = "<cmd>lua vim.lsp.buf.hover()<CR>";
|
||||||
desc = "Hover info";
|
desc = "Hover info";
|
||||||
@@ -111,7 +131,7 @@ in
|
|||||||
# Format buffer (Alejandra for Nix)
|
# Format buffer (Alejandra for Nix)
|
||||||
{
|
{
|
||||||
key = "<leader>F";
|
key = "<leader>F";
|
||||||
mode = [ "n" ];
|
mode = ["n"];
|
||||||
silent = true;
|
silent = true;
|
||||||
action = "<cmd>lua vim.lsp.buf.format({ async = true })<CR>";
|
action = "<cmd>lua vim.lsp.buf.format({ async = true })<CR>";
|
||||||
desc = "Format buffer";
|
desc = "Format buffer";
|
||||||
@@ -119,7 +139,7 @@ in
|
|||||||
# Code actions / quickfix
|
# Code actions / quickfix
|
||||||
{
|
{
|
||||||
key = "<leader>a";
|
key = "<leader>a";
|
||||||
mode = [ "n" ];
|
mode = ["n"];
|
||||||
silent = true;
|
silent = true;
|
||||||
action = "<cmd>lua vim.lsp.buf.code_action()<CR>";
|
action = "<cmd>lua vim.lsp.buf.code_action()<CR>";
|
||||||
desc = "Code action";
|
desc = "Code action";
|
||||||
@@ -127,7 +147,7 @@ in
|
|||||||
# Rename symbol
|
# Rename symbol
|
||||||
{
|
{
|
||||||
key = "<leader>r";
|
key = "<leader>r";
|
||||||
mode = [ "n" ];
|
mode = ["n"];
|
||||||
silent = true;
|
silent = true;
|
||||||
action = "<cmd>lua vim.lsp.buf.rename()<CR>";
|
action = "<cmd>lua vim.lsp.buf.rename()<CR>";
|
||||||
desc = "Rename symbol";
|
desc = "Rename symbol";
|
||||||
@@ -135,21 +155,21 @@ in
|
|||||||
# Diagnostics
|
# Diagnostics
|
||||||
{
|
{
|
||||||
key = "<leader>e";
|
key = "<leader>e";
|
||||||
mode = [ "n" ];
|
mode = ["n"];
|
||||||
silent = true;
|
silent = true;
|
||||||
action = "<cmd>lua vim.diagnostic.open_float()<CR>";
|
action = "<cmd>lua vim.diagnostic.open_float()<CR>";
|
||||||
desc = "Show diagnostic";
|
desc = "Show diagnostic";
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
key = "[d";
|
key = "[d";
|
||||||
mode = [ "n" ];
|
mode = ["n"];
|
||||||
silent = true;
|
silent = true;
|
||||||
action = "<cmd>lua vim.diagnostic.goto_prev()<CR>";
|
action = "<cmd>lua vim.diagnostic.goto_prev()<CR>";
|
||||||
desc = "Previous diagnostic";
|
desc = "Previous diagnostic";
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
key = "]d";
|
key = "]d";
|
||||||
mode = [ "n" ];
|
mode = ["n"];
|
||||||
silent = true;
|
silent = true;
|
||||||
action = "<cmd>lua vim.diagnostic.goto_next()<CR>";
|
action = "<cmd>lua vim.diagnostic.goto_next()<CR>";
|
||||||
desc = "Next diagnostic";
|
desc = "Next diagnostic";
|
||||||
@@ -157,7 +177,6 @@ in
|
|||||||
];
|
];
|
||||||
|
|
||||||
options = {
|
options = {
|
||||||
|
|
||||||
# line numbers
|
# line numbers
|
||||||
number = true;
|
number = true;
|
||||||
numberwidth = 2;
|
numberwidth = 2;
|
||||||
@@ -168,10 +187,7 @@ in
|
|||||||
shiftwidth = 2;
|
shiftwidth = 2;
|
||||||
softtabstop = -1;
|
softtabstop = -1;
|
||||||
expandtab = true;
|
expandtab = true;
|
||||||
smarttab = true;
|
|
||||||
autoindent = true;
|
autoindent = true;
|
||||||
cindent = true;
|
|
||||||
smartindent = true;
|
|
||||||
|
|
||||||
# search
|
# search
|
||||||
ignorecase = true;
|
ignorecase = true;
|
||||||
@@ -197,9 +213,11 @@ in
|
|||||||
|
|
||||||
nix = {
|
nix = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
treesitter.enable = true;
|
||||||
|
treesitter.package = pkgs.vimPlugins.nvim-treesitter.grammarPlugins.nix;
|
||||||
format = {
|
format = {
|
||||||
enable = true;
|
enable = true;
|
||||||
type = [ "alejandra" ];
|
type = ["alejandra"];
|
||||||
#type = "nixfmt";
|
#type = "nixfmt";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user