orgmode fixed, added comment plugin, added formatter
This commit is contained in:
parent
44adc7ddd4
commit
eea145e01b
9 changed files with 329 additions and 209 deletions
23
homemanager/vim/lua/plugins/comment.lua
Normal file
23
homemanager/vim/lua/plugins/comment.lua
Normal 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,
|
||||
},
|
||||
}
|
||||
33
homemanager/vim/lua/plugins/format.lua
Normal file
33
homemanager/vim/lua/plugins/format.lua
Normal 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,
|
||||
},
|
||||
}
|
||||
|
|
@ -1,8 +1,10 @@
|
|||
require("lze").load {
|
||||
{ import = "plugins.dressing", },
|
||||
{ import = "plugins.telescope", },
|
||||
{ import = "plugins.treesitter", },
|
||||
{ import = "plugins.fyler", },
|
||||
{ import = "plugins.mini-hipatterns", },
|
||||
--{ import = "plugins.neocord", },
|
||||
}
|
||||
require("lze").load({
|
||||
{ import = "plugins.dressing" },
|
||||
{ import = "plugins.telescope" },
|
||||
{ import = "plugins.treesitter" },
|
||||
{ import = "plugins.fyler" },
|
||||
{ import = "plugins.mini-hipatterns" },
|
||||
{ import = "plugins.orgmode" },
|
||||
{ import = "plugins.format" },
|
||||
{ import = "plugins.comment" },
|
||||
})
|
||||
|
|
|
|||
|
|
@ -1,5 +0,0 @@
|
|||
return {
|
||||
{
|
||||
"neocord",
|
||||
},
|
||||
}
|
||||
16
homemanager/vim/lua/plugins/orgmode.lua
Normal file
16
homemanager/vim/lua/plugins/orgmode.lua
Normal 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,
|
||||
},
|
||||
}
|
||||
|
|
@ -1,36 +1,78 @@
|
|||
return {
|
||||
{
|
||||
"telescope.nvim",
|
||||
cmd = { "Telescope" },
|
||||
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>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)
|
||||
vim.cmd.packadd(name)
|
||||
vim.cmd.packadd("telescope-fzf-native.nvim")
|
||||
end,
|
||||
after = function(plugin)
|
||||
local telescope = require("telescope")
|
||||
local actions = require("telescope.actions")
|
||||
{
|
||||
"telescope.nvim",
|
||||
cmd = { "Telescope" },
|
||||
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>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)
|
||||
vim.cmd.packadd(name)
|
||||
vim.cmd.packadd("telescope-fzf-native.nvim")
|
||||
end,
|
||||
after = function(plugin)
|
||||
local telescope = require("telescope")
|
||||
local actions = require("telescope.actions")
|
||||
|
||||
telescope.setup {
|
||||
defaults = {
|
||||
mappings = {
|
||||
i = {
|
||||
["<C-k>"] = actions.move_selection_previous, -- move to prev result
|
||||
["<C-j>"] = actions.move_selection_next, -- move to next result
|
||||
["<C-q>"] = actions.send_selected_to_qflist + actions.open_qflist
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
telescope.setup({
|
||||
defaults = {
|
||||
mappings = {
|
||||
i = {
|
||||
["<C-k>"] = actions.move_selection_previous, -- move to prev result
|
||||
["<C-j>"] = actions.move_selection_next, -- move to next result
|
||||
["<C-q>"] = actions.send_selected_to_qflist + actions.open_qflist,
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
pcall(telescope.load_extension, "fzf")
|
||||
end,
|
||||
},
|
||||
pcall(telescope.load_extension, "fzf")
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,94 +2,94 @@
|
|||
-- https://github.com/BirdeeHub/nixCats-nvim/blob/3c9bc4d7123e1b48d92f25ba505b889af541e897/templates/example/lua/myLuaConf/plugins/treesitter.lua
|
||||
|
||||
return {
|
||||
{
|
||||
"nvim-treesitter",
|
||||
lazy = false,
|
||||
after = function (plugin)
|
||||
--@param buf integer
|
||||
--@param language string
|
||||
local function treesitter_try_attach(buf, language)
|
||||
--check if parser exists and load it
|
||||
if not vim.treesitter.language.add(language) then
|
||||
return
|
||||
end
|
||||
{
|
||||
"nvim-treesitter",
|
||||
lazy = false,
|
||||
after = function(plugin)
|
||||
--@param buf integer
|
||||
--@param language string
|
||||
local function treesitter_try_attach(buf, language)
|
||||
--check if parser exists and load it
|
||||
if not vim.treesitter.language.add(language) then
|
||||
return
|
||||
end
|
||||
|
||||
-- enables syntax highlight and other treesitter features
|
||||
vim.treesitter.start(buf, language)
|
||||
-- enables syntax highlight and other treesitter features
|
||||
vim.treesitter.start(buf, language)
|
||||
|
||||
-- enables treesitter based folds
|
||||
vim.wo.foldexpr = "v:lua.vim.treesitter.foldexpr()"
|
||||
-- enables treesitter based folds
|
||||
vim.wo.foldexpr = "v:lua.vim.treesitter.foldexpr()"
|
||||
|
||||
-- enables treesiter based indentation
|
||||
vim.bo.indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()"
|
||||
end
|
||||
-- enables treesiter based indentation
|
||||
vim.bo.indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()"
|
||||
end
|
||||
|
||||
local available_parsers = require("nvim-treesitter").get_available()
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
callback = function(args)
|
||||
local buf, filetype = args.buf, args.match
|
||||
local language = vim.treesitter.language.get_lang(filetype)
|
||||
if not language then
|
||||
return
|
||||
end
|
||||
local available_parsers = require("nvim-treesitter").get_available()
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
callback = function(args)
|
||||
local buf, filetype = args.buf, args.match
|
||||
local language = vim.treesitter.language.get_lang(filetype)
|
||||
if not language then
|
||||
return
|
||||
end
|
||||
|
||||
local installed_parsers = require("nvim-treesitter").get_installed("parsers")
|
||||
local installed_parsers = require("nvim-treesitter").get_installed("parsers")
|
||||
|
||||
if vim.tbl_contains(installed_parsers, language) then
|
||||
-- enable the parser if it is installed
|
||||
treesitter_try_attach(buf, language)
|
||||
elseif vim.tbl_contains(available_parsers, language) then
|
||||
-- if a parser is available in `nvim-treesitter` enable it after ensuring it is installed
|
||||
require("nvim-treesitter").install(language):await(function()
|
||||
treesitter_try_attach(buf, language)
|
||||
end)
|
||||
else
|
||||
-- try to enable treesitter features in case the parser exists but is not available from `nvim-treesitter`
|
||||
treesitter_try_attach(buf, language)
|
||||
end
|
||||
end,
|
||||
})
|
||||
end,
|
||||
},
|
||||
{
|
||||
"nvim-treesitter-textobjects",
|
||||
lazy = false,
|
||||
before = function(plugin)
|
||||
vim.g.no_plugin_maps = true
|
||||
end,
|
||||
after = function(plugin)
|
||||
require("nvim-treesitter-textobjects").setup {
|
||||
select = {
|
||||
lookahead = true,
|
||||
selection_modes = {
|
||||
['@parameter.outer'] = 'v', -- charwise
|
||||
['@function.outer'] = 'V', -- linewise
|
||||
},
|
||||
include_surrounding_whitespace = false,
|
||||
if vim.tbl_contains(installed_parsers, language) then
|
||||
-- enable the parser if it is installed
|
||||
treesitter_try_attach(buf, language)
|
||||
elseif vim.tbl_contains(available_parsers, language) then
|
||||
-- if a parser is available in `nvim-treesitter` enable it after ensuring it is installed
|
||||
require("nvim-treesitter").install(language):await(function()
|
||||
treesitter_try_attach(buf, language)
|
||||
end)
|
||||
else
|
||||
-- try to enable treesitter features in case the parser exists but is not available from `nvim-treesitter`
|
||||
treesitter_try_attach(buf, language)
|
||||
end
|
||||
end,
|
||||
})
|
||||
end,
|
||||
},
|
||||
}
|
||||
{
|
||||
"nvim-treesitter-textobjects",
|
||||
lazy = false,
|
||||
before = function(plugin)
|
||||
vim.g.no_plugin_maps = true
|
||||
end,
|
||||
after = function(plugin)
|
||||
require("nvim-treesitter-textobjects").setup({
|
||||
select = {
|
||||
lookahead = true,
|
||||
selection_modes = {
|
||||
["@parameter.outer"] = "v", -- charwise
|
||||
["@function.outer"] = "V", -- linewise
|
||||
},
|
||||
include_surrounding_whitespace = false,
|
||||
},
|
||||
})
|
||||
|
||||
-- keymaps
|
||||
vim.keymap.set({ "x", "o" }, "am", function()
|
||||
require "nvim-treesitter-textobjects.select".select_textobject("@function.outer", "textobjects")
|
||||
end)
|
||||
vim.keymap.set({ "x", "o" }, "im", function()
|
||||
require "nvim-treesitter-textobjects.select".select_textobject("@function.inner", "textobjects")
|
||||
end)
|
||||
vim.keymap.set({ "x", "o" }, "ac", function()
|
||||
require "nvim-treesitter-textobjects.select".select_textobject("@class.outer", "textobjects")
|
||||
end)
|
||||
vim.keymap.set({ "x", "o" }, "ic", function()
|
||||
require "nvim-treesitter-textobjects.select".select_textobject("@class.inner", "textobjects")
|
||||
end)
|
||||
-- You can also use captures from other query groups like `locals.scm`
|
||||
vim.keymap.set({ "x", "o" }, "as", function()
|
||||
require "nvim-treesitter-textobjects.select".select_textobject("@local.scope", "locals")
|
||||
end)
|
||||
-- keymaps
|
||||
vim.keymap.set({ "x", "o" }, "am", function()
|
||||
require("nvim-treesitter-textobjects.select").select_textobject("@function.outer", "textobjects")
|
||||
end)
|
||||
vim.keymap.set({ "x", "o" }, "im", function()
|
||||
require("nvim-treesitter-textobjects.select").select_textobject("@function.inner", "textobjects")
|
||||
end)
|
||||
vim.keymap.set({ "x", "o" }, "ac", function()
|
||||
require("nvim-treesitter-textobjects.select").select_textobject("@class.outer", "textobjects")
|
||||
end)
|
||||
vim.keymap.set({ "x", "o" }, "ic", function()
|
||||
require("nvim-treesitter-textobjects.select").select_textobject("@class.inner", "textobjects")
|
||||
end)
|
||||
-- You can also use captures from other query groups like `locals.scm`
|
||||
vim.keymap.set({ "x", "o" }, "as", function()
|
||||
require("nvim-treesitter-textobjects.select").select_textobject("@local.scope", "locals")
|
||||
end)
|
||||
|
||||
-- NOTE: for more textobjects options, see the following link.
|
||||
-- This template is using the new `main` branch of the repo.
|
||||
-- https://github.com/nvim-treesitter/nvim-treesitter-textobjects/tree/main
|
||||
end,
|
||||
},
|
||||
-- NOTE: for more textobjects options, see the following link.
|
||||
-- This template is using the new `main` branch of the repo.
|
||||
-- https://github.com/nvim-treesitter/nvim-treesitter-textobjects/tree/main
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue