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
end
catppuccin.setup({
catppuccin.setup {
flavour = "macchiato",
integrations = {
cmp = true,
gitsigns = true,
native_lsp = {
enabled = true;
enabled = true,
},
telescope = true,
treesitter = true,
},
term_colors = true,
transparent_background = true,
})
}
vim.cmd.colorscheme "catppuccin"

View file

@ -11,7 +11,7 @@ end
dap.adapters.php = {
type = "executable",
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 = {
@ -21,9 +21,9 @@ dap.configurations.php = {
name = "Listen for Xdebug",
port = 9003,
pathMappings = {
["/var/www/html"] = "${workspaceFolder}"
}
}
["/var/www/html"] = "${workspaceFolder}",
},
},
}
dap.listeners.after.event_initialized["dapui_config"] = function()
@ -38,7 +38,7 @@ dap.listeners.before.event_exited["dapui_config"] = function()
dapui.close()
end
require "dapui".setup {
require("dapui").setup {
layouts = {
{
elements = {
@ -58,14 +58,14 @@ require "dapui".setup {
size = 0.25, -- 25% of total lines
position = "bottom",
},
}
},
}
require "nvim-dap-virtual-text".setup {
require("nvim-dap-virtual-text").setup {
commented = true,
}
local nmap = require "opdavies.keymap".nmap
local nmap = require("opdavies.keymap").nmap
nmap { "<F12>", ":lua require'dap'.step_over()<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.integer.alias.decimal,
augend.integer.alias.hex,
augend.semver.alias.semver
augend.semver.alias.semver,
},
}
local dial_map = require "dial.map"
local nmap = require "opdavies.keymap".nmap
local vmap = require "opdavies.keymap".vmap
local nmap = require("opdavies.keymap").nmap
local vmap = require("opdavies.keymap").vmap
nmap({ "<C-a>", dial_map.inc_normal "mygroup" })
nmap({ "<C-x>", dial_map.dec_normal "mygroup" })
vmap({ "<C-a>", dial_map.inc_normal "visual" })
vmap({ "<C-x>", dial_map.dec_normal "visual" })
nmap { "<C-a>", dial_map.inc_normal "mygroup" }
nmap { "<C-x>", dial_map.dec_normal "mygroup" }
vmap { "<C-a>", dial_map.inc_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 }
vim.keymap.set("n", "<leader>p", function()
vim.cmd.Git('push')
vim.cmd.Git "push"
end, opts)
vim.keymap.set("n", "<leader>P", function()
vim.cmd.Git({'pull', '--rebase'})
vim.cmd.Git { "pull", "--rebase" }
end, opts)
end,
})

View file

@ -10,21 +10,31 @@ gitsigns.setup {
local bufnr = vim.api.nvim_get_current_buf()
local map = require "opdavies.keymap".map
local nmap = require "opdavies.keymap".nmap
local vmap = require "opdavies.keymap".vmap
local map = require("opdavies.keymap").map
local nmap = require("opdavies.keymap").nmap
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 next_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 { '<leader>hR', gitsigns.reset_buffer }
nmap { '<leader>hS', gitsigns.stage_buffer }
nmap { '<leader>hp', gitsigns.preview_hunk }
nmap { '<leader>hr', gitsigns.reset_hunk }
nmap { '<leader>hs', gitsigns.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 { '<leader>hs', function() gitsigns.stage_hunk { vim.fn.line('.'), vim.fn.line('v')} end }
nmap { "<leader>hR", gitsigns.reset_buffer }
nmap { "<leader>hS", gitsigns.stage_buffer }
nmap { "<leader>hp", gitsigns.preview_hunk }
nmap { "<leader>hr", gitsigns.reset_hunk }
nmap { "<leader>hs", gitsigns.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 {
"<leader>hs",
function()
gitsigns.stage_hunk { vim.fn.line ".", vim.fn.line "v" }
end,
}
-- 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.api.nvim_set_hl(0, 'IndentBlankLineChar', { fg = "#2F313C" })
vim.api.nvim_set_hl(0, "IndentBlankLineChar", { fg = "#2F313C" })
indent_blankline.setup {
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>pn", "<cmd>:PhpactorClassNew<CR>" }

View file

@ -5,10 +5,22 @@ end
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 { "]t", function() todo_comments.jump_next() end, { desc = "Next todo comment" }}
nmap {
"[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>tq", "<cmd>TodoQuickFix<cr>" }

View file

@ -3,7 +3,6 @@ if not has_configs then
return
end
configs.setup {
autotag = {
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 }

View file

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

View file

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

View file

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

View file

@ -157,7 +157,7 @@ local function set_vim_o()
vim.o[key] = value
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.completeopt = { "menu", "menuone", "noselect" }
vim.opt.laststatus = 3

View file

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

View file

@ -3,8 +3,8 @@ if not status_ok then
return
end
local previewers = require "telescope.previewers"
local Job = require "plenary.job"
local previewers = require "telescope.previewers"
-- Create a new maker that won't preview binary files
-- 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 {
defaults = {
buffer_previewer_maker = new_maker,
file_ignore_patterns = { '.direnv/', '.git/' },
file_ignore_patterns = { ".direnv/", ".git/" },
layout_config = {
prompt_position = 'top',
prompt_position = "top",
},
preview = {
@ -54,7 +54,7 @@ telescope.setup {
no_ignore = true,
path_display = { truncate = 1 },
prompt_prefix = "$ ",
sorting_strategy = 'ascending',
sorting_strategy = "ascending",
},
pickers = {

View file

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