Compare commits
7 Commits
c59527e2f2
...
9cf8f7e827
Author | SHA1 | Date |
---|---|---|
Moritz Böhme | 9cf8f7e827 | |
Moritz Böhme | 2fe2b60fd4 | |
Moritz Böhme | 6f28bd821e | |
Moritz Böhme | 10ebfad990 | |
Moritz Böhme | 5942a1c94c | |
Moritz Böhme | 52862635a4 | |
Moritz Böhme | aa8d7c6901 |
|
@ -0,0 +1,7 @@
|
|||
column_width = 120
|
||||
line_endings = "Unix"
|
||||
indent_type = "Spaces"
|
||||
indent_width = 2
|
||||
quote_style = "AutoPreferDouble"
|
||||
call_parentheses = "Always"
|
||||
collapse_simple_statement = "Never"
|
17
flake.lock
17
flake.lock
|
@ -666,6 +666,22 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nvim-treesitter-textsubjects": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1676144693,
|
||||
"narHash": "sha256-4jb9v0xpO17wp85dzojKUQ6hUdNBx3T2tB4fSWoANus=",
|
||||
"owner": "RRethy",
|
||||
"repo": "nvim-treesitter-textsubjects",
|
||||
"rev": "b913508f503527ff540f7fe2dcf1bf1d1f259887",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "RRethy",
|
||||
"repo": "nvim-treesitter-textsubjects",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"pre-commit-hooks": {
|
||||
"inputs": {
|
||||
"flake-compat": "flake-compat",
|
||||
|
@ -757,6 +773,7 @@
|
|||
"neovim": "neovim",
|
||||
"nil": "nil",
|
||||
"nixpkgs": "nixpkgs_8",
|
||||
"nvim-treesitter-textsubjects": "nvim-treesitter-textsubjects",
|
||||
"pre-commit-hooks": "pre-commit-hooks_3",
|
||||
"stable": "stable",
|
||||
"utils": "utils_2"
|
||||
|
|
|
@ -56,6 +56,11 @@
|
|||
hyprland.url = "github:hyprwm/Hyprland";
|
||||
hyprpaper.url = "github:hyprwm/hyprpaper";
|
||||
hypr-contrib.url = "github:hyprwm/contrib";
|
||||
|
||||
nvim-treesitter-textsubjects = {
|
||||
url = "github:RRethy/nvim-treesitter-textsubjects";
|
||||
flake = false;
|
||||
};
|
||||
};
|
||||
|
||||
outputs =
|
||||
|
|
|
@ -1,12 +1,27 @@
|
|||
{ config
|
||||
, lib
|
||||
, pkgs
|
||||
, inputs
|
||||
, ...
|
||||
}:
|
||||
|
||||
with lib;
|
||||
let
|
||||
cfg = config.my.programs.vim;
|
||||
|
||||
mkDate = longDate: (lib.concatStringsSep "-" [
|
||||
(builtins.substring 0 4 longDate)
|
||||
(builtins.substring 4 2 longDate)
|
||||
(builtins.substring 6 2 longDate)
|
||||
]);
|
||||
|
||||
mkVersionInput = input: mkDate (input.lastModifiedDate or "19700101") + "_" + (input.shortRev or "dirty");
|
||||
|
||||
nvim-treesitter-textsubjects = pkgs.vimUtils.buildVimPluginFrom2Nix {
|
||||
pname = "nvim-treesitter-textsubjects";
|
||||
version = mkVersionInput inputs.nvim-treesitter-textsubjects;
|
||||
src = inputs.nvim-treesitter-textsubjects;
|
||||
};
|
||||
in
|
||||
{
|
||||
options.my.programs.vim = {
|
||||
|
@ -33,20 +48,26 @@ in
|
|||
plugins = with pkgs.vimPlugins; [
|
||||
catppuccin-nvim
|
||||
cmp-nvim-lsp
|
||||
cmp_luasnip
|
||||
comment-nvim
|
||||
dashboard-nvim
|
||||
lsp_lines-nvim
|
||||
lualine-lsp-progress
|
||||
lualine-nvim
|
||||
luasnip
|
||||
neogit
|
||||
noice-nvim
|
||||
nui-nvim # for noice-nvim
|
||||
nvim-cmp
|
||||
nvim-lspconfig
|
||||
nvim-surround
|
||||
nvim-treesitter-textsubjects
|
||||
nvim-treesitter.withAllGrammars
|
||||
nvim-ts-context-commentstring
|
||||
nvim-web-devicons # for dashboard-nvim
|
||||
plenary-nvim # for telescope, neogit
|
||||
telescope-nvim
|
||||
which-key-nvim
|
||||
cmp_luasnip
|
||||
luasnip
|
||||
lsp_lines-nvim
|
||||
];
|
||||
};
|
||||
};
|
||||
|
|
|
@ -42,7 +42,7 @@ require("catppuccin").setup({
|
|||
vim.cmd.colorscheme("catppuccin-macchiato")
|
||||
|
||||
vim.o.timeout = true
|
||||
vim.o.timeoutlen = 300
|
||||
vim.o.timeoutlen = 500
|
||||
local wk = require("which-key")
|
||||
|
||||
require("noice").setup({
|
||||
|
@ -53,6 +53,9 @@ require("noice").setup({
|
|||
["vim.lsp.util.stylize_markdown"] = true,
|
||||
["cmp.entry.get_documentation"] = true,
|
||||
},
|
||||
progress = {
|
||||
enabled = false,
|
||||
},
|
||||
},
|
||||
-- you can enable a preset for easier configuration
|
||||
presets = {
|
||||
|
@ -162,18 +165,57 @@ local on_attach_def = function(_, bufnr)
|
|||
}, { noremap = true, silent = true, buffer = bufnr })
|
||||
end
|
||||
|
||||
local servers = { "nil_ls", "pylsp" }
|
||||
for _, lsp in ipairs(servers) do
|
||||
lspconfig[lsp].setup({
|
||||
---merge tables
|
||||
---@param ... table[]
|
||||
---@return table
|
||||
local function table_merge(...)
|
||||
local tables_to_merge = { ... }
|
||||
assert(#tables_to_merge > 1, "There should be at least two tables to merge them")
|
||||
|
||||
for k, t in ipairs(tables_to_merge) do
|
||||
assert(type(t) == "table", string.format("Expected a table as function parameter %d", k))
|
||||
end
|
||||
|
||||
local result = tables_to_merge[1]
|
||||
|
||||
for i = 2, #tables_to_merge do
|
||||
local from = tables_to_merge[i]
|
||||
for k, v in pairs(from) do
|
||||
if type(v) == "table" then
|
||||
result[k] = result[k] or {}
|
||||
result[k] = table_merge(result[k], v)
|
||||
else
|
||||
result[k] = v
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return result
|
||||
end
|
||||
|
||||
local lspconfig_default_options = {
|
||||
on_attach = on_attach_def,
|
||||
capabilities = capabilities,
|
||||
flags = {
|
||||
debounce_text_changes = 100,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
---function to add default options to lspconfig
|
||||
---@param lsp string
|
||||
---@param options table
|
||||
---@return nil
|
||||
local function lspconfig_setup(lsp, options)
|
||||
local final_options = table_merge(lspconfig_default_options, options)
|
||||
lspconfig[lsp].setup(final_options)
|
||||
end
|
||||
|
||||
lspconfig.sumneko_lua.setup({
|
||||
local servers = { "nil_ls", "pylsp" }
|
||||
for _, lsp in ipairs(servers) do
|
||||
lspconfig_setup(lsp, {})
|
||||
end
|
||||
|
||||
lspconfig_setup("lua_ls", {
|
||||
on_attach = on_attach_def,
|
||||
capabilities = capabilities,
|
||||
settings = {
|
||||
|
@ -196,13 +238,7 @@ lspconfig.sumneko_lua.setup({
|
|||
enable = false,
|
||||
},
|
||||
format = {
|
||||
enable = true,
|
||||
-- Put format options here
|
||||
-- NOTE: the value should be STRING!!
|
||||
defaultConfig = {
|
||||
indent_style = "space",
|
||||
indent_size = "2",
|
||||
},
|
||||
enable = false,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -231,3 +267,66 @@ require("dashboard").setup({
|
|||
},
|
||||
},
|
||||
})
|
||||
|
||||
require("lualine").setup({
|
||||
options = {
|
||||
icons_enabled = true,
|
||||
theme = "auto",
|
||||
component_separators = "|",
|
||||
section_separators = { left = "", right = "" },
|
||||
disabled_filetypes = {
|
||||
statusline = {},
|
||||
winbar = {},
|
||||
},
|
||||
ignore_focus = {},
|
||||
always_divide_middle = true,
|
||||
globalstatus = false,
|
||||
refresh = {
|
||||
statusline = 1000,
|
||||
tabline = 1000,
|
||||
winbar = 1000,
|
||||
},
|
||||
},
|
||||
sections = {
|
||||
lualine_a = {
|
||||
{ "mode", separator = { left = "" }, right_padding = 2 },
|
||||
},
|
||||
lualine_b = { "branch", "diff", "diagnostics" },
|
||||
lualine_c = { "filename", "lsp_progress" },
|
||||
lualine_x = { "encoding", "fileformat", "filetype" },
|
||||
lualine_y = { "progress" },
|
||||
lualine_z = {
|
||||
{ "location", separator = { right = "" }, left_padding = 2 },
|
||||
},
|
||||
},
|
||||
inactive_sections = {
|
||||
lualine_a = {},
|
||||
lualine_b = {},
|
||||
lualine_c = { "filename" },
|
||||
lualine_x = { "location" },
|
||||
lualine_y = {},
|
||||
lualine_z = {},
|
||||
},
|
||||
tabline = {},
|
||||
winbar = {},
|
||||
inactive_winbar = {},
|
||||
extensions = {},
|
||||
})
|
||||
|
||||
require("Comment").setup()
|
||||
|
||||
require("nvim-treesitter.configs").setup({
|
||||
context_commentstring = {
|
||||
enable = true,
|
||||
},
|
||||
})
|
||||
|
||||
require("nvim-surround").setup({})
|
||||
|
||||
require("nvim-treesitter.configs").setup({
|
||||
textsubjects = {
|
||||
enable = true,
|
||||
prev_selection = ",", -- (Optional) keymap to select the previous selection
|
||||
keymaps = { ["."] = "textsubjects-smart" },
|
||||
},
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue