Browse Source

feat: add ThePrimegean/refactoring.nvim

master
Tovi Jaeschke-Rogers 2 months ago
parent
commit
64c177f9f4
29 changed files with 1065 additions and 1123 deletions
  1. +0
    -1
      .config/nvim/lua/core/init.lua
  2. +1
    -0
      .config/nvim/lua/core/remaps.lua
  3. +12
    -13
      .config/nvim/lua/lazy-plugin-manager.lua
  4. +13
    -13
      .config/nvim/lua/plugins/cloak.lua
  5. +3
    -3
      .config/nvim/lua/plugins/colorizer.lua
  6. +32
    -147
      .config/nvim/lua/plugins/colorscheme.lua
  7. +51
    -51
      .config/nvim/lua/plugins/flash.lua
  8. +34
    -34
      .config/nvim/lua/plugins/formatting.lua
  9. +44
    -44
      .config/nvim/lua/plugins/fugitive.lua
  10. +44
    -44
      .config/nvim/lua/plugins/gitsigns.lua
  11. +45
    -41
      .config/nvim/lua/plugins/harpoon.lua
  12. +2
    -2
      .config/nvim/lua/plugins/init.lua
  13. +73
    -73
      .config/nvim/lua/plugins/laravel.lua
  14. +74
    -74
      .config/nvim/lua/plugins/linting.lua
  15. +48
    -16
      .config/nvim/lua/plugins/lspconfig.lua
  16. +84
    -85
      .config/nvim/lua/plugins/nvim-cmp.lua
  17. +1
    -1
      .config/nvim/lua/plugins/nvim-go.lua
  18. +114
    -114
      .config/nvim/lua/plugins/nvim-treesitter.lua
  19. +3
    -3
      .config/nvim/lua/plugins/nvim-ts-context-commentstring.lua
  20. +87
    -87
      .config/nvim/lua/plugins/oil.lua
  21. +10
    -0
      .config/nvim/lua/plugins/refactoring.lua
  22. +6
    -6
      .config/nvim/lua/plugins/scissors.lua
  23. +182
    -179
      .config/nvim/lua/plugins/telescope.lua
  24. +17
    -17
      .config/nvim/lua/plugins/tmux.lua
  25. +11
    -11
      .config/nvim/lua/plugins/todo-comments.lua
  26. +43
    -33
      .config/nvim/lua/plugins/trouble.lua
  27. +9
    -9
      .config/nvim/lua/plugins/undotree.lua
  28. +21
    -21
      .config/nvim/lua/plugins/vim-dadbod.lua
  29. +1
    -1
      .zshrc

+ 0
- 1
.config/nvim/lua/core/init.lua View File

@ -2,4 +2,3 @@ require('core.options')
require('core.remaps') require('core.remaps')
require('core.autocmd') require('core.autocmd')
require('core.commands') require('core.commands')

+ 1
- 0
.config/nvim/lua/core/remaps.lua View File

@ -1,3 +1,4 @@
vim.keymap.set("i", "jk", "<esc>", {})
-- Don't copy "c" changes to primary register -- Don't copy "c" changes to primary register
vim.keymap.set("n", "c", '"_c', { desc = "Prevent copying to primary register" }) vim.keymap.set("n", "c", '"_c', { desc = "Prevent copying to primary register" })


+ 12
- 13
.config/nvim/lua/lazy-plugin-manager.lua View File

@ -5,22 +5,21 @@ if not vim.loop.fs_stat(lazypath) then
"clone", "clone",
"--filter=blob:none", "--filter=blob:none",
"https://github.com/folke/lazy.nvim.git", "https://github.com/folke/lazy.nvim.git",
"--branch=stable", -- latest stable release
"--branch=stable",
lazypath, lazypath,
}) })
end end
vim.opt.rtp:prepend(lazypath) vim.opt.rtp:prepend(lazypath)
require("lazy").setup(
{
{ import = "plugins" },
},
{
checker = {
enabled = true,
notify = false,
},
change_detection = {
notify = false,
},
require("lazy").setup({
{ import = "plugins" },
}, {
checker = {
enabled = true,
notify = false,
},
change_detection = {
notify = false,
},
colorscheme = "kanagawa",
}) })

+ 13
- 13
.config/nvim/lua/plugins/cloak.lua View File

@ -1,15 +1,15 @@
return { return {
"laytan/cloak.nvim",
config = function()
require("cloak").setup({
enabled = true,
patterns = {
{
file_pattern = ".env*",
cloak_pattern = "=.+",
replace = "*",
},
}
})
end,
"laytan/cloak.nvim",
config = function()
require("cloak").setup({
enabled = true,
patterns = {
{
file_pattern = ".env*",
cloak_pattern = "=.+",
replace = "*",
},
},
})
end,
} }

+ 3
- 3
.config/nvim/lua/plugins/colorizer.lua View File

@ -1,5 +1,5 @@
return { return {
"NvChad/nvim-colorizer.lua",
event = { "BufReadPre", "BufNewFile" },
config = true,
"NvChad/nvim-colorizer.lua",
event = { "BufReadPre", "BufNewFile" },
config = true,
} }

+ 32
- 147
.config/nvim/lua/plugins/colorscheme.lua View File

@ -1,149 +1,34 @@
return { return {
{
"catppuccin/nvim",
enabled = false,
name = "catppuccin",
priority = 1000,
config = function()
require("catppuccin").setup({
flavour = "mocha", -- latte, frappe, macchiato, mocha
background = { -- :h background
light = "latte",
dark = "mocha",
},
transparent_background = false, -- disables setting the background color.
show_end_of_buffer = false, -- shows the '~' characters after the end of buffers
term_colors = false, -- sets terminal colors (e.g. `g:terminal_color_0`)
dim_inactive = {
enabled = false, -- dims the background color of inactive window
shade = "dark",
percentage = 0.15, -- percentage of the shade to apply to the inactive window
},
no_italic = false, -- Force no italic
no_bold = false, -- Force no bold
no_underline = false, -- Force no underline
styles = { -- Handles the styles of general hi groups (see `:h highlight-args`):
comments = { "italic" }, -- Change the style of comments
conditionals = { "italic" },
loops = {},
functions = {},
keywords = {},
strings = {},
variables = {},
numbers = {},
booleans = {},
properties = {},
types = {},
operators = {},
-- miscs = {}, -- Uncomment to turn off hard-coded styles
},
color_overrides = {},
custom_highlights = {},
default_integrations = true,
integrations = {
cmp = true,
gitsigns = true,
nvimtree = true,
treesitter = true,
notify = false,
mini = {
enabled = true,
indentscope_color = "",
},
},
})
vim.cmd("colorscheme catppuccin")
end
},
{
"ellisonleao/gruvbox.nvim",
enabled = false,
priority = 1000,
config = function()
require("gruvbox").setup()
vim.cmd("colorscheme gruvbox")
end,
},
{
"rebelot/kanagawa.nvim",
enabled = true,
priority = 1000,
config = function()
-- Default options:
require('kanagawa').setup({
compile = false, -- enable compiling the colorscheme
undercurl = true, -- enable undercurls
commentStyle = { italic = true },
functionStyle = {},
keywordStyle = { italic = true },
statementStyle = { bold = true },
typeStyle = {},
transparent = false, -- do not set background color
dimInactive = false, -- dim inactive window `:h hl-NormalNC`
terminalColors = true, -- define vim.g.terminal_color_{0,17}
colors = { -- add/modify theme and palette colors
palette = {},
theme = { wave = {}, lotus = {}, dragon = {}, all = {} },
},
overrides = function(colors) -- add/modify highlights
return {}
end,
theme = "wave", -- Load "wave" theme when 'background' option is not set
background = { -- map the value of 'background' option to a theme
dark = "wave", -- try "dragon" !
light = "lotus"
},
})
-- setup must be called before loading
vim.cmd("colorscheme kanagawa")
end
},
{
"folke/tokyonight.nvim",
enabled = false,
lazy = false,
priority = 1000,
config = function()
require('tokyonight').setup()
vim.cmd("colorscheme tokyonight")
end
},
{
"Shatur/neovim-ayu",
enabled = false,
lazy = false,
priority = 1000,
config = function()
require('ayu').setup({
mirage = false, -- Set to `true` to use `mirage` variant instead of `dark` for dark background.
terminal = true, -- Set to `false` to let terminal manage its own colors.
overrides = {},
})
vim.cmd("colorscheme ayu-dark")
end
},
{
"0xstepit/flow.nvim",
enabled = false,
lazy = false,
priority = 1000,
opts = {},
config = function()
require("flow").setup {
transparent = false, -- Set transparent background.
fluo_color = "pink", -- Fluo color: pink, yellow, orange, or green.
mode = "normal", -- Intensity of the palette: normal, bright, desaturate, or dark. Notice that dark is ugly!
aggressive_spell = false, -- Display colors for spell check.
}
vim.cmd("colorscheme flow")
end,
}
"rebelot/kanagawa.nvim",
priority = 1000,
config = function()
-- Default options:
require("kanagawa").setup({
compile = false, -- enable compiling the colorscheme
undercurl = true, -- enable undercurls
commentStyle = { italic = true },
functionStyle = {},
keywordStyle = { italic = true },
statementStyle = { bold = true },
typeStyle = {},
transparent = false, -- do not set background color
dimInactive = false, -- dim inactive window `:h hl-NormalNC`
terminalColors = true, -- define vim.g.terminal_color_{0,17}
colors = { -- add/modify theme and palette colors
palette = {},
theme = { wave = {}, lotus = {}, dragon = {}, all = {} },
},
overrides = function(colors) -- add/modify highlights
return {}
end,
theme = "wave", -- Load "wave" theme when 'background' option is not set
background = { -- map the value of 'background' option to a theme
dark = "wave", -- try "dragon" !
light = "lotus",
},
})
-- setup must be called before loading
vim.cmd("colorscheme kanagawa")
end,
} }

+ 51
- 51
.config/nvim/lua/plugins/flash.lua View File

@ -1,53 +1,53 @@
return { return {
"folke/flash.nvim",
event = "VeryLazy",
opts = {
modes = {
char = {
enabled = false,
},
},
},
keys = {
{
"s",
mode = { "n", "x", "o" },
function()
require("flash").jump()
end,
desc = "Flash",
},
{
"S",
mode = { "n", "x", "o" },
function()
require("flash").treesitter()
end,
desc = "Flash Treesitter",
},
{
"r",
mode = "o",
function()
require("flash").remote()
end,
desc = "Remote Flash",
},
{
"R",
mode = { "o", "x" },
function()
require("flash").treesitter_search()
end,
desc = "Treesitter Search",
},
{
"<c-s>",
mode = { "c" },
function()
require("flash").toggle()
end,
desc = "Toggle Flash Search",
},
},
"folke/flash.nvim",
event = "VeryLazy",
opts = {
modes = {
char = {
enabled = false,
},
},
},
keys = {
{
"s",
mode = { "n", "x", "o" },
function()
require("flash").jump()
end,
desc = "Flash",
},
{
"S",
mode = { "n", "x", "o" },
function()
require("flash").treesitter()
end,
desc = "Flash Treesitter",
},
{
"r",
mode = "o",
function()
require("flash").remote()
end,
desc = "Remote Flash",
},
{
"R",
mode = { "o", "x" },
function()
require("flash").treesitter_search()
end,
desc = "Treesitter Search",
},
{
"<c-s>",
mode = { "c" },
function()
require("flash").toggle()
end,
desc = "Toggle Flash Search",
},
},
} }

+ 34
- 34
.config/nvim/lua/plugins/formatting.lua View File

@ -1,39 +1,39 @@
return { return {
"stevearc/conform.nvim",
event = { "BufReadPre", "BufNewFile" },
config = function()
local conform = require("conform")
"stevearc/conform.nvim",
event = { "BufReadPre", "BufNewFile" },
config = function()
local conform = require("conform")
conform.setup({
formatters_by_ft = {
lua = { "stylua" },
go = { "goimports", "gofmt" },
javascript = { "prettierd" },
typescript = { "prettierd" },
vue = { "prettierd" },
css = { "prettierd" },
html = { "prettierd" },
markdown = { "prettierd" },
json = { "fixjson" },
rust = { "rustfmt" },
shell = { "shfmt", "shellcheck" },
python = { "isort", "black" },
php = { "phpcbf" },
},
log_level = vim.log.levels.WARN,
notify_on_error = false,
})
conform.setup({
formatters_by_ft = {
lua = { "stylua" },
go = { "goimports", "gofmt" },
javascript = { "prettierd" },
typescript = { "prettierd" },
vue = { "prettierd" },
css = { "prettierd" },
html = { "prettierd" },
markdown = { "prettierd" },
json = { "fixjson" },
rust = { "rustfmt" },
shell = { "shfmt", "shellcheck" },
python = { "isort", "black" },
php = { "phpcbf" },
},
log_level = vim.log.levels.WARN,
notify_on_error = false,
})
vim.keymap.set({ "n", "v" }, "<leader>F", function()
conform.format({
lsp_fallback = true,
async = false,
timeout_ms = 500,
})
end)
vim.keymap.set({ "n", "v" }, "<leader>F", function()
conform.format({
lsp_fallback = true,
async = false,
timeout_ms = 500,
})
end)
conform.formatters.phpcbf = {
prepend_args = { "--standard=~/.config/phpcs.xml" },
}
end,
conform.formatters.phpcbf = {
prepend_args = { "--standard=~/.config/phpcs.xml" },
}
end,
} }

+ 44
- 44
.config/nvim/lua/plugins/fugitive.lua View File

@ -1,46 +1,46 @@
return { return {
"tpope/vim-fugitive",
dependencies = {
"shumphrey/fugitive-gitlab.vim",
},
config = function()
vim.opt.diffopt = vim.opt.diffopt + "vertical"
vim.opt.display = vim.opt.display + "lastline"
local fugitive_augroup = vim.api.nvim_create_augroup("fugitive_mappings", { clear = true })
local function set_fugitive_mappings()
local opts = { noremap = true, silent = true }
vim.api.nvim_buf_set_keymap(0, "n", "<leader>gp", "<cmd>Git push<CR>", opts)
vim.api.nvim_buf_set_keymap(0, "n", "<leader>gP", "<cmd>Git pull<CR>", opts)
vim.api.nvim_buf_set_keymap(0, "n", "<leader>gc", "<cmd>Git commit<CR>", opts)
end
-- Create an autocmd to trigger the function when entering a Fugitive buffer
vim.api.nvim_create_autocmd("FileType", {
group = fugitive_augroup,
pattern = "fugitive",
callback = set_fugitive_mappings,
})
local opts = { noremap = true, silent = true }
vim.keymap.set("n", "<leader>gg", "<cmd>Git<CR>", opts)
vim.keymap.set("v", "<leader>gl", function()
local startPos = vim.fn.getpos("'<")
local endPos = vim.fn.getpos("'>")
local startLine = startPos[2]
local endLine = endPos[2]
if startLine == 0 or endLine == 0 then
vim.notify(vim.inspect(vim.fn.getpos("'<")) .. " to " .. vim.inspect(vim.fn.getpos("'>")))
return
end
vim.cmd(string.format("Git log -L %d,%d:%s", startLine, endLine, vim.fn.expand("%:.")))
end, opts)
end,
"tpope/vim-fugitive",
dependencies = {
"shumphrey/fugitive-gitlab.vim",
},
config = function()
vim.opt.diffopt = vim.opt.diffopt + "vertical"
vim.opt.display = vim.opt.display + "lastline"
local fugitive_augroup = vim.api.nvim_create_augroup("fugitive_mappings", { clear = true })
local function set_fugitive_mappings()
local opts = { noremap = true, silent = true }
vim.api.nvim_buf_set_keymap(0, "n", "<leader>gp", "<cmd>Git push<CR>", opts)
vim.api.nvim_buf_set_keymap(0, "n", "<leader>gP", "<cmd>Git pull<CR>", opts)
vim.api.nvim_buf_set_keymap(0, "n", "<leader>gc", "<cmd>Git commit<CR>", opts)
end
-- Create an autocmd to trigger the function when entering a Fugitive buffer
vim.api.nvim_create_autocmd("FileType", {
group = fugitive_augroup,
pattern = "fugitive",
callback = set_fugitive_mappings,
})
local opts = { noremap = true, silent = true }
vim.keymap.set("n", "<leader>gg", "<cmd>Git<CR>", opts)
vim.keymap.set("v", "<leader>gl", function()
local startPos = vim.fn.getpos("'<")
local endPos = vim.fn.getpos("'>")
local startLine = startPos[2]
local endLine = endPos[2]
if startLine == 0 or endLine == 0 then
vim.notify(vim.inspect(vim.fn.getpos("'<")) .. " to " .. vim.inspect(vim.fn.getpos("'>")))
return
end
vim.cmd(string.format("Git log -L %d,%d:%s", startLine, endLine, vim.fn.expand("%:.")))
end, opts)
end,
} }

+ 44
- 44
.config/nvim/lua/plugins/gitsigns.lua View File

@ -1,46 +1,46 @@
return { return {
"lewis6991/gitsigns.nvim",
event = { "BufReadPre", "BufNewFile" },
config = function()
require('gitsigns').setup({
signs = {
add = { text = '' },
change = { text = '' },
delete = { text = '_' },
topdelete = { text = '' },
changedelete = { text = '~' },
untracked = { text = '' },
},
signcolumn = true, -- Toggle with `:Gitsigns toggle_signs`
numhl = false, -- Toggle with `:Gitsigns toggle_numhl`
linehl = false, -- Toggle with `:Gitsigns toggle_linehl`
word_diff = false, -- Toggle with `:Gitsigns toggle_word_diff`
watch_gitdir = {
follow_files = true
},
auto_attach = true,
attach_to_untracked = false,
current_line_blame = true, -- Toggle with `:Gitsigns toggle_current_line_blame`
current_line_blame_opts = {
virt_text = true,
virt_text_pos = 'eol',
delay = 0,
ignore_whitespace = false,
virt_text_priority = 100,
},
current_line_blame_formatter = '<author>, <author_time:%R> - <summary>',
sign_priority = 6,
update_debounce = 100,
status_formatter = nil, -- Use default
max_file_length = 40000, -- Disable if file is longer than this (in lines)
preview_config = {
-- Options passed to nvim_open_win
border = 'single',
style = 'minimal',
relative = 'cursor',
row = 0,
col = 1
},
})
end
"lewis6991/gitsigns.nvim",
event = { "BufReadPre", "BufNewFile" },
config = function()
require("gitsigns").setup({
signs = {
add = { text = "" },
change = { text = "" },
delete = { text = "_" },
topdelete = { text = "" },
changedelete = { text = "~" },
untracked = { text = "" },
},
signcolumn = true,
numhl = false,
linehl = false,
word_diff = false,
watch_gitdir = {
follow_files = true,
},
auto_attach = true,
attach_to_untracked = false,
current_line_blame = true, -- Toggle with `:Gitsigns toggle_current_line_blame`
current_line_blame_opts = {
virt_text = true,
virt_text_pos = "eol",
delay = 0,
ignore_whitespace = false,
virt_text_priority = 100,
},
current_line_blame_formatter = "<author>, <author_time:%R> - <summary>",
sign_priority = 6,
update_debounce = 100,
status_formatter = nil, -- Use default
max_file_length = 40000, -- Disable if file is longer than this (in lines)
preview_config = {
-- Options passed to nvim_open_win
border = "single",
style = "minimal",
relative = "cursor",
row = 0,
col = 1,
},
})
end,
} }

+ 45
- 41
.config/nvim/lua/plugins/harpoon.lua View File

@ -1,43 +1,47 @@
return { return {
"ThePrimeagen/harpoon",
branch = "harpoon2",
dependencies = {
"nvim-lua/plenary.nvim",
},
config = function()
local harpoon = require("harpoon")
-- REQUIRED
harpoon:setup()
-- REQUIRED
local keymap = vim.keymap
keymap.set("n", "<leader>a", function()
harpoon:list():add()
end, { desc = "Mark file with harpoon" })
keymap.set("n", "<C-e>", function()
harpoon.ui:toggle_quick_menu(harpoon:list())
end, { desc = "Toggle quick menu for harpoon" })
keymap.set("n", "<leader>1", function()
harpoon:list():select(1)
end, { desc = "Go to first harpoon file" })
keymap.set("n", "<leader>2", function()
harpoon:list():select(2)
end, { desc = "Go to second harpoon file" })
keymap.set("n", "<leader>3", function()
harpoon:list():select(3)
end, { desc = "Go to third harpoon file" })
keymap.set("n", "<leader>4", function()
harpoon:list():select(4)
end, { desc = "Go to fourth harpoon file" })
keymap.set("n", "<C-S-P>", function() harpoon:list():prev() end)
keymap.set("n", "<C-S-N>", function() harpoon:list():next() end)
end,
"ThePrimeagen/harpoon",
branch = "harpoon2",
dependencies = {
"nvim-lua/plenary.nvim",
},
config = function()
local harpoon = require("harpoon")
-- REQUIRED
harpoon:setup()
-- REQUIRED
local keymap = vim.keymap
keymap.set("n", "<leader>a", function()
harpoon:list():add()
end, { desc = "Mark file with harpoon" })
keymap.set("n", "<C-e>", function()
harpoon.ui:toggle_quick_menu(harpoon:list())
end, { desc = "Toggle quick menu for harpoon" })
keymap.set("n", "<leader>1", function()
harpoon:list():select(1)
end, { desc = "Go to first harpoon file" })
keymap.set("n", "<leader>2", function()
harpoon:list():select(2)
end, { desc = "Go to second harpoon file" })
keymap.set("n", "<leader>3", function()
harpoon:list():select(3)
end, { desc = "Go to third harpoon file" })
keymap.set("n", "<leader>4", function()
harpoon:list():select(4)
end, { desc = "Go to fourth harpoon file" })
keymap.set("n", "<C-S-P>", function()
harpoon:list():prev()
end)
keymap.set("n", "<C-S-N>", function()
harpoon:list():next()
end)
end,
} }

+ 2
- 2
.config/nvim/lua/plugins/init.lua View File

@ -1,4 +1,4 @@
return { return {
"nvim-lua/plenary.nvim",
"ray-x/guihua.lua",
"nvim-lua/plenary.nvim",
"ray-x/guihua.lua",
} }

+ 73
- 73
.config/nvim/lua/plugins/laravel.lua View File

@ -1,76 +1,76 @@
return { return {
"tovijaeschke/laravel.nvim",
-- enabled = false,
branch = "feature/discovery-check-improvements",
dependencies = {
"nvim-telescope/telescope.nvim",
"tpope/vim-dotenv",
"MunifTanjim/nui.nvim",
-- "nvimtools/none-ls.nvim",
},
cmd = { "Sail", "Artisan", "Composer", "Npm", "Yarn", "Laravel" },
keys = {
{ "<leader>la", ":Laravel artisan<cr>" },
{ "<leader>lr", ":Laravel routes<cr>" },
{ "<leader>lm", ":Laravel related<cr>" },
},
event = { "VeryLazy" },
config = function()
local laravel = require("laravel")
"tovijaeschke/laravel.nvim",
enabled = false,
branch = "feature/discovery-check-improvements",
dependencies = {
"nvim-telescope/telescope.nvim",
"tpope/vim-dotenv",
"MunifTanjim/nui.nvim",
-- "nvimtools/none-ls.nvim",
},
cmd = { "Sail", "Artisan", "Composer", "Npm", "Yarn", "Laravel" },
keys = {
{ "<leader>la", ":Laravel artisan<cr>" },
{ "<leader>lr", ":Laravel routes<cr>" },
{ "<leader>lm", ":Laravel related<cr>" },
},
event = { "VeryLazy" },
config = function()
local laravel = require("laravel")
laravel.setup({
lsp_server = "intelephense",
features = {
null_ls = {
enable = false,
},
},
environments = {
env_variable = "NVIM_LARAVEL_ENV",
auto_dicover = false,
default = "docker-compose",
definitions = {
{
name = "sail",
condition = {
file_exists = { "vendor/bin/sail", "docker-compose.yml" },
},
commands = {
sail = { "vendor/bin/sail" },
{
commands = { "php", "composer", "npm", "yarn" },
prefix = { "vendor/bin/sail" },
},
},
},
{
name = "docker-compose",
condition = {
file_exists = { "docker-compose.yml" },
executable = { "docker" },
},
commands = {
compose = { "docker", "compose" },
{
commands = { "php", "composer", "npm" },
docker = {
container = {
env = "APP_SERVICE",
default = "fpm",
},
exec = { "docker", "compose", "exec", "-it" },
},
},
},
},
{
name = "local",
condition = {
executable = { "php" },
},
},
}
}
})
end,
laravel.setup({
lsp_server = "intelephense",
features = {
null_ls = {
enable = false,
},
},
environments = {
env_variable = "NVIM_LARAVEL_ENV",
auto_dicover = false,
default = "docker-compose",
definitions = {
{
name = "sail",
condition = {
file_exists = { "vendor/bin/sail", "docker-compose.yml" },
},
commands = {
sail = { "vendor/bin/sail" },
{
commands = { "php", "composer", "npm", "yarn" },
prefix = { "vendor/bin/sail" },
},
},
},
{
name = "docker-compose",
condition = {
file_exists = { "docker-compose.yml" },
executable = { "docker" },
},
commands = {
compose = { "docker", "compose" },
{
commands = { "php", "composer", "npm" },
docker = {
container = {
env = "APP_SERVICE",
default = "fpm",
},
exec = { "docker", "compose", "exec", "-it" },
},
},
},
},
{
name = "local",
condition = {
executable = { "php" },
},
},
},
},
})
end,
} }

+ 74
- 74
.config/nvim/lua/plugins/linting.lua View File

@ -1,86 +1,86 @@
return { return {
"mfussenegger/nvim-lint",
event = { "BufReadPre", "BufNewFile" },
config = function()
local lint = require("lint")
"mfussenegger/nvim-lint",
event = { "BufReadPre", "BufNewFile" },
config = function()
local lint = require("lint")
local severities = {
ERROR = vim.diagnostic.severity.ERROR,
WARNING = vim.diagnostic.severity.WARN,
}
local severities = {
ERROR = vim.diagnostic.severity.ERROR,
WARNING = vim.diagnostic.severity.WARN,
}
lint.linters.phpcs = {
name = 'phpcs',
cmd = 'phpcs',
stdin = true,
args = {
'-q',
'--report=json',
'--standard=~/.config/phpcs.xml',
'-', -- need `-` at the end for stdin support
},
ignore_exitcode = true,
parser = function(output, _)
if vim.trim(output) == '' or output == nil then
return {}
end
lint.linters.phpcs = {
name = "phpcs",
cmd = "phpcs",
stdin = true,
args = {
"-q",
"--report=json",
"--standard=~/.config/phpcs.xml",
"-", -- need `-` at the end for stdin support
},
ignore_exitcode = true,
parser = function(output, _)
if vim.trim(output) == "" or output == nil then
return {}
end
if not vim.startswith(output, '{') then
vim.notify(output)
return {}
end
if not vim.startswith(output, "{") then
vim.notify(output)
return {}
end
local decoded = vim.json.decode(output)
local diagnostics = {}
local messages = decoded['files']['STDIN']['messages']
local decoded = vim.json.decode(output)
local diagnostics = {}
local messages = decoded["files"]["STDIN"]["messages"]
for _, msg in ipairs(messages or {}) do
table.insert(diagnostics, {
lnum = msg.line - 1,
end_lnum = msg.line - 1,
col = msg.column - 1,
end_col = msg.column - 1,
message = msg.message,
code = msg.source,
source = 'phpcs',
severity = assert(severities[msg.type], 'missing mapping for severity ' .. msg.type),
})
end
for _, msg in ipairs(messages or {}) do
table.insert(diagnostics, {
lnum = msg.line - 1,
end_lnum = msg.line - 1,
col = msg.column - 1,
end_col = msg.column - 1,
message = msg.message,
code = msg.source,
source = "phpcs",
severity = assert(severities[msg.type], "missing mapping for severity " .. msg.type),
})
end
return diagnostics
end
}
return diagnostics
end,
}
lint.linters_by_ft = {
javascript = { "eslint" },
typescript = { "eslint" },
vue = { "eslint" },
json = { "jsonlint" },
markdown = { "markdownlint" },
php = { "phpcs" },
golang = { "gospell", "golangci-lint" },
python = { "pylint" },
dockerfile = { "hadolint" },
blade = { "phpcs" },
}
lint.linters_by_ft = {
javascript = { "eslint" },
typescript = { "eslint" },
vue = { "eslint" },
json = { "jsonlint" },
markdown = { "markdownlint" },
php = { "phpcs" },
golang = { "gospell", "golangci-lint" },
python = { "pylint" },
dockerfile = { "hadolint" },
blade = { "phpcs" },
}
local lint_augroup = vim.api.nvim_create_augroup("lint", {
clear = true,
})
local lint_augroup = vim.api.nvim_create_augroup("lint", {
clear = true,
})
vim.api.nvim_create_autocmd({
"BufEnter",
"BufWritePost",
"InsertLeave",
}, {
group = lint_augroup,
callback = function()
lint.try_lint()
end,
})
vim.api.nvim_create_autocmd({
"BufEnter",
"BufWritePost",
"InsertLeave",
}, {
group = lint_augroup,
callback = function()
lint.try_lint()
end,
})
vim.keymap.set("n", "<leader>ll", function()
lint.try_lint()
end)
end,
vim.keymap.set("n", "<leader>ll", function()
lint.try_lint()
end)
end,
} }

+ 48
- 16
.config/nvim/lua/plugins/lspconfig.lua View File

@ -11,7 +11,6 @@ return {
{ "folke/neodev.nvim", opts = {} }, { "folke/neodev.nvim", opts = {} },
}, },
config = function() config = function()
-- import lspconfig plugin
local lspconfig = require("lspconfig") local lspconfig = require("lspconfig")
local util = require("lspconfig.util") local util = require("lspconfig.util")
@ -21,39 +20,38 @@ return {
group = vim.api.nvim_create_augroup("lsp-attach", { clear = true }), group = vim.api.nvim_create_augroup("lsp-attach", { clear = true }),
callback = function(event) callback = function(event)
local opts = { noremap = true, silent = true } local opts = { noremap = true, silent = true }
-- set keybinds
opts.desc = "Show LSP references" opts.desc = "Show LSP references"
keymap.set("n", "gr", "<cmd>Telescope lsp_references<CR>", opts) -- show definition, references
keymap.set("n", "gr", "<cmd>Telescope lsp_references<CR>", opts)
opts.desc = "Go to declaration" opts.desc = "Go to declaration"
keymap.set("n", "gD", vim.lsp.buf.declaration, opts) -- go to declaration
keymap.set("n", "gD", vim.lsp.buf.declaration, opts)
opts.desc = "Show LSP definitions" opts.desc = "Show LSP definitions"
keymap.set("n", "gd", "<cmd>Telescope lsp_definitions<CR>", opts) -- show lsp definitions
keymap.set("n", "gd", "<cmd>Telescope lsp_definitions<CR>", opts)
opts.desc = "Show LSP implementations" opts.desc = "Show LSP implementations"
keymap.set("n", "gi", "<cmd>Telescope lsp_implementations<CR>", opts) -- show lsp implementations
keymap.set("n", "gi", "<cmd>Telescope lsp_implementations<CR>", opts)
opts.desc = "Show LSP type definitions" opts.desc = "Show LSP type definitions"
keymap.set("n", "gt", "<cmd>Telescope lsp_type_definitions<CR>", opts) -- show lsp type definitions
keymap.set("n", "gt", "<cmd>Telescope lsp_type_definitions<CR>", opts)
opts.desc = "See available code actions" opts.desc = "See available code actions"
keymap.set({ "n", "v" }, "<leader>ca", vim.lsp.buf.code_action, opts) -- see available code actions, in visual mode will apply to selection
keymap.set({ "n", "v" }, "<leader>ca", vim.lsp.buf.code_action, opts)
opts.desc = "Smart rename" opts.desc = "Smart rename"
keymap.set("n", "<leader>rn", vim.lsp.buf.rename, opts) -- smart rename
keymap.set("n", "<leader>rn", vim.lsp.buf.rename, opts)
opts.desc = "Show buffer diagnostics" opts.desc = "Show buffer diagnostics"
keymap.set("n", "<leader>D", "<cmd>Telescope diagnostics bufnr=0<CR>", opts) -- show diagnostics for file
keymap.set("n", "<leader>D", "<cmd>Telescope diagnostics bufnr=0<CR>", opts)
opts.desc = "Show line diagnostics" opts.desc = "Show line diagnostics"
keymap.set("n", "<leader>d", vim.diagnostic.open_float, opts) -- show diagnostics for line
keymap.set("n", "<leader>d", vim.diagnostic.open_float, opts)
opts.desc = "Go to previous diagnostic" opts.desc = "Go to previous diagnostic"
keymap.set("n", "[d", vim.diagnostic.goto_prev, opts) -- jump to previous diagnostic in buffer
keymap.set("n", "[d", vim.diagnostic.goto_prev, opts)
opts.desc = "Go to next diagnostic" opts.desc = "Go to next diagnostic"
keymap.set("n", "]d", vim.diagnostic.goto_next, opts) -- jump to next diagnostic in buffer
keymap.set("n", "]d", vim.diagnostic.goto_next, opts)
opts.desc = "Go to previous diagnostic (error only)" opts.desc = "Go to previous diagnostic (error only)"
keymap.set("n", "[e", function() keymap.set("n", "[e", function()
@ -66,10 +64,10 @@ return {
end, opts) end, opts)
opts.desc = "Show documentation for what is under cursor" opts.desc = "Show documentation for what is under cursor"
keymap.set("n", "<leader>ld", vim.diagnostic.setqflist, opts) -- show documentation for what is under cursor
keymap.set("n", "<leader>ld", vim.diagnostic.setqflist, opts)
opts.desc = "Show documentation for what is under cursor" opts.desc = "Show documentation for what is under cursor"
keymap.set("n", "K", vim.lsp.buf.hover, opts) -- show documentation for what is under cursor
keymap.set("n", "K", vim.lsp.buf.hover, opts)
local client = vim.lsp.get_client_by_id(event.data.client_id) local client = vim.lsp.get_client_by_id(event.data.client_id)
if client and client.server_capabilities.documentHighlightProvider then if client and client.server_capabilities.documentHighlightProvider then
@ -134,8 +132,28 @@ return {
end end
end end
local path = util.path
local function get_python_path(workspace)
-- Use activated virtualenv.
if vim.env.VIRTUAL_ENV then
return path.join(vim.env.VIRTUAL_ENV, 'bin', 'python')
end
-- Find and use virtualenv in workspace directory.
for _, pattern in ipairs({'*', '.*'}) do
local match = vim.fn.glob(path.join(workspace, pattern, 'pyvenv.cfg'))
if match ~= '' then
return path.join(path.dirname(match), 'bin', 'python')
end
end
-- Fallback to system Python.
return exepath('python3') or exepath('python') or 'python'
end
local servers = { local servers = {
tsserver = {
ts_ls = {
init_options = { init_options = {
plugins = { plugins = {
{ {
@ -229,6 +247,20 @@ return {
enable = false, enable = false,
}, },
}, },
pyright = {
before_init = function(_, config)
config.settings.python.pythonpath = get_python_path(config.root_dir)
end
},
yamlls = {
settings = {
yaml = {
keyOrdering = false,
},
},
},
} }
require("mason").setup() require("mason").setup()


+ 84
- 85
.config/nvim/lua/plugins/nvim-cmp.lua View File

@ -1,90 +1,89 @@
return { return {
"hrsh7th/nvim-cmp",
event = "InsertEnter",
dependencies = {
-- Snippet Engine & its associated nvim-cmp source
{
"L3MON4D3/LuaSnip",
build = (function()
if vim.fn.has("win32") == 1 or vim.fn.executable("make") == 0 then
return
end
return "make install_jsregexp"
end)(),
dependencies = {
{
"rafamadriz/friendly-snippets",
config = function()
require("luasnip.loaders.from_vscode").lazy_load()
end,
},
},
},
"saadparwaiz1/cmp_luasnip",
"hrsh7th/nvim-cmp",
event = "InsertEnter",
dependencies = {
{
"L3MON4D3/LuaSnip",
build = (function()
if vim.fn.has("win32") == 1 or vim.fn.executable("make") == 0 then
return
end
return "make install_jsregexp"
end)(),
dependencies = {
{
"rafamadriz/friendly-snippets",
config = function()
require("luasnip.loaders.from_vscode").lazy_load()
end,
},
},
},
"saadparwaiz1/cmp_luasnip",
"onsails/lspkind.nvim",
"kristijanhusak/vim-dadbod-completion",
"onsails/lspkind.nvim",
"kristijanhusak/vim-dadbod-completion",
"hrsh7th/cmp-nvim-lsp",
"hrsh7th/cmp-buffer",
"hrsh7th/cmp-path",
"hrsh7th/cmp-nvim-lsp-signature-help",
},
config = function()
local cmp = require("cmp")
local luasnip = require("luasnip")
local lspkind = require("lspkind")
luasnip.config.setup({})
"hrsh7th/cmp-nvim-lsp",
"hrsh7th/cmp-buffer",
"hrsh7th/cmp-path",
"hrsh7th/cmp-nvim-lsp-signature-help",
},
config = function()
local cmp = require("cmp")
local luasnip = require("luasnip")
local lspkind = require("lspkind")
luasnip.config.setup({})
cmp.setup({
snippet = {
expand = function(args)
luasnip.lsp_expand(args.body)
end,
},
completion = {
completeopt = "menu,menuone,noinsert",
},
mapping = cmp.mapping.preset.insert({
["<C-n>"] = cmp.mapping.select_next_item(),
["<C-p>"] = cmp.mapping.select_prev_item(),
["<C-b>"] = cmp.mapping.scroll_docs(-4),
["<C-f>"] = cmp.mapping.scroll_docs(4),
["<C-y>"] = cmp.mapping.confirm({ select = true }),
["<C-Space>"] = cmp.mapping.complete({}),
["<C-l>"] = cmp.mapping(function()
if luasnip.expand_or_locally_jumpable() then
luasnip.expand_or_jump()
end
end, { "i", "s" }),
["<C-h>"] = cmp.mapping(function()
if luasnip.locally_jumpable(-1) then
luasnip.jump(-1)
end
end, { "i", "s" }),
}),
sources = {
{ name = "nvim_lsp" },
{ name = "luasnip" },
{ name = "buffer" },
{ name = "path" },
{ name = "vim-dadbod-completion" },
},
formatting = {
expandable_indicator = true,
fields = { "abbr", "kind", "menu" },
format = lspkind.cmp_format({
mode = "symbol_text",
menu = {
nvim_lua = "[API]",
nvim_lsp = "[LSP]",
luasnip = "[SNIP]",
vim_dadbod_completion = "[DBUI]",
path = "[PATH]",
buffer = "[BUFF]",
},
}),
},
})
end,
cmp.setup({
snippet = {
expand = function(args)
luasnip.lsp_expand(args.body)
end,
},
completion = {
completeopt = "menu,menuone,noinsert",
},
mapping = cmp.mapping.preset.insert({
["<C-n>"] = cmp.mapping.select_next_item(),
["<C-p>"] = cmp.mapping.select_prev_item(),
["<C-b>"] = cmp.mapping.scroll_docs(-4),
["<C-f>"] = cmp.mapping.scroll_docs(4),
["<C-y>"] = cmp.mapping.confirm({ select = true }),
["<C-Space>"] = cmp.mapping.complete({}),
["<C-l>"] = cmp.mapping(function()
if luasnip.expand_or_locally_jumpable() then
luasnip.expand_or_jump()
end
end, { "i", "s" }),
["<C-h>"] = cmp.mapping(function()
if luasnip.locally_jumpable(-1) then
luasnip.jump(-1)
end
end, { "i", "s" }),
}),
sources = {
{ name = "nvim_lsp" },
{ name = "luasnip" },
{ name = "buffer" },
{ name = "path" },
{ name = "vim-dadbod-completion" },
},
formatting = {
expandable_indicator = true,
fields = { "abbr", "kind", "menu" },
format = lspkind.cmp_format({
mode = "symbol_text",
menu = {
nvim_lua = "[API]",
nvim_lsp = "[LSP]",
luasnip = "[SNIP]",
vim_dadbod_completion = "[DBUI]",
path = "[PATH]",
buffer = "[BUFF]",
},
}),
},
})
end,
} }

+ 1
- 1
.config/nvim/lua/plugins/nvim-go.lua View File

@ -1,6 +1,6 @@
return { return {
"ray-x/go.nvim", "ray-x/go.nvim",
dependencies = { -- optional packages
dependencies = {
"ray-x/guihua.lua", "ray-x/guihua.lua",
"neovim/nvim-lspconfig", "neovim/nvim-lspconfig",
"nvim-treesitter/nvim-treesitter", "nvim-treesitter/nvim-treesitter",


+ 114
- 114
.config/nvim/lua/plugins/nvim-treesitter.lua View File

@ -1,120 +1,120 @@
return { return {
{
"nvim-treesitter/nvim-treesitter",
event = { "BufReadPre", "BufNewFile" },
build = ":TSUpdate",
dependencies = {
{ "nvim-treesitter/nvim-treesitter-textobjects" },
},
config = function()
-- import nvim-treesitter plugin
local treesitter = require("nvim-treesitter.configs")
{
"nvim-treesitter/nvim-treesitter",
event = { "BufReadPre", "BufNewFile" },
build = ":TSUpdate",
dependencies = {
{ "nvim-treesitter/nvim-treesitter-textobjects" },
},
config = function()
-- import nvim-treesitter plugin
local treesitter = require("nvim-treesitter.configs")
-- configure treesitter
treesitter.setup({
-- ensure these language parsers are installed
ensure_installed = {
"json",
"javascript",
"typescript",
"tsx",
"yaml",
"html",
"css",
"prisma",
"markdown",
"markdown_inline",
"svelte",
"graphql",
"bash",
"lua",
"vim",
"dockerfile",
"gitignore",
"php",
"latex",
},
ignore_install = {},
modules = {},
sync_install = true,
auto_install = true,
highlight = {
enable = true,
disable = { "latex" }
},
indent = { enable = true },
autotag = { enable = true },
textobjects = {
select = {
enable = true,
lookahead = true,
keymaps = {
["af"] = "@function.outer",
["if"] = "@function.inner",
["ac"] = "@conditional.outer",
["ic"] = "@conditional.inner",
["al"] = "@loop.outer",
["il"] = "@loop.inner",
},
selection_modes = {
['@parameter.outer'] = 'v', -- charwise
['@function.outer'] = 'V', -- linewise
['@class.outer'] = '<c-v>', -- blockwise
},
include_surrounding_whitespace = false,
},
move = {
enable = true,
set_jumps = true,
goto_next_start = {
["]f"] = "@function.outer",
["]c"] = "@conditional.outer",
["]o"] = "@loop.outer",
},
goto_next_end = {
["]F"] = "@function.outer",
["]C"] = "@conditional.outer",
["]O"] = "@loop.outer",
},
goto_previous_start = {
["[f"] = "@function.outer",
["[c"] = "@conditional.outer",
["[o"] = "@loop.outer",
},
goto_previous_end = {
["[F"] = "@function.outer",
["[C"] = "@conditional.outer",
["[O"] = "@loop.outer",
},
goto_next = {
["]b"] = "@block.outer",
},
goto_previous = {
["[b"] = "@block.outer",
}
},
},
})
-- configure treesitter
treesitter.setup({
-- ensure these language parsers are installed
ensure_installed = {
"json",
"javascript",
"typescript",
"tsx",
"yaml",
"html",
"css",
"prisma",
"markdown",
"markdown_inline",
"svelte",
"graphql",
"bash",
"lua",
"vim",
"dockerfile",
"gitignore",
"php",
"latex",
},
ignore_install = {},
modules = {},
sync_install = true,
auto_install = true,
highlight = {
enable = true,
disable = { "latex" },
},
indent = { enable = true },
autotag = { enable = true },
textobjects = {
select = {
enable = true,
lookahead = true,
keymaps = {
["af"] = "@function.outer",
["if"] = "@function.inner",
["ac"] = "@conditional.outer",
["ic"] = "@conditional.inner",
["al"] = "@loop.outer",
["il"] = "@loop.inner",
},
selection_modes = {
["@parameter.outer"] = "v", -- charwise
["@function.outer"] = "V", -- linewise
["@class.outer"] = "<c-v>", -- blockwise
},
include_surrounding_whitespace = false,
},
move = {
enable = true,
set_jumps = true,
goto_next_start = {
["]f"] = "@function.outer",
["]c"] = "@conditional.outer",
["]o"] = "@loop.outer",
},
goto_next_end = {
["]F"] = "@function.outer",
["]C"] = "@conditional.outer",
["]O"] = "@loop.outer",
},
goto_previous_start = {
["[f"] = "@function.outer",
["[c"] = "@conditional.outer",
["[o"] = "@loop.outer",
},
goto_previous_end = {
["[F"] = "@function.outer",
["[C"] = "@conditional.outer",
["[O"] = "@loop.outer",
},
goto_next = {
["]b"] = "@block.outer",
},
goto_previous = {
["[b"] = "@block.outer",
},
},
},
})
---@class ParserConfig
---@field install_info table
---@field filetype string
local parser_config = require("nvim-treesitter.parsers").get_parser_configs()
---@class ParserConfig
---@field install_info table
---@field filetype string
local parser_config = require("nvim-treesitter.parsers").get_parser_configs()
parser_config.blade = {
install_info = {
url = "https://github.com/EmranMR/tree-sitter-blade",
files = { "src/parser.c" },
branch = "main",
},
filetype = "blade",
}
parser_config.blade = {
install_info = {
url = "https://github.com/EmranMR/tree-sitter-blade",
files = { "src/parser.c" },
branch = "main",
},
filetype = "blade",
}
vim.filetype.add({
pattern = {
[".*%.blade%.php"] = "blade",
},
})
end,
},
vim.filetype.add({
pattern = {
[".*%.blade%.php"] = "blade",
},
})
end,
},
} }

+ 3
- 3
.config/nvim/lua/plugins/nvim-ts-context-commentstring.lua View File

@ -1,5 +1,5 @@
return { return {
'JoosepAlviste/nvim-ts-context-commentstring',
event = { 'BufRead', 'BufNewFile' },
config = true,
"JoosepAlviste/nvim-ts-context-commentstring",
event = { "BufRead", "BufNewFile" },
config = true,
} }

+ 87
- 87
.config/nvim/lua/plugins/oil.lua View File

@ -1,90 +1,90 @@
return { return {
"stevearc/oil.nvim",
opts = {},
commit = '18272aba9d00a3176a5443d50dbb4464acc167bd',
-- Optional dependencies
dependencies = { "nvim-tree/nvim-web-devicons" },
config = function()
require("oil").setup({
default_file_explorer = true,
buf_options = {
buflisted = false,
bufhidden = "hide",
},
win_options = {
wrap = false,
signcolumn = "no",
cursorcolumn = false,
foldcolumn = "0",
spell = false,
list = false,
conceallevel = 3,
concealcursor = "nvic",
},
delete_to_trash = false,
skip_confirm_for_simple_edits = false,
prompt_save_on_select_new_entry = true,
cleanup_delay_ms = 2000,
keymaps = {
["g?"] = "actions.show_help",
["<CR>"] = "actions.select",
["<C-s>"] = "actions.select_vsplit",
["<C-h>"] = false,
["<C-t>"] = "actions.select_tab",
["<C-v>"] = "actions.preview",
["<C-c>"] = "actions.close",
["<C-l>"] = false,
["-"] = "actions.parent",
["_"] = "actions.open_cwd",
["`"] = "actions.cd",
["~"] = "actions.tcd",
["gs"] = "actions.change_sort",
["gx"] = "actions.open_external",
["g."] = "actions.toggle_hidden",
},
use_default_keymaps = false,
view_options = {
show_hidden = true,
is_hidden_file = function(name, _)
return vim.startswith(name, ".")
end,
is_always_hidden = function(_, _)
return false
end,
sort = {
{ "type", "asc" },
{ "name", "asc" },
},
},
preview = {
max_width = 0.9,
min_width = { 40, 0.4 },
width = nil,
max_height = 0.9,
min_height = { 5, 0.1 },
height = nil,
border = "rounded",
win_options = {
winblend = 0,
},
},
progress = {
max_width = 0.9,
min_width = { 40, 0.4 },
width = nil,
max_height = { 10, 0.9 },
min_height = { 5, 0.1 },
height = nil,
border = "rounded",
minimized_border = "none",
win_options = {
winblend = 0,
},
},
})
"stevearc/oil.nvim",
opts = {},
commit = "18272aba9d00a3176a5443d50dbb4464acc167bd",
-- Optional dependencies
dependencies = { "nvim-tree/nvim-web-devicons" },
config = function()
require("oil").setup({
default_file_explorer = true,
buf_options = {
buflisted = false,
bufhidden = "hide",
},
win_options = {
wrap = false,
signcolumn = "no",
cursorcolumn = false,
foldcolumn = "0",
spell = false,
list = false,
conceallevel = 3,
concealcursor = "nvic",
},
delete_to_trash = false,
skip_confirm_for_simple_edits = false,
prompt_save_on_select_new_entry = true,
cleanup_delay_ms = 2000,
keymaps = {
["g?"] = "actions.show_help",
["<CR>"] = "actions.select",
["<C-s>"] = "actions.select_vsplit",
["<C-h>"] = false,
["<C-t>"] = "actions.select_tab",
["<C-v>"] = "actions.preview",
["<C-c>"] = "actions.close",
["<C-l>"] = false,
["-"] = "actions.parent",
["_"] = "actions.open_cwd",
["`"] = "actions.cd",
["~"] = "actions.tcd",
["gs"] = "actions.change_sort",
["gx"] = "actions.open_external",
["g."] = "actions.toggle_hidden",
},
use_default_keymaps = false,
view_options = {
show_hidden = true,
is_hidden_file = function(name, _)
return vim.startswith(name, ".")
end,
is_always_hidden = function(_, _)
return false
end,
sort = {
{ "type", "asc" },
{ "name", "asc" },
},
},
preview = {
max_width = 0.9,
min_width = { 40, 0.4 },
width = nil,
max_height = 0.9,
min_height = { 5, 0.1 },
height = nil,
border = "rounded",
win_options = {
winblend = 0,
},
},
progress = {
max_width = 0.9,
min_width = { 40, 0.4 },
width = nil,
max_height = { 10, 0.9 },
min_height = { 5, 0.1 },
height = nil,
border = "rounded",
minimized_border = "none",
win_options = {
winblend = 0,
},
},
})
vim.keymap.set("n", "-", function()
vim.cmd("Oil")
end, { desc = "Open parent directory" })
end,
vim.keymap.set("n", "-", function()
vim.cmd("Oil")
end, { desc = "Open parent directory" })
end,
} }

+ 10
- 0
.config/nvim/lua/plugins/refactoring.lua View File

@ -0,0 +1,10 @@
return {
"ThePrimeagen/refactoring.nvim",
dependencies = {
"nvim-lua/plenary.nvim",
"nvim-treesitter/nvim-treesitter",
},
config = function()
require("refactoring").setup()
end,
}

+ 6
- 6
.config/nvim/lua/plugins/scissors.lua View File

@ -1,8 +1,8 @@
return { return {
"chrisgrieser/nvim-scissors",
event = "VeryLazy",
dependencies = "nvim-telescope/telescope.nvim",
opts = {
snippetDir = "~/.config/nvim/snippets",
}
"chrisgrieser/nvim-scissors",
event = "VeryLazy",
dependencies = "nvim-telescope/telescope.nvim",
opts = {
snippetDir = "~/.config/nvim/snippets",
},
} }

+ 182
- 179
.config/nvim/lua/plugins/telescope.lua View File

@ -1,181 +1,184 @@
return { return {
"nvim-telescope/telescope.nvim",
dependencies = {
"nvim-lua/plenary.nvim",
{ "nvim-telescope/telescope-fzf-native.nvim", build = "make" },
"nvim-tree/nvim-web-devicons",
"debugloop/telescope-undo.nvim",
"nvim-telescope/telescope-ui-select.nvim",
},
config = function()
local telescope = require("telescope")
local actions = require("telescope.actions")
local previewers = require("telescope.previewers")
local previewers_utils = require("telescope.previewers.utils")
local sorters = require("telescope.sorters")
local builtin = require("telescope.builtin")
local max_size = 100000
local truncate_large_files = function(filepath, bufnr, opts)
opts = opts or {}
filepath = vim.fn.expand(filepath)
---@diagnostic disable-next-line: undefined-field
vim.loop.fs_stat(filepath, function(_, stat)
if not stat then
return
end
if stat.size > max_size then
local cmd = { "head", "-c", max_size, filepath }
previewers_utils.job_maker(cmd, bufnr, opts)
else
previewers.buffer_previewer_maker(filepath, bufnr, opts)
end
end)
end
telescope.setup({
defaults = {
file_sorter = sorters.get_fzy_sorter,
color_devicons = true,
buffer_previewer_maker = truncate_large_files,
initial_mode = "insert",
selection_strategy = "reset",
sorting_strategy = "ascending",
layout_strategy = "horizontal",
layout_config = {
horizontal = {
prompt_position = "top",
preview_width = 0.55,
results_width = 0.8,
},
vertical = {
mirror = false,
},
width = 0.87,
height = 0.80,
preview_cutoff = 120,
},
path_display = { "truncate" },
winblend = 0,
border = {},
borderchars = nil,
mappings = {
i = {
["<C-n>"] = actions.move_selection_next,
["<C-p>"] = actions.move_selection_previous,
["<C-j>"] = actions.cycle_history_next,
["<C-k>"] = actions.cycle_history_prev,
["<C-q>"] = actions.smart_send_to_qflist + actions.open_qflist,
},
},
},
extensions = {
undo = {
side_by_side = true,
mappings = {
i = {
["<CR>"] = require("telescope-undo.actions").restore,
},
n = {
["<CR>"] = require("telescope-undo.actions").restore,
["y"] = require("telescope-undo.actions").yank_additions,
["Y"] = require("telescope-undo.actions").yank_deletions,
["u"] = require("telescope-undo.actions").restore,
},
},
},
["ui-select"] = {
require("telescope.themes").get_dropdown({}),
},
},
})
telescope.load_extension("fzf")
telescope.load_extension("undo")
telescope.load_extension("ui-select")
-- We cache the results of "git rev-parse"
-- Process creation is expensive in Windows, so this reduces latency
local is_inside_work_tree = {}
local project_files = function()
local cwd = vim.fn.getcwd()
if is_inside_work_tree[cwd] == nil then
vim.fn.system("git rev-parse --is-inside-work-tree")
is_inside_work_tree[cwd] = vim.v.shell_error == 0
end
if is_inside_work_tree[cwd] then
builtin.git_files({ show_untracked = true, hidden = true })
else
builtin.find_files({})
end
end
-- set keymaps
local keymap = vim.keymap
keymap.set("n", "<C-g>", function()
builtin.live_grep({ hidden = true })
end, {})
keymap.set("n", "<leader>ff", function()
builtin.live_grep({ hidden = true })
end, {})
keymap.set("n", "<C-p>", project_files, {})
keymap.set("n", "<leader>p", project_files, {})
keymap.set("n", "<leader>fr", builtin.resume, {})
keymap.set("n", "<leader>fb", builtin.buffers, {})
keymap.set("n", "<leader>fo", builtin.oldfiles, {})
keymap.set("n", "<leader>m", builtin.marks, {})
keymap.set("n", "<leader>cc", builtin.commands, {})
keymap.set("n", "<leader>ch", builtin.command_history, {})
keymap.set("n", "<leader>gb", function()
builtin.git_branches({
attach_mappings = function(_, map)
map("i", "<c-d>", actions.git_delete_branch)
map("n", "<c-d>", actions.git_delete_branch)
return true
end,
})
end, {})
keymap.set("n", "<leader>gc", builtin.git_commits, {})
keymap.set("n", "<leader>vh", builtin.help_tags, {})
keymap.set("n", "<leader>ds", builtin.lsp_document_symbols, {})
keymap.set("n", "<leader>ws", builtin.lsp_workspace_symbols, {})
keymap.set("n", "<leader>dws", builtin.lsp_dynamic_workspace_symbols, {})
keymap.set("n", "<leader>gf", function()
builtin.grep_string({
search = vim.fn.expand("<cword>"),
})
end)
keymap.set("n", "<leader>gF", function()
builtin.grep_string({
search = vim.fn.expand("<cWORD>"),
})
end)
keymap.set("n", "<leader>gD", function()
builtin.find_files({
search_file = vim.fn.expand("<cword>"),
})
end)
vim.keymap.set("n", "<leader>u", "<cmd>Telescope undo<cr>")
end,
"nvim-telescope/telescope.nvim",
dependencies = {
"nvim-lua/plenary.nvim",
{ "nvim-telescope/telescope-fzf-native.nvim", build = "make" },
"nvim-tree/nvim-web-devicons",
"debugloop/telescope-undo.nvim",
"nvim-telescope/telescope-ui-select.nvim",
},
config = function()
local telescope = require("telescope")
local actions = require("telescope.actions")
local previewers = require("telescope.previewers")
local previewers_utils = require("telescope.previewers.utils")
local sorters = require("telescope.sorters")
local builtin = require("telescope.builtin")
local max_size = 100000
local truncate_large_files = function(filepath, bufnr, opts)
opts = opts or {}
filepath = vim.fn.expand(filepath)
---@diagnostic disable-next-line: undefined-field
vim.loop.fs_stat(filepath, function(_, stat)
if not stat then
return
end
if stat.size > max_size then
local cmd = { "head", "-c", max_size, filepath }
previewers_utils.job_maker(cmd, bufnr, opts)
else
previewers.buffer_previewer_maker(filepath, bufnr, opts)
end
end)
end
telescope.setup({
defaults = {
file_sorter = sorters.get_fzy_sorter,
color_devicons = true,
buffer_previewer_maker = truncate_large_files,
initial_mode = "insert",
selection_strategy = "reset",
sorting_strategy = "ascending",
layout_strategy = "horizontal",
layout_config = {
horizontal = {
prompt_position = "top",
preview_width = 0.55,
results_width = 0.8,
},
vertical = {
mirror = false,
},
width = 0.87,
height = 0.80,
preview_cutoff = 120,
},
path_display = { "truncate" },
winblend = 0,
border = {},
borderchars = nil,
mappings = {
i = {
["<C-n>"] = actions.move_selection_next,
["<C-p>"] = actions.move_selection_previous,
["<C-j>"] = actions.cycle_history_next,
["<C-k>"] = actions.cycle_history_prev,
["<C-q>"] = actions.smart_send_to_qflist + actions.open_qflist,
},
},
},
pickers = {
diagnostics = {
theme = "ivy",
initial_mode = "normal",
layout_config = {
preview_cutoff = 9999,
},
},
},
extensions = {
undo = {
side_by_side = true,
mappings = {
i = {
["<CR>"] = require("telescope-undo.actions").restore,
},
n = {
["<CR>"] = require("telescope-undo.actions").restore,
["y"] = require("telescope-undo.actions").yank_additions,
["Y"] = require("telescope-undo.actions").yank_deletions,
["u"] = require("telescope-undo.actions").restore,
},
},
},
["ui-select"] = {
require("telescope.themes").get_dropdown({}),
},
},
})
telescope.load_extension("fzf")
telescope.load_extension("undo")
telescope.load_extension("ui-select")
-- We cache the results of "git rev-parse"
-- Process creation is expensive in Windows, so this reduces latency
local is_inside_work_tree = {}
local project_files = function()
local cwd = vim.fn.getcwd()
if is_inside_work_tree[cwd] == nil then
vim.fn.system("git rev-parse --is-inside-work-tree")
is_inside_work_tree[cwd] = vim.v.shell_error == 0
end
if is_inside_work_tree[cwd] then
builtin.git_files({ show_untracked = true, hidden = true })
else
builtin.find_files({})
end
end
-- set keymaps
local keymap = vim.keymap
keymap.set("n", "<leader>ff", function()
builtin.live_grep({ hidden = true })
end, {})
keymap.set("n", "<leader>p", project_files, {})
keymap.set("n", "<leader>fr", builtin.resume, {})
keymap.set("n", "<leader>fb", builtin.buffers, {})
keymap.set("n", "<leader>fo", builtin.oldfiles, {})
keymap.set("n", "<leader>m", builtin.marks, {})
keymap.set("n", "<leader>cc", builtin.commands, {})
keymap.set("n", "<leader>ch", builtin.command_history, {})
keymap.set("n", "<leader>gb", function()
builtin.git_branches({
attach_mappings = function(_, map)
map("i", "<c-d>", actions.git_delete_branch)
map("n", "<c-d>", actions.git_delete_branch)
return true
end,
})
end, {})
keymap.set("n", "<leader>gc", builtin.git_commits, {})
keymap.set("n", "<leader>vh", builtin.help_tags, {})
keymap.set("n", "<leader>ds", builtin.lsp_document_symbols, {})
keymap.set("n", "<leader>ws", builtin.lsp_workspace_symbols, {})
keymap.set("n", "<leader>dws", builtin.lsp_dynamic_workspace_symbols, {})
keymap.set("n", "<leader>gf", function()
builtin.grep_string({
search = vim.fn.expand("<cword>"),
})
end)
keymap.set("n", "<leader>gF", function()
builtin.grep_string({
search = vim.fn.expand("<cWORD>"),
})
end)
keymap.set("n", "<leader>gD", function()
builtin.find_files({
search_file = vim.fn.expand("<cword>"),
})
end)
vim.keymap.set("n", "<leader>u", "<cmd>Telescope undo<cr>")
end,
} }

+ 17
- 17
.config/nvim/lua/plugins/tmux.lua View File

@ -1,19 +1,19 @@
return { return {
"aserowy/tmux.nvim",
config = function()
require("tmux").setup({
copy_sync = {
enable = false
},
navigation = {
cycle_navigation = true,
enable_default_keybindings = true,
persist_zoom = true,
},
resize = {
-- enables default keybindings (A-hjkl) for normal mode
enable_default_keybindings = false,
},
})
end
"aserowy/tmux.nvim",
config = function()
require("tmux").setup({
copy_sync = {
enable = false,
},
navigation = {
cycle_navigation = true,
enable_default_keybindings = true,
persist_zoom = true,
},
resize = {
-- enables default keybindings (A-hjkl) for normal mode
enable_default_keybindings = false,
},
})
end,
} }

+ 11
- 11
.config/nvim/lua/plugins/todo-comments.lua View File

@ -1,15 +1,15 @@
return { return {
"folke/todo-comments.nvim",
dependencies = { "nvim-lua/plenary.nvim" },
config = function()
require('todo-comments').setup()
"folke/todo-comments.nvim",
dependencies = { "nvim-lua/plenary.nvim" },
config = function()
require("todo-comments").setup()
vim.keymap.set('n', '<leader>tt', function()
vim.cmd('TodoTelescope')
end, {})
vim.keymap.set("n", "<leader>tt", function()
vim.cmd("TodoTelescope")
end, {})
vim.keymap.set('n', '<leader>tq', function()
vim.cmd('TodoQuickFix')
end, {})
end
vim.keymap.set("n", "<leader>tq", function()
vim.cmd("TodoQuickFix")
end, {})
end,
} }

+ 43
- 33
.config/nvim/lua/plugins/trouble.lua View File

@ -1,37 +1,47 @@
return { return {
"folke/trouble.nvim",
opts = {},
cmd = "Trouble",
keys = {
"folke/trouble.nvim",
opts = {},
cmd = "Trouble",
keys = {
{
"<leader>xx",
"<cmd>Trouble diagnostics toggle<cr>",
desc = "Diagnostics (Trouble)",
},
{
"<leader>xX",
"<cmd>Trouble diagnostics toggle filter.buf=0<cr>",
desc = "Buffer Diagnostics (Trouble)",
},
{ {
"<leader>xx",
"<cmd>Trouble diagnostics toggle<cr>",
desc = "Diagnostics (Trouble)",
},
"<leader>xj",
"<cmd>Trouble diagnostics next<cr>",
desc = "Diagnostics Next (Trouble)",
},
{ {
"<leader>xX",
"<cmd>Trouble diagnostics toggle filter.buf=0<cr>",
desc = "Buffer Diagnostics (Trouble)",
},
{
"<leader>cs",
"<cmd>Trouble symbols toggle focus=false<cr>",
desc = "Symbols (Trouble)",
},
{
"<leader>cl",
"<cmd>Trouble lsp toggle focus=false win.position=right<cr>",
desc = "LSP Definitions / references / ... (Trouble)",
},
{
"<leader>xL",
"<cmd>Trouble loclist toggle<cr>",
desc = "Location List (Trouble)",
},
{
"<leader>xQ",
"<cmd>Trouble qflist toggle<cr>",
desc = "Quickfix List (Trouble)",
},
},
"<leader>xk",
"<cmd>Trouble diagnostics prev<cr>",
desc = "Diagnostics Previous (Trouble)",
},
{
"<leader>cs",
"<cmd>Trouble symbols toggle focus=false<cr>",
desc = "Symbols (Trouble)",
},
{
"<leader>cl",
"<cmd>Trouble lsp toggle focus=false win.position=right<cr>",
desc = "LSP Definitions / references / ... (Trouble)",
},
{
"<leader>xL",
"<cmd>Trouble loclist toggle<cr>",
desc = "Location List (Trouble)",
},
{
"<leader>xQ",
"<cmd>Trouble qflist toggle<cr>",
desc = "Quickfix List (Trouble)",
},
},
} }

+ 9
- 9
.config/nvim/lua/plugins/undotree.lua View File

@ -1,17 +1,17 @@
return { return {
"mbbill/undotree", "mbbill/undotree",
config = function() config = function()
if vim.fn.has("persistent_undo") == 0 then
return
end
if vim.fn.has("persistent_undo") == 0 then
return
end
local target_path = vim.fn.expand("~/.cache/nvim/undodir/")
local target_path = vim.fn.expand("~/.cache/nvim/undodir/")
if vim.fn.isdirectory(target_path) == 0 then
vim.fn.mkdir(target_path, "p", 0700)
end
if vim.fn.isdirectory(target_path) == 0 then
vim.fn.mkdir(target_path, "p", 0700)
end
vim.opt.undodir = target_path
vim.opt.undofile = true
vim.opt.undodir = target_path
vim.opt.undofile = true
end, end,
} }

+ 21
- 21
.config/nvim/lua/plugins/vim-dadbod.lua View File

@ -1,23 +1,23 @@
return { return {
'kristijanhusak/vim-dadbod-ui',
dependencies = {
{
'tpope/vim-dadbod',
lazy = true,
},
{
'kristijanhusak/vim-dadbod-completion',
ft = { 'sql', 'mysql', 'plsql' },
lazy = true,
},
},
cmd = {
'DBUI',
'DBUIToggle',
'DBUIAddConnection',
'DBUIFindBuffer',
},
init = function()
vim.g.db_ui_use_nerd_fonts = 1
end,
"kristijanhusak/vim-dadbod-ui",
dependencies = {
{
"tpope/vim-dadbod",
lazy = true,
},
{
"kristijanhusak/vim-dadbod-completion",
ft = { "sql", "mysql", "plsql" },
lazy = true,
},
},
cmd = {
"DBUI",
"DBUIToggle",
"DBUIAddConnection",
"DBUIFindBuffer",
},
init = function()
vim.g.db_ui_use_nerd_fonts = 1
end,
} }

+ 1
- 1
.zshrc View File

@ -21,7 +21,7 @@ export EDITOR=nvim
export GIT_EDITOR=nvim export GIT_EDITOR=nvim
export PATH="${HOME}/.local/bin/:${HOME}/go/bin:${HOME}/.cargo/bin:${PATH}" export PATH="${HOME}/.local/bin/:${HOME}/go/bin:${HOME}/.cargo/bin:${PATH}"
export DOCKER_DEFAULT_PLATFORM=linux/amd64
# export DOCKER_DEFAULT_PLATFORM=linux/amd64
# Enable substitution in the prompt. # Enable substitution in the prompt.
setopt prompt_subst setopt prompt_subst


Loading…
Cancel
Save