feat: nvf mini surround
This commit is contained in:
parent
e1d9f982aa
commit
05bc6a185f
2 changed files with 196 additions and 191 deletions
|
|
@ -25,6 +25,7 @@ in
|
|||
{
|
||||
imports = [
|
||||
./plugins/snacks-nvim
|
||||
./plugins/lualine
|
||||
];
|
||||
|
||||
programs.nvf = {
|
||||
|
|
@ -32,6 +33,8 @@ in
|
|||
settings = {
|
||||
vim = {
|
||||
enableLuaLoader = true;
|
||||
vimAlias = true;
|
||||
|
||||
clipboard = {
|
||||
enable = true;
|
||||
providers = {
|
||||
|
|
@ -285,8 +288,6 @@ in
|
|||
transparent_enabled = true;
|
||||
};
|
||||
|
||||
vimAlias = true;
|
||||
|
||||
options = {
|
||||
foldcolumn = "0";
|
||||
foldlevel = 99;
|
||||
|
|
@ -421,180 +422,6 @@ in
|
|||
indent-blankline.enable = true;
|
||||
};
|
||||
|
||||
statusline = {
|
||||
lualine = {
|
||||
enable = true;
|
||||
activeSection = {
|
||||
a = lib.mkForce [
|
||||
''
|
||||
{
|
||||
"mode",
|
||||
icons_enabled = true,
|
||||
separator = {
|
||||
left = "",
|
||||
right = ""
|
||||
},
|
||||
}
|
||||
''
|
||||
''
|
||||
{
|
||||
"",
|
||||
draw_empty = true,
|
||||
separator = { left = '', right = '' }
|
||||
}
|
||||
''
|
||||
];
|
||||
b = lib.mkForce [
|
||||
''
|
||||
{
|
||||
"filetype",
|
||||
colored = true,
|
||||
icon_only = true,
|
||||
icon = { align = 'left' }
|
||||
}
|
||||
''
|
||||
''
|
||||
{
|
||||
"filename",
|
||||
symbols = {modified = ' ', readonly = ' '},
|
||||
separator = { left = '', right = ''}
|
||||
}
|
||||
''
|
||||
''
|
||||
{
|
||||
"",
|
||||
draw_empty = true,
|
||||
separator = { left = '', right = '' }
|
||||
}
|
||||
''
|
||||
];
|
||||
c = lib.mkForce [
|
||||
''
|
||||
{
|
||||
"diff",
|
||||
colored = false,
|
||||
diff_color = {
|
||||
-- Same color values as the general color option can be used here.
|
||||
added = 'DiffAdd', -- Changes the diff's added color
|
||||
modified = 'DiffChange', -- Changes the diff's modified color
|
||||
removed = 'DiffDelete', -- Changes the diff's removed color you
|
||||
},
|
||||
symbols = {added = '+', modified = '~', removed = '-'}, -- Changes the diff symbols
|
||||
separator = {right = ''}
|
||||
}
|
||||
''
|
||||
];
|
||||
x = lib.mkForce [
|
||||
''
|
||||
{
|
||||
-- Lsp server name
|
||||
function()
|
||||
local buf_ft = vim.bo.filetype
|
||||
local excluded_buf_ft = { toggleterm = true, NvimTree = true, ["neo-tree"] = true, TelescopePrompt = true }
|
||||
|
||||
if excluded_buf_ft[buf_ft] then
|
||||
return ""
|
||||
end
|
||||
|
||||
local bufnr = vim.api.nvim_get_current_buf()
|
||||
local clients = vim.lsp.get_clients({ bufnr = bufnr })
|
||||
|
||||
if vim.tbl_isempty(clients) then
|
||||
return "No Active LSP"
|
||||
end
|
||||
|
||||
local active_clients = {}
|
||||
for _, client in ipairs(clients) do
|
||||
table.insert(active_clients, client.name)
|
||||
end
|
||||
|
||||
return table.concat(active_clients, ", ")
|
||||
end,
|
||||
icon = ' ',
|
||||
separator = {left = ''},
|
||||
}
|
||||
''
|
||||
''
|
||||
{
|
||||
"diagnostics",
|
||||
sources = {'nvim_lsp', 'nvim_diagnostic', 'nvim_diagnostic', 'vim_lsp', 'coc'},
|
||||
symbols = {error = ' ', warn = ' ', info = ' ', hint = ' '},
|
||||
colored = true,
|
||||
update_in_insert = false,
|
||||
always_visible = false,
|
||||
diagnostics_color = {
|
||||
color_error = { fg = 'red' },
|
||||
color_warn = { fg = 'yellow' },
|
||||
color_info = { fg = 'cyan' },
|
||||
},
|
||||
}
|
||||
''
|
||||
];
|
||||
y = lib.mkForce [
|
||||
''
|
||||
{
|
||||
"",
|
||||
draw_empty = true,
|
||||
separator = { left = '', right = '' }
|
||||
}
|
||||
''
|
||||
''
|
||||
{
|
||||
'searchcount',
|
||||
maxcount = 999,
|
||||
timeout = 120,
|
||||
separator = {left = ''}
|
||||
}
|
||||
''
|
||||
''
|
||||
{
|
||||
"branch",
|
||||
icon = ' •',
|
||||
separator = {left = ''}
|
||||
}
|
||||
''
|
||||
];
|
||||
z = lib.mkForce [
|
||||
''
|
||||
{
|
||||
"",
|
||||
draw_empty = true,
|
||||
separator = { left = '', right = '' }
|
||||
}
|
||||
''
|
||||
''
|
||||
{
|
||||
"progress",
|
||||
separator = {left = ''}
|
||||
}
|
||||
''
|
||||
''
|
||||
{"location"}
|
||||
''
|
||||
''
|
||||
{
|
||||
"fileformat",
|
||||
color = {fg='black'},
|
||||
symbols = {
|
||||
unix = '', -- e843
|
||||
dos = '', -- e70f
|
||||
mac = '', -- e711
|
||||
}
|
||||
}
|
||||
''
|
||||
];
|
||||
};
|
||||
componentSeparator = {
|
||||
left = "";
|
||||
right = "";
|
||||
};
|
||||
sectionSeparator = {
|
||||
left = "";
|
||||
right = "";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
autopairs.nvim-autopairs.enable = true;
|
||||
|
||||
autocomplete = {
|
||||
|
|
@ -627,21 +454,6 @@ in
|
|||
enable = true;
|
||||
};
|
||||
|
||||
filetree = {
|
||||
neo-tree = {
|
||||
enable = false;
|
||||
setupOpts = {
|
||||
window = {
|
||||
position = "right";
|
||||
mappings = {
|
||||
"l" = "open";
|
||||
"h" = "close_node";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
tabline = {
|
||||
nvimBufferline = {
|
||||
enable = true;
|
||||
|
|
@ -820,6 +632,23 @@ in
|
|||
};
|
||||
};
|
||||
};
|
||||
|
||||
mini.surround = {
|
||||
enable = true;
|
||||
setupOpts = {
|
||||
mappings = {
|
||||
add = "gsa";
|
||||
delete = "gsd";
|
||||
find = "gsf";
|
||||
find_left = "gsF";
|
||||
highlight = "gsh";
|
||||
replace = "gsr";
|
||||
suffix_last = "";
|
||||
suffix_next = "";
|
||||
};
|
||||
silent = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
|||
176
home/user/nvf/plugins/lualine/default.nix
Normal file
176
home/user/nvf/plugins/lualine/default.nix
Normal file
|
|
@ -0,0 +1,176 @@
|
|||
{ pkgs, lib, ... }:
|
||||
{
|
||||
programs.nvf.settings.vim.statusline = {
|
||||
lualine = {
|
||||
enable = true;
|
||||
activeSection = {
|
||||
a = lib.mkForce [
|
||||
''
|
||||
{
|
||||
"mode",
|
||||
icons_enabled = true,
|
||||
separator = {
|
||||
left = "",
|
||||
right = ""
|
||||
},
|
||||
}
|
||||
''
|
||||
''
|
||||
{
|
||||
"",
|
||||
draw_empty = true,
|
||||
separator = { left = '', right = '' }
|
||||
}
|
||||
''
|
||||
];
|
||||
b = lib.mkForce [
|
||||
''
|
||||
{
|
||||
"filetype",
|
||||
colored = true,
|
||||
icon_only = true,
|
||||
icon = { align = 'left' }
|
||||
}
|
||||
''
|
||||
''
|
||||
{
|
||||
"filename",
|
||||
symbols = {modified = ' ', readonly = ' '},
|
||||
separator = { left = '', right = ''}
|
||||
}
|
||||
''
|
||||
''
|
||||
{
|
||||
"",
|
||||
draw_empty = true,
|
||||
separator = { left = '', right = '' }
|
||||
}
|
||||
''
|
||||
];
|
||||
c = lib.mkForce [
|
||||
''
|
||||
{
|
||||
"diff",
|
||||
colored = false,
|
||||
diff_color = {
|
||||
-- Same color values as the general color option can be used here.
|
||||
added = 'DiffAdd', -- Changes the diff's added color
|
||||
modified = 'DiffChange', -- Changes the diff's modified color
|
||||
removed = 'DiffDelete', -- Changes the diff's removed color you
|
||||
},
|
||||
symbols = {added = '+', modified = '~', removed = '-'}, -- Changes the diff symbols
|
||||
separator = {right = ''}
|
||||
}
|
||||
''
|
||||
];
|
||||
x = lib.mkForce [
|
||||
''
|
||||
{
|
||||
-- Lsp server name
|
||||
function()
|
||||
local buf_ft = vim.bo.filetype
|
||||
local excluded_buf_ft = { toggleterm = true, NvimTree = true, ["neo-tree"] = true, TelescopePrompt = true }
|
||||
|
||||
if excluded_buf_ft[buf_ft] then
|
||||
return ""
|
||||
end
|
||||
|
||||
local bufnr = vim.api.nvim_get_current_buf()
|
||||
local clients = vim.lsp.get_clients({ bufnr = bufnr })
|
||||
|
||||
if vim.tbl_isempty(clients) then
|
||||
return "No Active LSP"
|
||||
end
|
||||
|
||||
local active_clients = {}
|
||||
for _, client in ipairs(clients) do
|
||||
table.insert(active_clients, client.name)
|
||||
end
|
||||
|
||||
return table.concat(active_clients, ", ")
|
||||
end,
|
||||
icon = ' ',
|
||||
separator = {left = ''},
|
||||
}
|
||||
''
|
||||
''
|
||||
{
|
||||
"diagnostics",
|
||||
sources = {'nvim_lsp', 'nvim_diagnostic', 'nvim_diagnostic', 'vim_lsp', 'coc'},
|
||||
symbols = {error = ' ', warn = ' ', info = ' ', hint = ' '},
|
||||
colored = true,
|
||||
update_in_insert = false,
|
||||
always_visible = false,
|
||||
diagnostics_color = {
|
||||
color_error = { fg = 'red' },
|
||||
color_warn = { fg = 'yellow' },
|
||||
color_info = { fg = 'cyan' },
|
||||
},
|
||||
}
|
||||
''
|
||||
];
|
||||
y = lib.mkForce [
|
||||
''
|
||||
{
|
||||
"",
|
||||
draw_empty = true,
|
||||
separator = { left = '', right = '' }
|
||||
}
|
||||
''
|
||||
''
|
||||
{
|
||||
'searchcount',
|
||||
maxcount = 999,
|
||||
timeout = 120,
|
||||
separator = {left = ''}
|
||||
}
|
||||
''
|
||||
''
|
||||
{
|
||||
"branch",
|
||||
icon = ' •',
|
||||
separator = {left = ''}
|
||||
}
|
||||
''
|
||||
];
|
||||
z = lib.mkForce [
|
||||
''
|
||||
{
|
||||
"",
|
||||
draw_empty = true,
|
||||
separator = { left = '', right = '' }
|
||||
}
|
||||
''
|
||||
''
|
||||
{
|
||||
"progress",
|
||||
separator = {left = ''}
|
||||
}
|
||||
''
|
||||
''
|
||||
{"location"}
|
||||
''
|
||||
''
|
||||
{
|
||||
"fileformat",
|
||||
color = {fg='black'},
|
||||
symbols = {
|
||||
unix = '', -- e843
|
||||
dos = '', -- e70f
|
||||
mac = '', -- e711
|
||||
}
|
||||
}
|
||||
''
|
||||
];
|
||||
};
|
||||
componentSeparator = {
|
||||
left = "";
|
||||
right = "";
|
||||
};
|
||||
sectionSeparator = {
|
||||
left = "";
|
||||
right = "";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue