style(nvim): run stylua

This commit is contained in:
Oliver Davies 2023-09-04 11:05:13 +01:00
parent 62765d25aa
commit 3614d71a2c
17 changed files with 86 additions and 64 deletions

View file

@ -3,19 +3,19 @@ if not status_ok then
return return
end end
catppuccin.setup({ catppuccin.setup {
flavour = "macchiato", flavour = "macchiato",
integrations = { integrations = {
cmp = true, cmp = true,
gitsigns = true, gitsigns = true,
native_lsp = { native_lsp = {
enabled = true; enabled = true,
}, },
telescope = true, telescope = true,
treesitter = true, treesitter = true,
}, },
term_colors = true, term_colors = true,
transparent_background = true, transparent_background = true,
}) }
vim.cmd.colorscheme "catppuccin" vim.cmd.colorscheme "catppuccin"

View file

@ -11,7 +11,7 @@ end
dap.adapters.php = { dap.adapters.php = {
type = "executable", type = "executable",
command = "node", command = "node",
args = { os.getenv("HOME") .. "/build/vscode-php-debug/out/phpDebug.js" } args = { os.getenv "HOME" .. "/build/vscode-php-debug/out/phpDebug.js" },
} }
dap.configurations.php = { dap.configurations.php = {
@ -21,9 +21,9 @@ dap.configurations.php = {
name = "Listen for Xdebug", name = "Listen for Xdebug",
port = 9003, port = 9003,
pathMappings = { pathMappings = {
["/var/www/html"] = "${workspaceFolder}" ["/var/www/html"] = "${workspaceFolder}",
} },
} },
} }
dap.listeners.after.event_initialized["dapui_config"] = function() dap.listeners.after.event_initialized["dapui_config"] = function()
@ -38,7 +38,7 @@ dap.listeners.before.event_exited["dapui_config"] = function()
dapui.close() dapui.close()
end end
require "dapui".setup { require("dapui").setup {
layouts = { layouts = {
{ {
elements = { elements = {
@ -58,14 +58,14 @@ require "dapui".setup {
size = 0.25, -- 25% of total lines size = 0.25, -- 25% of total lines
position = "bottom", position = "bottom",
}, },
} },
} }
require "nvim-dap-virtual-text".setup { require("nvim-dap-virtual-text").setup {
commented = true, commented = true,
} }
local nmap = require "opdavies.keymap".nmap local nmap = require("opdavies.keymap").nmap
nmap { "<F12>", ":lua require'dap'.step_over()<cr>" } nmap { "<F12>", ":lua require'dap'.step_over()<cr>" }
nmap { "<F2>", ":lua require'dap'.step_into()<cr>" } nmap { "<F2>", ":lua require'dap'.step_into()<cr>" }

View file

@ -37,16 +37,16 @@ dial_config.augends:register_group {
augend.constant.alias.bool, -- boolean value (true <-> false) augend.constant.alias.bool, -- boolean value (true <-> false)
augend.integer.alias.decimal, augend.integer.alias.decimal,
augend.integer.alias.hex, augend.integer.alias.hex,
augend.semver.alias.semver augend.semver.alias.semver,
}, },
} }
local dial_map = require "dial.map" local dial_map = require "dial.map"
local nmap = require "opdavies.keymap".nmap local nmap = require("opdavies.keymap").nmap
local vmap = require "opdavies.keymap".vmap local vmap = require("opdavies.keymap").vmap
nmap({ "<C-a>", dial_map.inc_normal "mygroup" }) nmap { "<C-a>", dial_map.inc_normal "mygroup" }
nmap({ "<C-x>", dial_map.dec_normal "mygroup" }) nmap { "<C-x>", dial_map.dec_normal "mygroup" }
vmap({ "<C-a>", dial_map.inc_normal "visual" }) vmap { "<C-a>", dial_map.inc_normal "visual" }
vmap({ "<C-x>", dial_map.dec_normal "visual" }) vmap { "<C-x>", dial_map.dec_normal "visual" }

View file

@ -12,11 +12,11 @@ vim.api.nvim_create_autocmd("BufWinEnter", {
local opts = { buffer = bufnr, remap = false } local opts = { buffer = bufnr, remap = false }
vim.keymap.set("n", "<leader>p", function() vim.keymap.set("n", "<leader>p", function()
vim.cmd.Git('push') vim.cmd.Git "push"
end, opts) end, opts)
vim.keymap.set("n", "<leader>P", function() vim.keymap.set("n", "<leader>P", function()
vim.cmd.Git({'pull', '--rebase'}) vim.cmd.Git { "pull", "--rebase" }
end, opts) end, opts)
end, end,
}) })

View file

@ -10,21 +10,31 @@ gitsigns.setup {
local bufnr = vim.api.nvim_get_current_buf() local bufnr = vim.api.nvim_get_current_buf()
local map = require "opdavies.keymap".map local map = require("opdavies.keymap").map
local nmap = require "opdavies.keymap".nmap local nmap = require("opdavies.keymap").nmap
local vmap = require "opdavies.keymap".vmap local vmap = require("opdavies.keymap").vmap
nmap { '[h', "&diff ? '[c' : '<cmd>Gitsigns prev_hunk<CR>'", { expr = true, buffer = bufnr }} nmap { "[h", "&diff ? '[c' : '<cmd>Gitsigns prev_hunk<CR>'", { expr = true, buffer = bufnr } }
nmap { ']h', "&diff ? ']c' : '<cmd>Gitsigns next_hunk<CR>'", { expr = true, buffer = bufnr }} nmap { "]h", "&diff ? ']c' : '<cmd>Gitsigns next_hunk<CR>'", { expr = true, buffer = bufnr } }
nmap { '<leader>hR', gitsigns.reset_buffer } nmap { "<leader>hR", gitsigns.reset_buffer }
nmap { '<leader>hS', gitsigns.stage_buffer } nmap { "<leader>hS", gitsigns.stage_buffer }
nmap { '<leader>hp', gitsigns.preview_hunk } nmap { "<leader>hp", gitsigns.preview_hunk }
nmap { '<leader>hr', gitsigns.reset_hunk } nmap { "<leader>hr", gitsigns.reset_hunk }
nmap { '<leader>hs', gitsigns.stage_hunk } nmap { "<leader>hs", gitsigns.stage_hunk }
nmap { '<leader>hu', gitsigns.undo_stage_hunk } nmap { "<leader>hu", gitsigns.undo_stage_hunk }
vmap { '<leader>hr', function() gitsigns.reset_hunk { vim.fn.line('.'), vim.fn.line('v') } end } vmap {
vmap { '<leader>hs', function() gitsigns.stage_hunk { vim.fn.line('.'), vim.fn.line('v')} end } "<leader>hr",
function()
gitsigns.reset_hunk { vim.fn.line ".", vim.fn.line "v" }
end,
}
vmap {
"<leader>hs",
function()
gitsigns.stage_hunk { vim.fn.line ".", vim.fn.line "v" }
end,
}
-- Text object. -- Text object.
map{ {'o', 'x'}, 'ih', ':<C-U>Gitsigns select_hunk<CR>' } map { { "o", "x" }, "ih", ":<C-U>Gitsigns select_hunk<CR>" }

View file

@ -5,9 +5,8 @@ end
vim.opt.list = true vim.opt.list = true
vim.api.nvim_set_hl(0, 'IndentBlankLineChar', { fg = "#2F313C" }) vim.api.nvim_set_hl(0, "IndentBlankLineChar", { fg = "#2F313C" })
indent_blankline.setup { indent_blankline.setup {
show_end_of_line = true, show_end_of_line = true,
} }

View file

@ -1,4 +1,4 @@
local nmap = require "opdavies.keymap".nmap local nmap = require("opdavies.keymap").nmap
nmap { "<leader>pm", "<cmd>:PhpactorContextMenu<CR>" } nmap { "<leader>pm", "<cmd>:PhpactorContextMenu<CR>" }
nmap { "<leader>pn", "<cmd>:PhpactorClassNew<CR>" } nmap { "<leader>pn", "<cmd>:PhpactorClassNew<CR>" }

View file

@ -5,10 +5,22 @@ end
todo_comments.setup {} todo_comments.setup {}
local nmap = require "opdavies.keymap".nmap local nmap = require("opdavies.keymap").nmap
nmap { "[t", function() todo_comments.jump_prev() end, { desc = "Previous todo comment" }} nmap {
nmap { "]t", function() todo_comments.jump_next() end, { desc = "Next todo comment" }} "[t",
function()
todo_comments.jump_prev()
end,
{ desc = "Previous todo comment" },
}
nmap {
"]t",
function()
todo_comments.jump_next()
end,
{ desc = "Next todo comment" },
}
nmap { "<leader>tt", "<cmd>TodoTelescope<cr>" } nmap { "<leader>tt", "<cmd>TodoTelescope<cr>" }
nmap { "<leader>tq", "<cmd>TodoQuickFix<cr>" } nmap { "<leader>tq", "<cmd>TodoQuickFix<cr>" }

View file

@ -3,7 +3,6 @@ if not has_configs then
return return
end end
configs.setup { configs.setup {
autotag = { autotag = {
enable = true, enable = true,

View file

@ -1,3 +1,3 @@
local nmap = require "opdavies.keymap".nmap local nmap = require("opdavies.keymap").nmap
nmap { "<leader>u", vim.cmd.UndotreeToggle } nmap { "<leader>u", vim.cmd.UndotreeToggle }

View file

@ -10,11 +10,11 @@ map("n", "<leader>tl", ":TestLast<CR>", options)
map("n", "<leader>tn", ":TestNearest<CR>", options) map("n", "<leader>tn", ":TestNearest<CR>", options)
map("n", "<leader>ts", ":TestSuite<CR>", options) map("n", "<leader>ts", ":TestSuite<CR>", options)
vim.cmd([[ vim.cmd [[
let test#echo_command = 0 let test#echo_command = 0
let test#neovim#start_normal = 1 let test#neovim#start_normal = 1
let test#strategy = "neovim" let test#strategy = "neovim"
let test#php#phpunit#executable = 'just test' let test#php#phpunit#executable = 'just test'
let test#php#phpunit#options = '--colors=always --testdox' let test#php#phpunit#options = '--colors=always --testdox'
]]) ]]

View file

@ -96,9 +96,9 @@ local servers = {
settings = { settings = {
yaml = { yaml = {
keyOrdering = false, keyOrdering = false,
} },
} },
} },
} }
local setup_server = function(server, config) local setup_server = function(server, config)
@ -138,8 +138,7 @@ vim.diagnostic.config {
vim.keymap.set("n", "<leader>f", function() vim.keymap.set("n", "<leader>f", function()
vim.lsp.buf.format { async = true } vim.lsp.buf.format { async = true }
end end)
);
require "opdavies.lsp.null-ls" require "opdavies.lsp.null-ls"
require "opdavies.lsp.signature" require "opdavies.lsp.signature"

View file

@ -13,29 +13,29 @@ null_ls.setup {
formatting.black, formatting.black,
formatting.markdownlint, formatting.markdownlint,
formatting.phpcbf.with({ formatting.phpcbf.with {
command = "./vendor/bin/phpcbf", command = "./vendor/bin/phpcbf",
condition = function(utils) condition = function(utils)
return utils.root_has_file({ 'phpcs.xml.dist' }) return utils.root_has_file { "phpcs.xml.dist" }
end, end,
}), },
formatting.prettier, formatting.prettier,
formatting.rustywind, formatting.rustywind,
formatting.stylua, formatting.stylua,
diagnostics.eslint.with({ diagnostics.eslint.with {
condition = function(utils) condition = function(utils)
return utils.root_has_file({ '.eslintrc.js' }) return utils.root_has_file { ".eslintrc.js" }
end, end,
}), },
diagnostics.markdownlint, diagnostics.markdownlint,
diagnostics.php, diagnostics.php,
diagnostics.phpcs.with({ diagnostics.phpcs.with {
command = "./vendor/bin/phpcs", command = "./vendor/bin/phpcs",
condition = function(utils) condition = function(utils)
return utils.root_has_file({ 'phpcs.xml.dist' }) return utils.root_has_file { "phpcs.xml.dist" }
end, end,
}), },
diagnostics.phpstan, diagnostics.phpstan,
diagnostics.shellcheck, diagnostics.shellcheck,
}, },

View file

@ -157,7 +157,7 @@ local function set_vim_o()
vim.o[key] = value vim.o[key] = value
end end
vim.opt.backupdir:remove('.') -- keep backups out of the current directory vim.opt.backupdir:remove "." -- keep backups out of the current directory
vim.opt.clipboard:append "unnamedplus" vim.opt.clipboard:append "unnamedplus"
vim.opt.completeopt = { "menu", "menuone", "noselect" } vim.opt.completeopt = { "menu", "menuone", "noselect" }
vim.opt.laststatus = 3 vim.opt.laststatus = 3

View file

@ -43,7 +43,7 @@ local M = {
TextAnnotation "<>" TextAnnotation "<>"
]], ]],
{ i(0) } { i(0) }
) ),
} }
return M return M

View file

@ -3,8 +3,8 @@ if not status_ok then
return return
end end
local previewers = require "telescope.previewers"
local Job = require "plenary.job" local Job = require "plenary.job"
local previewers = require "telescope.previewers"
-- Create a new maker that won't preview binary files -- Create a new maker that won't preview binary files
-- https://github.com/nvim-telescope/telescope.nvim/wiki/Configuration-Recipes#dont-preview-binaries -- https://github.com/nvim-telescope/telescope.nvim/wiki/Configuration-Recipes#dont-preview-binaries
@ -33,9 +33,9 @@ local lga_actions = require "telescope-live-grep-args.actions"
telescope.setup { telescope.setup {
defaults = { defaults = {
buffer_previewer_maker = new_maker, buffer_previewer_maker = new_maker,
file_ignore_patterns = { '.direnv/', '.git/' }, file_ignore_patterns = { ".direnv/", ".git/" },
layout_config = { layout_config = {
prompt_position = 'top', prompt_position = "top",
}, },
preview = { preview = {
@ -54,7 +54,7 @@ telescope.setup {
no_ignore = true, no_ignore = true,
path_display = { truncate = 1 }, path_display = { truncate = 1 },
prompt_prefix = "$ ", prompt_prefix = "$ ",
sorting_strategy = 'ascending', sorting_strategy = "ascending",
}, },
pickers = { pickers = {

View file

@ -3,3 +3,6 @@ indent_width = 2
line_endings = "Unix" line_endings = "Unix"
no_call_parentheses = true no_call_parentheses = true
quote_style = "AutoPreferDouble" quote_style = "AutoPreferDouble"
[sort_requires]
enabled = true