orgmode fixed, added comment plugin, added formatter

This commit is contained in:
foxora 2026-02-24 19:54:52 +00:00
parent 44adc7ddd4
commit eea145e01b
9 changed files with 329 additions and 209 deletions

View file

@ -8,7 +8,7 @@ servers.lua_ls = {
}, },
signatureHelp = { enable = true }, signatureHelp = { enable = true },
diagnostics = { diagnostics = {
globals = { 'nixCats', 'vim' }, globals = { "nixCats", "vim" },
-- disable = { 'missing-fields' }, -- disable = { 'missing-fields' },
}, },
workspace = { workspace = {
@ -49,21 +49,20 @@ servers.hls = {
settings = {}, settings = {},
} }
-- Taken from nixCats example: -- Taken from nixCats example:
-- If you were to comment out this autocommand -- If you were to comment out this autocommand
-- and instead pass the on attach function directly to -- and instead pass the on attach function directly to
-- nvim-lspconfig, it would do the same thing. -- nvim-lspconfig, it would do the same thing.
-- come to think of it, it might be better because then lspconfig doesnt have to be called before lsp attach? -- come to think of it, it might be better because then lspconfig doesnt have to be called before lsp attach?
-- but you would still end up triggering on a FileType event anyway, so, it makes little difference. -- but you would still end up triggering on a FileType event anyway, so, it makes little difference.
vim.api.nvim_create_autocmd('LspAttach', { vim.api.nvim_create_autocmd("LspAttach", {
group = vim.api.nvim_create_augroup('nixCats-lsp-attach', { clear = true }), group = vim.api.nvim_create_augroup("nixCats-lsp-attach", { clear = true }),
callback = function(event) callback = function(event)
require('lsp.capabilities').on_attach(vim.lsp.get_client_by_id(event.data.client_id), event.buf) require("lsp.capabilities").on_attach(vim.lsp.get_client_by_id(event.data.client_id), event.buf)
end end,
}) })
require("lze").load { require("lze").load({
{ {
"nvim-lspconfig", "nvim-lspconfig",
event = "FileType", event = "FileType",
@ -71,7 +70,7 @@ require("lze").load {
-- Just register configs, don't enable yet -- Just register configs, don't enable yet
for server_name, cfg in pairs(servers) do for server_name, cfg in pairs(servers) do
vim.lsp.config(server_name, { vim.lsp.config(server_name, {
capabilities = require('lsp.capabilities').get(server_name), capabilities = require("lsp.capabilities").get(server_name),
settings = (cfg or {}).settings, settings = (cfg or {}).settings,
filetypes = (cfg or {}).filetypes, filetypes = (cfg or {}).filetypes,
cmd = (cfg or {}).cmd, cmd = (cfg or {}).cmd,
@ -83,7 +82,7 @@ require("lze").load {
for server_name, cfg in pairs(servers) do for server_name, cfg in pairs(servers) do
local filetypes = cfg.filetypes or vim.lsp.config[server_name].filetypes local filetypes = cfg.filetypes or vim.lsp.config[server_name].filetypes
if filetypes then if filetypes then
vim.api.nvim_create_autocmd('FileType', { vim.api.nvim_create_autocmd("FileType", {
pattern = filetypes, pattern = filetypes,
callback = function() callback = function()
vim.lsp.enable(server_name) vim.lsp.enable(server_name)
@ -93,5 +92,4 @@ require("lze").load {
end end
end, end,
}, },
} })

View file

@ -0,0 +1,23 @@
return {
{
"comment.nvim",
event = { "BufReadPost", "BufNewFile" },
after = function(plugin)
require("Comment").setup({
toggler = {
line = "<leader>cc",
block = "<leader>bc",
},
opleader = {
line = "<leader>c",
block = "<leader>b",
},
extra = {
above = "<leader>c<S-o>",
below = "<leader>co",
eol = "<leader>cA",
},
})
end,
},
}

View file

@ -0,0 +1,33 @@
-- docs -> https://github.com/stevearc/conform.nvim
return {
{
"conform.nvim",
enabled = nixCats("format") or false,
keys = {
{ "<leader>p", desc = "Format File (pretty :3)" },
},
after = function(plugin)
local conform = require("conform")
conform.setup({
formatters_by_ft = {
lua = nixCats("lang.lua") and { "stylua" } or nil,
nix = nixCats("lang.nix") and { "nixfmt" } or nil,
rust = nixCats("lang.rust") and { "rustfmt", lsp_format = "fallback" } or nil,
haskell = nixCats("lang.haskell") and { "ormolu" } or nil,
},
format_on_save = {
timeout_ms = 500,
},
})
vim.keymap.set({ "n", "v" }, "<leader>p", function()
conform.format({
lsp_fallback = false,
async = false,
timeout_ms = 1000,
})
end, { desc = "Format File (pretty :3)" })
end,
},
}

View file

@ -1,8 +1,10 @@
require("lze").load { require("lze").load({
{ import = "plugins.dressing", }, { import = "plugins.dressing" },
{ import = "plugins.telescope", }, { import = "plugins.telescope" },
{ import = "plugins.treesitter", }, { import = "plugins.treesitter" },
{ import = "plugins.fyler", }, { import = "plugins.fyler" },
{ import = "plugins.mini-hipatterns", }, { import = "plugins.mini-hipatterns" },
--{ import = "plugins.neocord", }, { import = "plugins.orgmode" },
} { import = "plugins.format" },
{ import = "plugins.comment" },
})

View file

@ -1,5 +0,0 @@
return {
{
"neocord",
},
}

View file

@ -0,0 +1,16 @@
# options: https://github.com/nvim-orgmode/orgmode/blob/master/docs/installation.org
return {
{
"nvim-orgmode/orgmode",
event = { "FileType" },
ft = { "org" },
after = function(plugin)
require("orgmode").setup({
org_agenda_files = "~/.orgmode/**/*",
org_default_notes_file = "~/.orgmode/refile.org",
})
vim.lsp.enable("org")
end,
},
}

View file

@ -3,12 +3,54 @@ return {
"telescope.nvim", "telescope.nvim",
cmd = { "Telescope" }, cmd = { "Telescope" },
keys = { keys = {
{ "<leader>f", function() return require('telescope.builtin').find_files() end, mode = {"n"}, desc = 'Telescope search [F]iles' }, {
{ "<leader>tr", function() return require('telescope.builtin').oldfiles() end, mode = {"n"}, desc = '[T]elescope search [R]ecent files' }, "<leader>f",
{ "<leader>ts", function() return require('telescope.builtin').live_grep() end, mode = {"n"}, desc = '[T]elescope [S]earch cwd with grep' }, function()
{ "<leader>tw", function() return require('telescope.builtin').grep_string() end, mode = {"n"}, desc = '[T]elescope search current [W]ord' }, return require("telescope.builtin").find_files()
{ "<leader>tk", function() return require('telescope.builtin').keymaps() end, mode = {"n"}, desc = '[T]elescope search [K]eymaps' }, end,
{ "<leader>tb", function() return require('telescope.builtin').buffers() end, mode = {"n"}, desc = '[T]elescope search [B]uffers' }, mode = { "n" },
desc = "Telescope search [F]iles",
},
{
"<leader>tr",
function()
return require("telescope.builtin").oldfiles()
end,
mode = { "n" },
desc = "[T]elescope search [R]ecent files",
},
{
"<leader>ts",
function()
return require("telescope.builtin").live_grep()
end,
mode = { "n" },
desc = "[T]elescope [S]earch cwd with grep",
},
{
"<leader>tw",
function()
return require("telescope.builtin").grep_string()
end,
mode = { "n" },
desc = "[T]elescope search current [W]ord",
},
{
"<leader>tk",
function()
return require("telescope.builtin").keymaps()
end,
mode = { "n" },
desc = "[T]elescope search [K]eymaps",
},
{
"<leader>tb",
function()
return require("telescope.builtin").buffers()
end,
mode = { "n" },
desc = "[T]elescope search [B]uffers",
},
}, },
load = function(name) load = function(name)
vim.cmd.packadd(name) vim.cmd.packadd(name)
@ -18,17 +60,17 @@ return {
local telescope = require("telescope") local telescope = require("telescope")
local actions = require("telescope.actions") local actions = require("telescope.actions")
telescope.setup { telescope.setup({
defaults = { defaults = {
mappings = { mappings = {
i = { i = {
["<C-k>"] = actions.move_selection_previous, -- move to prev result ["<C-k>"] = actions.move_selection_previous, -- move to prev result
["<C-j>"] = actions.move_selection_next, -- move to next result ["<C-j>"] = actions.move_selection_next, -- move to next result
["<C-q>"] = actions.send_selected_to_qflist + actions.open_qflist ["<C-q>"] = actions.send_selected_to_qflist + actions.open_qflist,
} },
} },
} },
} })
pcall(telescope.load_extension, "fzf") pcall(telescope.load_extension, "fzf")
end, end,

View file

@ -58,33 +58,33 @@ return {
vim.g.no_plugin_maps = true vim.g.no_plugin_maps = true
end, end,
after = function(plugin) after = function(plugin)
require("nvim-treesitter-textobjects").setup { require("nvim-treesitter-textobjects").setup({
select = { select = {
lookahead = true, lookahead = true,
selection_modes = { selection_modes = {
['@parameter.outer'] = 'v', -- charwise ["@parameter.outer"] = "v", -- charwise
['@function.outer'] = 'V', -- linewise ["@function.outer"] = "V", -- linewise
}, },
include_surrounding_whitespace = false, include_surrounding_whitespace = false,
}, },
} })
-- keymaps -- keymaps
vim.keymap.set({ "x", "o" }, "am", function() vim.keymap.set({ "x", "o" }, "am", function()
require "nvim-treesitter-textobjects.select".select_textobject("@function.outer", "textobjects") require("nvim-treesitter-textobjects.select").select_textobject("@function.outer", "textobjects")
end) end)
vim.keymap.set({ "x", "o" }, "im", function() vim.keymap.set({ "x", "o" }, "im", function()
require "nvim-treesitter-textobjects.select".select_textobject("@function.inner", "textobjects") require("nvim-treesitter-textobjects.select").select_textobject("@function.inner", "textobjects")
end) end)
vim.keymap.set({ "x", "o" }, "ac", function() vim.keymap.set({ "x", "o" }, "ac", function()
require "nvim-treesitter-textobjects.select".select_textobject("@class.outer", "textobjects") require("nvim-treesitter-textobjects.select").select_textobject("@class.outer", "textobjects")
end) end)
vim.keymap.set({ "x", "o" }, "ic", function() vim.keymap.set({ "x", "o" }, "ic", function()
require "nvim-treesitter-textobjects.select".select_textobject("@class.inner", "textobjects") require("nvim-treesitter-textobjects.select").select_textobject("@class.inner", "textobjects")
end) end)
-- You can also use captures from other query groups like `locals.scm` -- You can also use captures from other query groups like `locals.scm`
vim.keymap.set({ "x", "o" }, "as", function() vim.keymap.set({ "x", "o" }, "as", function()
require "nvim-treesitter-textobjects.select".select_textobject("@local.scope", "locals") require("nvim-treesitter-textobjects.select").select_textobject("@local.scope", "locals")
end) end)
-- NOTE: for more textobjects options, see the following link. -- NOTE: for more textobjects options, see the following link.

View file

@ -58,14 +58,17 @@ in
lang = with pkgs; { lang = with pkgs; {
lua = [ lua = [
lua-language-server lua-language-server
stylua
]; ];
nix = [ nix = [
nil nil
nix-doc nix-doc
nixfmt
]; ];
rust = with pkgs; [ rust = with pkgs; [
cargo cargo
rust-analyzer rust-analyzer
rustfmt
]; ];
haskell = with pkgs; [ haskell = with pkgs; [
haskell-language-server haskell-language-server
@ -82,7 +85,6 @@ in
nvim-web-devicons nvim-web-devicons
base16-nvim base16-nvim
mini-nvim mini-nvim
orgmode
(pkgs.vimUtils.buildVimPlugin { (pkgs.vimUtils.buildVimPlugin {
pname = "candyland-nvim"; pname = "candyland-nvim";
@ -100,28 +102,29 @@ in
nvim-treesitter.withAllGrammars nvim-treesitter.withAllGrammars
]; ];
}; };
optionalPlugins = { optionalPlugins = with pkgs.vimPlugins; {
general = with pkgs.vimPlugins; [ general = [
orgmode
]; ];
ui = with pkgs.vimPlugins; [ ui = [
dressing-nvim dressing-nvim
]; ];
qol = with pkgs.vimPlugins; [ qol = [
undotree undotree
mini-hipatterns mini-hipatterns
]; ];
telescope = with pkgs.vimPlugins; [ telescope = [
telescope-nvim telescope-nvim
telescope-fzf-native-nvim telescope-fzf-native-nvim
telescope-ui-select-nvim telescope-ui-select-nvim
]; ];
fyler = with pkgs.vimPlugins; [ fyler = [
fyler-nvim fyler-nvim
]; ];
lsp = with pkgs.vimPlugins; [ lsp = [
nvim-lspconfig nvim-lspconfig
]; ];
completion = with pkgs.vimPlugins; [ completion = [
blink-cmp blink-cmp
nvim-cmp nvim-cmp
luasnip luasnip
@ -136,7 +139,13 @@ in
cmp-cmdline-history cmp-cmdline-history
lspkind-nvim lspkind-nvim
]; ];
lang = with pkgs.vimPlugins; { format = [
conform-nvim
];
comment = [
comment-nvim
];
lang = {
}; };
}; };
@ -187,6 +196,8 @@ in
fyler = true; fyler = true;
lsp = true; lsp = true;
completion = true; completion = true;
format = true;
comment = true;
treesitter = true; treesitter = true;
lang = { lang = {