fix(nvim): format
This commit is contained in:
parent
c759cd0d0e
commit
15edf30ef3
5 changed files with 69 additions and 33 deletions
|
|
@ -77,7 +77,10 @@ M.conventional_commits = make_source({
|
||||||
{
|
{
|
||||||
range = {
|
range = {
|
||||||
start = { line = 0, character = colon - 1 },
|
start = { line = 0, character = colon - 1 },
|
||||||
['end'] = { line = 0, character = colon - 1 },
|
['end'] = {
|
||||||
|
line = 0,
|
||||||
|
character = colon - 1,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
newText = '!',
|
newText = '!',
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,10 @@ return {
|
||||||
end,
|
end,
|
||||||
sign = function()
|
sign = function()
|
||||||
local marks = vim.api.nvim_buf_get_extmarks(
|
local marks = vim.api.nvim_buf_get_extmarks(
|
||||||
0, -1, { vim.v.lnum - 1, 0 }, { vim.v.lnum - 1, -1 },
|
0,
|
||||||
|
-1,
|
||||||
|
{ vim.v.lnum - 1, 0 },
|
||||||
|
{ vim.v.lnum - 1, -1 },
|
||||||
{ details = true, type = 'sign' }
|
{ details = true, type = 'sign' }
|
||||||
)
|
)
|
||||||
for _, mark in ipairs(marks) do
|
for _, mark in ipairs(marks) do
|
||||||
|
|
@ -46,7 +49,10 @@ return {
|
||||||
if d and d.sign_text then
|
if d and d.sign_text then
|
||||||
local text = vim.trim(d.sign_text)
|
local text = vim.trim(d.sign_text)
|
||||||
if text ~= '' then
|
if text ~= '' then
|
||||||
return '%#' .. (d.sign_hl_group or 'SignColumn') .. '#' .. text
|
return '%#'
|
||||||
|
.. (d.sign_hl_group or 'SignColumn')
|
||||||
|
.. '#'
|
||||||
|
.. text
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,8 @@ return {
|
||||||
opts.files.file_icons = has_devicons
|
opts.files.file_icons = has_devicons
|
||||||
opts.grep = opts.grep or {}
|
opts.grep = opts.grep or {}
|
||||||
opts.grep.file_icons = has_devicons
|
opts.grep.file_icons = has_devicons
|
||||||
opts.grep.rg_opts = fzf.defaults.grep.rg_opts:gsub("%-e$", "--glob='!.git/' -e")
|
opts.grep.rg_opts =
|
||||||
|
fzf.defaults.grep.rg_opts:gsub('%-e$', "--glob='!.git/' -e")
|
||||||
|
|
||||||
fzf.setup(opts)
|
fzf.setup(opts)
|
||||||
|
|
||||||
|
|
@ -45,7 +46,7 @@ return {
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
{ '<c-l>', '<cmd>FzfLua live_grep<cr>' },
|
{ '<c-l>', '<cmd>FzfLua live_grep<cr>' },
|
||||||
{ '<leader>f/', '<cmd>FzfLua search_history<cr>' },
|
{ '<leader>f/', '<cmd>FzfLua search_history<cr>' },
|
||||||
{ '<leader>f:', '<cmd>FzfLua command_history<cr>' },
|
{ '<leader>f:', '<cmd>FzfLua command_history<cr>' },
|
||||||
{ '<leader>fa', '<cmd>FzfLua autocmds<cr>' },
|
{ '<leader>fa', '<cmd>FzfLua autocmds<cr>' },
|
||||||
|
|
@ -79,8 +80,8 @@ return {
|
||||||
},
|
},
|
||||||
{ '<leader>gb', '<cmd>FzfLua git_branches<cr>' },
|
{ '<leader>gb', '<cmd>FzfLua git_branches<cr>' },
|
||||||
{ '<leader>gw', '<cmd>FzfLua git_worktrees<cr>' },
|
{ '<leader>gw', '<cmd>FzfLua git_worktrees<cr>' },
|
||||||
{ 'gq', '<cmd>FzfLua quickfix<cr>' },
|
{ 'gq', '<cmd>FzfLua quickfix<cr>' },
|
||||||
{ 'gl', '<cmd>FzfLua loclist<cr>' },
|
{ 'gl', '<cmd>FzfLua loclist<cr>' },
|
||||||
},
|
},
|
||||||
opts = {
|
opts = {
|
||||||
file_icon_padding = ' ',
|
file_icon_padding = ' ',
|
||||||
|
|
|
||||||
|
|
@ -230,7 +230,9 @@ return {
|
||||||
dir = '~/dev/oil-git.nvim',
|
dir = '~/dev/oil-git.nvim',
|
||||||
opts = {
|
opts = {
|
||||||
symbol_position = 'signcolumn',
|
symbol_position = 'signcolumn',
|
||||||
can_use_signcolumn = function() return true end,
|
can_use_signcolumn = function()
|
||||||
|
return true
|
||||||
|
end,
|
||||||
show_file_highlights = false,
|
show_file_highlights = false,
|
||||||
show_directory_highlights = false,
|
show_directory_highlights = false,
|
||||||
symbols = {
|
symbols = {
|
||||||
|
|
@ -268,24 +270,36 @@ return {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"lewis6991/gitsigns.nvim",
|
'lewis6991/gitsigns.nvim',
|
||||||
event = "VeryLazy",
|
event = 'VeryLazy',
|
||||||
opts = {
|
opts = {
|
||||||
signs = {
|
signs = {
|
||||||
add = { text = "│" },
|
add = { text = '│' },
|
||||||
change = { text = "│" },
|
change = { text = '│' },
|
||||||
delete = { text = "_" },
|
delete = { text = '_' },
|
||||||
topdelete = { text = "‾" },
|
topdelete = { text = '‾' },
|
||||||
changedelete = { text = "│" },
|
changedelete = { text = '│' },
|
||||||
},
|
},
|
||||||
on_attach = function(bufnr)
|
on_attach = function(bufnr)
|
||||||
vim.wo[vim.fn.bufwinid(bufnr)].signcolumn = 'yes'
|
vim.wo[vim.fn.bufwinid(bufnr)].signcolumn = 'yes'
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
keys = {
|
keys = {
|
||||||
{ "]g", "<cmd>Gitsigns next_hunk<cr>", desc = "Next git hunk" },
|
{
|
||||||
{ "[g", "<cmd>Gitsigns prev_hunk<cr>", desc = "Previous git hunk" },
|
']g',
|
||||||
{ "<leader>gB", "<cmd>Gitsigns toggle_current_line_blame<cr>", desc = "Toggle line blame" },
|
'<cmd>Gitsigns next_hunk<cr>',
|
||||||
|
desc = 'Next git hunk',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'[g',
|
||||||
|
'<cmd>Gitsigns prev_hunk<cr>',
|
||||||
|
desc = 'Previous git hunk',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'<leader>gB',
|
||||||
|
'<cmd>Gitsigns toggle_current_line_blame<cr>',
|
||||||
|
desc = 'Toggle line blame',
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,10 @@ local function parse_output(proc)
|
||||||
local result = proc:wait()
|
local result = proc:wait()
|
||||||
local ret = {}
|
local ret = {}
|
||||||
if result.code == 0 then
|
if result.code == 0 then
|
||||||
for line in vim.gsplit(result.stdout, "\n", { plain = true, trimempty = true }) do
|
for line in
|
||||||
ret[line:gsub("/$", "")] = true
|
vim.gsplit(result.stdout, '\n', { plain = true, trimempty = true })
|
||||||
|
do
|
||||||
|
ret[line:gsub('/$', '')] = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return ret
|
return ret
|
||||||
|
|
@ -14,12 +16,16 @@ end
|
||||||
local function new_git_status()
|
local function new_git_status()
|
||||||
return setmetatable({}, {
|
return setmetatable({}, {
|
||||||
__index = function(self, key)
|
__index = function(self, key)
|
||||||
local ignored_proc = vim.system(
|
local ignored_proc = vim.system({
|
||||||
{ "git", "ls-files", "--ignored", "--exclude-standard", "--others", "--directory" },
|
'git',
|
||||||
{ cwd = key, text = true }
|
'ls-files',
|
||||||
)
|
'--ignored',
|
||||||
|
'--exclude-standard',
|
||||||
|
'--others',
|
||||||
|
'--directory',
|
||||||
|
}, { cwd = key, text = true })
|
||||||
local tracked_proc = vim.system(
|
local tracked_proc = vim.system(
|
||||||
{ "git", "ls-tree", "HEAD", "--name-only" },
|
{ 'git', 'ls-tree', 'HEAD', '--name-only' },
|
||||||
{ cwd = key, text = true }
|
{ cwd = key, text = true }
|
||||||
)
|
)
|
||||||
local ret = {
|
local ret = {
|
||||||
|
|
@ -267,7 +273,7 @@ return {
|
||||||
dir = '~/dev/oil.nvim',
|
dir = '~/dev/oil.nvim',
|
||||||
config = function(_, opts)
|
config = function(_, opts)
|
||||||
require('oil').setup(opts)
|
require('oil').setup(opts)
|
||||||
local refresh = require("oil.actions").refresh
|
local refresh = require('oil.actions').refresh
|
||||||
local orig_refresh = refresh.callback
|
local orig_refresh = refresh.callback
|
||||||
refresh.callback = function(...)
|
refresh.callback = function(...)
|
||||||
git_status = new_git_status()
|
git_status = new_git_status()
|
||||||
|
|
@ -297,8 +303,9 @@ return {
|
||||||
float = { border = 'single' },
|
float = { border = 'single' },
|
||||||
view_options = {
|
view_options = {
|
||||||
is_hidden_file = function(name, bufnr)
|
is_hidden_file = function(name, bufnr)
|
||||||
local dir = require("oil").get_current_dir(bufnr)
|
local dir = require('oil').get_current_dir(bufnr)
|
||||||
local is_dotfile = vim.startswith(name, ".") and name ~= ".."
|
local is_dotfile = vim.startswith(name, '.')
|
||||||
|
and name ~= '..'
|
||||||
if not dir then
|
if not dir then
|
||||||
return is_dotfile
|
return is_dotfile
|
||||||
end
|
end
|
||||||
|
|
@ -352,17 +359,22 @@ return {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{ 'tpope/vim-abolish', event = 'VeryLazy' },
|
{ 'tpope/vim-abolish', event = 'VeryLazy' },
|
||||||
{ 'tpope/vim-sleuth', event = 'BufReadPost' },
|
{ 'tpope/vim-sleuth', event = 'BufReadPost' },
|
||||||
{
|
{
|
||||||
'kylechui/nvim-surround',
|
'kylechui/nvim-surround',
|
||||||
config = true,
|
config = true,
|
||||||
keys = {
|
keys = {
|
||||||
{ 'cs', mode = 'n' },
|
{ 'cs', mode = 'n' },
|
||||||
{ 'ds', mode = 'n' },
|
{ 'ds', mode = 'n' },
|
||||||
{ 'ys', mode = 'n' },
|
{ 'ys', mode = 'n' },
|
||||||
{ 'yS', mode = 'n' },
|
{ 'yS', mode = 'n' },
|
||||||
{ 'yss', mode = 'n' },
|
{ 'yss', mode = 'n' },
|
||||||
{ 'ySs', mode = 'n' },
|
{ 'ySs', mode = 'n' },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
'wallpants/github-preview.nvim',
|
||||||
|
keys = { '<leader>m', '<cmd>GithubPreviewToggle<cr>' },
|
||||||
|
config = true,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue