forked from foxora/nix
init
This commit is contained in:
commit
a07bd5fd9b
66 changed files with 6115 additions and 0 deletions
5
homes/modules/programs/neovim/lua/plugins/dressing.lua
Normal file
5
homes/modules/programs/neovim/lua/plugins/dressing.lua
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
return {
|
||||
{
|
||||
"dressing.nvim"
|
||||
},
|
||||
}
|
||||
15
homes/modules/programs/neovim/lua/plugins/fyler.lua
Normal file
15
homes/modules/programs/neovim/lua/plugins/fyler.lua
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
return {
|
||||
{
|
||||
"fyler.nvim",
|
||||
cmd = { "Fyler" },
|
||||
keys = {
|
||||
{ "<leader>tf", function() return require('fyler').toggle({ kind = "split_right" }) end, mode = {"n"}, desc = 'Open [F]yler' },
|
||||
},
|
||||
load = function (name)
|
||||
vim.cmd.packadd(name)
|
||||
end,
|
||||
after = function(plugin)
|
||||
local fyler = require("fyler").setup()
|
||||
end,
|
||||
},
|
||||
}
|
||||
8
homes/modules/programs/neovim/lua/plugins/init.lua
Normal file
8
homes/modules/programs/neovim/lua/plugins/init.lua
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
require("lze").load {
|
||||
{ import = "plugins.dressing", },
|
||||
{ import = "plugins.telescope", },
|
||||
{ import = "plugins.treesitter", },
|
||||
{ import = "plugins.fyler", },
|
||||
{ import = "plugins.mini-hipatterns", },
|
||||
--{ import = "plugins.neocord", },
|
||||
}
|
||||
|
|
@ -0,0 +1,76 @@
|
|||
return {
|
||||
{
|
||||
"mini.hipatterns",
|
||||
after = function(plugin)
|
||||
local hipatterns = require("mini.hipatterns")
|
||||
|
||||
-- Returns hex color group for matching short hex color.
|
||||
--
|
||||
---@param match string
|
||||
---@return string
|
||||
local hex_color_short = function(_, match)
|
||||
local style = 'fg' -- 'fg' or 'bg', for extmark_opts_inline use 'fg'
|
||||
local r, g, b = match:sub(2, 2), match:sub(3, 3), match:sub(4, 4)
|
||||
local hex = string.format('#%s%s%s%s%s%s', r, r, g, g, b, b)
|
||||
return hipatterns.compute_hex_color_group(hex, style)
|
||||
end
|
||||
|
||||
-- Returns hex color group for matching alpha hex color.
|
||||
--
|
||||
---@param match string
|
||||
---@return string
|
||||
local hex_color_alpha = function(_, match)
|
||||
local style = 'fg' -- 'fg' or 'bg', for extmark_opts_inline use 'fg'
|
||||
local r, g, b = match:sub(2, 3), match:sub(4, 5), match:sub(6, 7)
|
||||
local hex = string.format('#%s%s%s', r, g, b)
|
||||
return hipatterns.compute_hex_color_group(hex, style)
|
||||
end
|
||||
|
||||
-- Returns extmark opts for highlights with virtual inline text.
|
||||
--
|
||||
---@param data table Includes `hl_group`, `full_match` and more.
|
||||
---@return table
|
||||
local extmark_opts_inline = function(_, _, data)
|
||||
return {
|
||||
virt_text = { { '', data.hl_group } },
|
||||
virt_text_pos = 'inline',
|
||||
right_gravity = false,
|
||||
}
|
||||
end
|
||||
|
||||
-- Returns extmark opts for highlights with virtual inline text.
|
||||
--
|
||||
---@param data table Includes `hl_group`, `full_match` and more.
|
||||
---@return table
|
||||
local extmark_opts_inline_alpha = function(_, _, data)
|
||||
return {
|
||||
virt_text = { { '', data.hl_group } },
|
||||
virt_text_pos = 'inline',
|
||||
right_gravity = false,
|
||||
}
|
||||
end
|
||||
|
||||
hipatterns.setup({
|
||||
highlighters = {
|
||||
-- #rrggbb
|
||||
hex_color = hipatterns.gen_highlighter.hex_color({
|
||||
style = "inline",
|
||||
inline_text = '',
|
||||
}),
|
||||
-- #rgb
|
||||
hex_color_short = {
|
||||
pattern = "#%x%x%x%f[%X]",
|
||||
group = hex_color_short,
|
||||
extmark_opts = extmark_opts_inline,
|
||||
},
|
||||
-- #rrggbbaa
|
||||
hex_color_alpha = {
|
||||
pattern = "#%x%x%x%x%x%x%x%x%f[%X]",
|
||||
group = hex_color_alpha,
|
||||
extmark_opts = extmark_opts_inline_alpha,
|
||||
},
|
||||
},
|
||||
})
|
||||
end,
|
||||
},
|
||||
}
|
||||
5
homes/modules/programs/neovim/lua/plugins/neocord.lua
Normal file
5
homes/modules/programs/neovim/lua/plugins/neocord.lua
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
return {
|
||||
{
|
||||
"neocord",
|
||||
},
|
||||
}
|
||||
36
homes/modules/programs/neovim/lua/plugins/telescope.lua
Normal file
36
homes/modules/programs/neovim/lua/plugins/telescope.lua
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
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.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,
|
||||
},
|
||||
}
|
||||
95
homes/modules/programs/neovim/lua/plugins/treesitter.lua
Normal file
95
homes/modules/programs/neovim/lua/plugins/treesitter.lua
Normal file
|
|
@ -0,0 +1,95 @@
|
|||
-- to help me write this after nvim-treesitter updated, i used:
|
||||
-- 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
|
||||
|
||||
-- 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 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 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,
|
||||
},
|
||||
}
|
||||
|
||||
-- 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,
|
||||
},
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue