mirror of
https://github.com/js0ny/dotfiles.git
synced 2025-12-21 08:43:00 +00:00
Initial Commit
This commit is contained in:
commit
40e939bfb4
42 changed files with 4349 additions and 0 deletions
193
nvim/lua/plugins/example.lua
Normal file
193
nvim/lua/plugins/example.lua
Normal file
|
|
@ -0,0 +1,193 @@
|
|||
-- since this is just an example spec, don't actually load anything here and return an empty spec
|
||||
-- stylua: ignore
|
||||
if true then return {} end
|
||||
|
||||
-- every spec file under the "plugins" directory will be loaded automatically by lazy.nvim
|
||||
--
|
||||
-- In your plugin files, you can:
|
||||
-- * add extra plugins
|
||||
-- * disable/enabled LazyVim plugins
|
||||
-- * override the configuration of LazyVim plugins
|
||||
return {
|
||||
-- add gruvbox
|
||||
{ "ellisonleao/gruvbox.nvim" },
|
||||
|
||||
-- Configure LazyVim to load gruvbox
|
||||
{
|
||||
"LazyVim/LazyVim",
|
||||
opts = {
|
||||
colorscheme = "gruvbox",
|
||||
},
|
||||
},
|
||||
|
||||
-- change trouble config
|
||||
{
|
||||
"folke/trouble.nvim",
|
||||
-- opts will be merged with the parent spec
|
||||
opts = { use_diagnostic_signs = true },
|
||||
},
|
||||
|
||||
-- disable trouble
|
||||
{ "folke/trouble.nvim", enabled = false },
|
||||
|
||||
-- override nvim-cmp and add cmp-emoji
|
||||
{
|
||||
"hrsh7th/nvim-cmp",
|
||||
dependencies = { "hrsh7th/cmp-emoji" },
|
||||
---@param opts cmp.ConfigSchema
|
||||
opts = function(_, opts)
|
||||
table.insert(opts.sources, { name = "emoji" })
|
||||
end,
|
||||
},
|
||||
|
||||
-- change some telescope options and a keymap to browse plugin files
|
||||
{
|
||||
"nvim-telescope/telescope.nvim",
|
||||
keys = {
|
||||
-- add a keymap to browse plugin files
|
||||
-- stylua: ignore
|
||||
{
|
||||
"<leader>fp",
|
||||
function() require("telescope.builtin").find_files({ cwd = require("lazy.core.config").options.root }) end,
|
||||
desc = "Find Plugin File",
|
||||
},
|
||||
},
|
||||
-- change some options
|
||||
opts = {
|
||||
defaults = {
|
||||
layout_strategy = "horizontal",
|
||||
layout_config = { prompt_position = "top" },
|
||||
sorting_strategy = "ascending",
|
||||
winblend = 0,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
-- add pyright to lspconfig
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
---@class PluginLspOpts
|
||||
opts = {
|
||||
---@type lspconfig.options
|
||||
servers = {
|
||||
-- pyright will be automatically installed with mason and loaded with lspconfig
|
||||
pyright = {},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
-- add tsserver and setup with typescript.nvim instead of lspconfig
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
dependencies = {
|
||||
"jose-elias-alvarez/typescript.nvim",
|
||||
init = function()
|
||||
require("lazyvim.util").lsp.on_attach(function(_, buffer)
|
||||
-- stylua: ignore
|
||||
vim.keymap.set( "n", "<leader>co", "TypescriptOrganizeImports", { buffer = buffer, desc = "Organize Imports" })
|
||||
vim.keymap.set("n", "<leader>cR", "TypescriptRenameFile", { desc = "Rename File", buffer = buffer })
|
||||
end)
|
||||
end,
|
||||
},
|
||||
---@class PluginLspOpts
|
||||
opts = {
|
||||
---@type lspconfig.options
|
||||
servers = {
|
||||
-- tsserver will be automatically installed with mason and loaded with lspconfig
|
||||
tsserver = {},
|
||||
},
|
||||
-- you can do any additional lsp server setup here
|
||||
-- return true if you don't want this server to be setup with lspconfig
|
||||
---@type table<string, fun(server:string, opts:_.lspconfig.options):boolean?>
|
||||
setup = {
|
||||
-- example to setup with typescript.nvim
|
||||
tsserver = function(_, opts)
|
||||
require("typescript").setup({ server = opts })
|
||||
return true
|
||||
end,
|
||||
-- Specify * to use this function as a fallback for any server
|
||||
-- ["*"] = function(server, opts) end,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
-- for typescript, LazyVim also includes extra specs to properly setup lspconfig,
|
||||
-- treesitter, mason and typescript.nvim. So instead of the above, you can use:
|
||||
{ import = "lazyvim.plugins.extras.lang.typescript" },
|
||||
|
||||
-- add more treesitter parsers
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
opts = {
|
||||
ensure_installed = {
|
||||
"bash",
|
||||
"html",
|
||||
"javascript",
|
||||
"json",
|
||||
"lua",
|
||||
"markdown",
|
||||
"markdown_inline",
|
||||
"python",
|
||||
"query",
|
||||
"regex",
|
||||
"tsx",
|
||||
"typescript",
|
||||
"vim",
|
||||
"yaml",
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
-- since `vim.tbl_deep_extend`, can only merge tables and not lists, the code above
|
||||
-- would overwrite `ensure_installed` with the new value.
|
||||
-- If you'd rather extend the default config, use the code below instead:
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
opts = function(_, opts)
|
||||
-- add tsx and treesitter
|
||||
vim.list_extend(opts.ensure_installed, {
|
||||
"tsx",
|
||||
"typescript",
|
||||
})
|
||||
end,
|
||||
},
|
||||
|
||||
-- the opts function can also be used to change the default opts:
|
||||
{
|
||||
"nvim-lualine/lualine.nvim",
|
||||
event = "VeryLazy",
|
||||
opts = function(_, opts)
|
||||
table.insert(opts.sections.lualine_x, "😄")
|
||||
end,
|
||||
},
|
||||
|
||||
-- or you can return new options to override all the defaults
|
||||
{
|
||||
"nvim-lualine/lualine.nvim",
|
||||
event = "VeryLazy",
|
||||
opts = function()
|
||||
return {
|
||||
--[[add your custom lualine config here]]
|
||||
}
|
||||
end,
|
||||
},
|
||||
|
||||
-- use mini.starter instead of alpha
|
||||
{ import = "lazyvim.plugins.extras.ui.mini-starter" },
|
||||
|
||||
-- add jsonls and schemastore packages, and setup treesitter for json, json5 and jsonc
|
||||
{ import = "lazyvim.plugins.extras.lang.json" },
|
||||
|
||||
-- add any tools you want to have installed below
|
||||
{
|
||||
"williamboman/mason.nvim",
|
||||
opts = {
|
||||
ensure_installed = {
|
||||
"stylua",
|
||||
"shellcheck",
|
||||
"shfmt",
|
||||
"flake8",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
228
nvim/lua/plugins/fzf.lua
Normal file
228
nvim/lua/plugins/fzf.lua
Normal file
|
|
@ -0,0 +1,228 @@
|
|||
return {
|
||||
{
|
||||
"ibhagwan/fzf-lua",
|
||||
cmd = "FzfLua",
|
||||
opts = function(_, opts)
|
||||
local config = require("fzf-lua.config")
|
||||
local actions = require("fzf-lua.actions")
|
||||
|
||||
-- Quickfix
|
||||
config.defaults.keymap.fzf["ctrl-q"] = "select-all+accept"
|
||||
config.defaults.keymap.fzf["ctrl-u"] = "half-page-up"
|
||||
config.defaults.keymap.fzf["ctrl-d"] = "half-page-down"
|
||||
config.defaults.keymap.fzf["ctrl-x"] = "jump"
|
||||
config.defaults.keymap.fzf["ctrl-f"] = "preview-page-down"
|
||||
config.defaults.keymap.fzf["ctrl-b"] = "preview-page-up"
|
||||
config.defaults.keymap.builtin["<c-f>"] = "preview-page-down"
|
||||
config.defaults.keymap.builtin["<c-b>"] = "preview-page-up"
|
||||
|
||||
-- Trouble
|
||||
if LazyVim.has("trouble.nvim") then
|
||||
config.defaults.actions.files["ctrl-t"] = require("trouble.sources.fzf").actions.open
|
||||
end
|
||||
|
||||
-- Toggle root dir / cwd
|
||||
config.defaults.actions.files["ctrl-r"] = function(_, ctx)
|
||||
local o = vim.deepcopy(ctx.__call_opts)
|
||||
o.root = o.root == false
|
||||
o.cwd = nil
|
||||
o.buf = ctx.__CTX.bufnr
|
||||
LazyVim.pick.open(ctx.__INFO.cmd, o)
|
||||
end
|
||||
config.defaults.actions.files["alt-c"] = config.defaults.actions.files["ctrl-r"]
|
||||
config.set_action_helpstr(config.defaults.actions.files["ctrl-r"], "toggle-root-dir")
|
||||
|
||||
-- use the same prompt for all
|
||||
local defaults = require("fzf-lua.profiles.default-title")
|
||||
local function fix(t)
|
||||
t.prompt = t.prompt ~= nil and " " or nil
|
||||
for _, v in pairs(t) do
|
||||
if type(v) == "table" then
|
||||
fix(v)
|
||||
end
|
||||
end
|
||||
end
|
||||
fix(defaults)
|
||||
|
||||
local img_previewer ---@type string[]?
|
||||
for _, v in ipairs({
|
||||
{ cmd = "ueberzug", args = {} },
|
||||
{ cmd = "chafa", args = { "{file}", "--format=symbols" } },
|
||||
{ cmd = "viu", args = { "-b" } },
|
||||
}) do
|
||||
if vim.fn.executable(v.cmd) == 1 then
|
||||
img_previewer = vim.list_extend({ v.cmd }, v.args)
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
return vim.tbl_deep_extend("force", defaults, {
|
||||
fzf_colors = true,
|
||||
fzf_opts = {
|
||||
["--no-scrollbar"] = false,
|
||||
},
|
||||
defaults = {
|
||||
-- formatter = "path.filename_first",
|
||||
formatter = "path.dirname_first",
|
||||
},
|
||||
previewers = {
|
||||
builtin = {
|
||||
extensions = {
|
||||
["png"] = img_previewer,
|
||||
["jpg"] = img_previewer,
|
||||
["jpeg"] = img_previewer,
|
||||
["gif"] = img_previewer,
|
||||
["webp"] = img_previewer,
|
||||
},
|
||||
ueberzug_scaler = "fit_contain",
|
||||
},
|
||||
},
|
||||
-- Custom LazyVim option to configure vim.ui.select
|
||||
ui_select = function(fzf_opts, items)
|
||||
return vim.tbl_deep_extend("force", fzf_opts, {
|
||||
prompt = " ",
|
||||
winopts = {
|
||||
title = " " .. vim.trim((fzf_opts.prompt or "Select"):gsub("%s*:%s*$", "")) .. " ",
|
||||
title_pos = "center",
|
||||
},
|
||||
}, fzf_opts.kind == "codeaction" and {
|
||||
winopts = {
|
||||
layout = "vertical",
|
||||
-- height is number of items minus 15 lines for the preview, with a max of 80% screen height
|
||||
height = math.floor(math.min(vim.o.lines * 0.8 - 16, #items + 2) + 0.5) + 16,
|
||||
width = 0.5,
|
||||
preview = not vim.tbl_isempty(LazyVim.lsp.get_clients({ bufnr = 0, name = "vtsls" })) and {
|
||||
layout = "vertical",
|
||||
vertical = "down:15,border-top",
|
||||
hidden = "hidden",
|
||||
} or {
|
||||
layout = "vertical",
|
||||
vertical = "down:15,border-top",
|
||||
},
|
||||
},
|
||||
} or {
|
||||
winopts = {
|
||||
width = 0.5,
|
||||
-- height is number of items, with a max of 80% screen height
|
||||
height = math.floor(math.min(vim.o.lines * 0.8, #items + 2) + 0.5),
|
||||
},
|
||||
})
|
||||
end,
|
||||
winopts = {
|
||||
width = 0.8,
|
||||
height = 0.8,
|
||||
row = 0.5,
|
||||
col = 0.5,
|
||||
preview = {
|
||||
scrollchars = { "┃", "" },
|
||||
},
|
||||
},
|
||||
files = {
|
||||
cwd_prompt = false,
|
||||
actions = {
|
||||
["alt-i"] = { actions.toggle_ignore },
|
||||
["alt-h"] = { actions.toggle_hidden },
|
||||
},
|
||||
},
|
||||
grep = {
|
||||
actions = {
|
||||
["alt-i"] = { actions.toggle_ignore },
|
||||
["alt-h"] = { actions.toggle_hidden },
|
||||
},
|
||||
},
|
||||
lsp = {
|
||||
symbols = {
|
||||
symbol_hl = function(s)
|
||||
return "TroubleIcon" .. s
|
||||
end,
|
||||
symbol_fmt = function(s)
|
||||
return s:lower() .. "\t"
|
||||
end,
|
||||
child_prefix = false,
|
||||
},
|
||||
code_actions = {
|
||||
previewer = vim.fn.executable("delta") == 1 and "codeaction_native" or nil,
|
||||
},
|
||||
},
|
||||
})
|
||||
end,
|
||||
config = function(_, opts)
|
||||
require("fzf-lua").setup(opts)
|
||||
end,
|
||||
init = function()
|
||||
LazyVim.on_very_lazy(function()
|
||||
vim.ui.select = function(...)
|
||||
require("lazy").load({ plugins = { "fzf-lua" } })
|
||||
local opts = LazyVim.opts("fzf-lua") or {}
|
||||
require("fzf-lua").register_ui_select(opts.ui_select or nil)
|
||||
return vim.ui.select(...)
|
||||
end
|
||||
end)
|
||||
end,
|
||||
keys = {
|
||||
{ "<c-j>", "<c-j>", ft = "fzf", mode = "t", nowait = true },
|
||||
{ "<c-k>", "<c-k>", ft = "fzf", mode = "t", nowait = true },
|
||||
{
|
||||
"<leader>,",
|
||||
"<cmd>FzfLua buffers sort_mru=true sort_lastused=true<cr>",
|
||||
desc = "Switch Buffer",
|
||||
},
|
||||
{ "<leader>/", LazyVim.pick("live_grep"), desc = "Grep (Root Dir)" },
|
||||
{ "<leader>:", "<cmd>FzfLua command_history<cr>", desc = "Command History" },
|
||||
{ "<leader><space>", LazyVim.pick("files"), desc = "Find Files (Root Dir)" },
|
||||
-- find
|
||||
{ "<leader>fb", "<cmd>FzfLua buffers sort_mru=true sort_lastused=true<cr>", desc = "Buffers" },
|
||||
{ "<leader>fc", LazyVim.pick.config_files(), desc = "Find Config File" },
|
||||
{ "<leader>ff", LazyVim.pick("files"), desc = "Find Files (Root Dir)" },
|
||||
{ "<leader>fF", LazyVim.pick("files", { root = false }), desc = "Find Files (cwd)" },
|
||||
{ "<leader>fg", "<cmd>FzfLua git_files<cr>", desc = "Find Files (git-files)" },
|
||||
{ "<leader>fr", "<cmd>FzfLua oldfiles<cr>", desc = "Recent" },
|
||||
{ "<leader>fR", LazyVim.pick("oldfiles", { cwd = vim.uv.cwd() }), desc = "Recent (cwd)" },
|
||||
-- git
|
||||
{ "<leader>gc", "<cmd>FzfLua git_commits<CR>", desc = "Commits" },
|
||||
{ "<leader>gs", "<cmd>FzfLua git_status<CR>", desc = "Status" },
|
||||
-- search
|
||||
{ '<leader>s"', "<cmd>FzfLua registers<cr>", desc = "Registers" },
|
||||
{ "<leader>sa", "<cmd>FzfLua autocmds<cr>", desc = "Auto Commands" },
|
||||
{ "<leader>sb", "<cmd>FzfLua grep_curbuf<cr>", desc = "Buffer" },
|
||||
{ "<leader>sc", "<cmd>FzfLua command_history<cr>", desc = "Command History" },
|
||||
{ "<leader>sC", "<cmd>FzfLua commands<cr>", desc = "Commands" },
|
||||
{ "<leader>sd", "<cmd>FzfLua diagnostics_document<cr>", desc = "Document Diagnostics" },
|
||||
{ "<leader>sD", "<cmd>FzfLua diagnostics_workspace<cr>", desc = "Workspace Diagnostics" },
|
||||
{ "<leader>sg", LazyVim.pick("live_grep"), desc = "Grep (Root Dir)" },
|
||||
{ "<leader>sG", LazyVim.pick("live_grep", { root = false }), desc = "Grep (cwd)" },
|
||||
{ "<leader>sh", "<cmd>FzfLua help_tags<cr>", desc = "Help Pages" },
|
||||
{ "<leader>sH", "<cmd>FzfLua highlights<cr>", desc = "Search Highlight Groups" },
|
||||
{ "<leader>sj", "<cmd>FzfLua jumps<cr>", desc = "Jumplist" },
|
||||
{ "<leader>sk", "<cmd>FzfLua keymaps<cr>", desc = "Key Maps" },
|
||||
{ "<leader>sl", "<cmd>FzfLua loclist<cr>", desc = "Location List" },
|
||||
{ "<leader>sM", "<cmd>FzfLua man_pages<cr>", desc = "Man Pages" },
|
||||
{ "<leader>sm", "<cmd>FzfLua marks<cr>", desc = "Jump to Mark" },
|
||||
{ "<leader>sR", "<cmd>FzfLua resume<cr>", desc = "Resume" },
|
||||
{ "<leader>sq", "<cmd>FzfLua quickfix<cr>", desc = "Quickfix List" },
|
||||
{ "<leader>sw", LazyVim.pick("grep_cword"), desc = "Word (Root Dir)" },
|
||||
{ "<leader>sW", LazyVim.pick("grep_cword", { root = false }), desc = "Word (cwd)" },
|
||||
{ "<leader>sw", LazyVim.pick("grep_visual"), mode = "v", desc = "Selection (Root Dir)" },
|
||||
{ "<leader>sW", LazyVim.pick("grep_visual", { root = false }), mode = "v", desc = "Selection (cwd)" },
|
||||
{ "<leader>uC", LazyVim.pick("colorschemes"), desc = "Colorscheme with Preview" },
|
||||
{
|
||||
"<leader>ss",
|
||||
function()
|
||||
require("fzf-lua").lsp_document_symbols({
|
||||
regex_filter = symbols_filter,
|
||||
})
|
||||
end,
|
||||
desc = "Goto Symbol",
|
||||
},
|
||||
{
|
||||
"<leader>sS",
|
||||
function()
|
||||
require("fzf-lua").lsp_live_workspace_symbols({
|
||||
regex_filter = symbols_filter,
|
||||
})
|
||||
end,
|
||||
desc = "Goto Symbol (Workspace)",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
3
nvim/lua/plugins/wakatime.lua
Normal file
3
nvim/lua/plugins/wakatime.lua
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
return {
|
||||
{ "wakatime/vim-wakatime", lazy = false },
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue