feat: misc configs
This commit is contained in:
parent
15a876e975
commit
efb515d76c
9 changed files with 91 additions and 48 deletions
|
|
@ -10,9 +10,16 @@ vim.keymap.set('n', '<leader>t', function()
|
|||
local ret = vim.system({ 'hyprctl', 'clients', '-j' }):wait()
|
||||
if ret.code == 0 then
|
||||
for _, c in ipairs(vim.json.decode(ret.stdout)) do
|
||||
if (c.class or ''):lower():find('sioyek')
|
||||
and (c.title or ''):find(basename, 1, true) then
|
||||
vim.system({ 'hyprctl', 'dispatch', 'closewindow', 'address:' .. c.address })
|
||||
if
|
||||
(c.class or ''):lower():find('sioyek')
|
||||
and (c.title or ''):find(basename, 1, true)
|
||||
then
|
||||
vim.system({
|
||||
'hyprctl',
|
||||
'dispatch',
|
||||
'closewindow',
|
||||
'address:' .. c.address,
|
||||
})
|
||||
return
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -12,8 +12,6 @@
|
|||
"mini.pairs": { "branch": "main", "commit": "4089aa6ea6423e02e1a8326a7a7a00159f6f5e04" },
|
||||
"nvim-colorizer.lua": { "branch": "master", "commit": "338409dd8a6ed74767bad3eb5269f1b903ffb3cf" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "f4e9d367d4e067d7a5fabc9fd3f1349b291eb718" },
|
||||
"nvim-navic": { "branch": "master", "commit": "f5eba192f39b453675d115351808bd51276d9de5" },
|
||||
"nvim-nonicons": { "branch": "main", "commit": "0cd3e96efe766fb3688d955c129c78986d4b295f" },
|
||||
"nvim-surround": { "branch": "main", "commit": "1098d7b3c34adcfa7feb3289ee434529abd4afd1" },
|
||||
"nvim-treesitter": { "branch": "main", "commit": "9f2dad22ef8bb14fd1e0a3aa8859cdc88170668b" },
|
||||
"nvim-treesitter-textobjects": { "branch": "main", "commit": "a0e182ae21fda68c59d1f36c9ed45600aef50311" },
|
||||
|
|
|
|||
|
|
@ -74,6 +74,7 @@ return {
|
|||
{ 'gl', '<cmd>FzfLua loclist<cr>' },
|
||||
},
|
||||
opts = {
|
||||
file_icon_padding = ' ',
|
||||
files = {
|
||||
cmd = vim.env.FZF_CTRL_T_COMMAND,
|
||||
file_icons = true,
|
||||
|
|
|
|||
|
|
@ -178,15 +178,4 @@ return {
|
|||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
'SmiteshP/nvim-navic',
|
||||
opts = {
|
||||
depth_limit = 3,
|
||||
depth_limit_indicator = '…',
|
||||
icons = {
|
||||
enabled = false,
|
||||
},
|
||||
},
|
||||
event = 'LspAttach',
|
||||
},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,39 @@
|
|||
local oil_detail = false
|
||||
|
||||
local function parse_output(proc)
|
||||
local result = proc:wait()
|
||||
local ret = {}
|
||||
if result.code == 0 then
|
||||
for line in vim.gsplit(result.stdout, "\n", { plain = true, trimempty = true }) do
|
||||
ret[line:gsub("/$", "")] = true
|
||||
end
|
||||
end
|
||||
return ret
|
||||
end
|
||||
|
||||
local function new_git_status()
|
||||
return setmetatable({}, {
|
||||
__index = function(self, key)
|
||||
local ignored_proc = vim.system(
|
||||
{ "git", "ls-files", "--ignored", "--exclude-standard", "--others", "--directory" },
|
||||
{ cwd = key, text = true }
|
||||
)
|
||||
local tracked_proc = vim.system(
|
||||
{ "git", "ls-tree", "HEAD", "--name-only" },
|
||||
{ cwd = key, text = true }
|
||||
)
|
||||
local ret = {
|
||||
ignored = parse_output(ignored_proc),
|
||||
tracked = parse_output(tracked_proc),
|
||||
}
|
||||
rawset(self, key, ret)
|
||||
return ret
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
local git_status = new_git_status()
|
||||
|
||||
return {
|
||||
{
|
||||
'barrettruth/midnight.nvim',
|
||||
|
|
@ -8,9 +44,9 @@ return {
|
|||
end,
|
||||
},
|
||||
{
|
||||
dir = '~/dev/nonicons',
|
||||
'barrettruth/nonicons.nvim',
|
||||
dir = '~/dev/nonicons.nvim',
|
||||
dependencies = { 'nvim-tree/nvim-web-devicons' },
|
||||
opts = {},
|
||||
},
|
||||
{
|
||||
'echasnovski/mini.pairs',
|
||||
|
|
@ -227,6 +263,12 @@ return {
|
|||
'stevearc/oil.nvim',
|
||||
config = function(_, opts)
|
||||
require('oil').setup(opts)
|
||||
local refresh = require("oil.actions").refresh
|
||||
local orig_refresh = refresh.callback
|
||||
refresh.callback = function(...)
|
||||
git_status = new_git_status()
|
||||
orig_refresh(...)
|
||||
end
|
||||
vim.api.nvim_create_autocmd('BufEnter', {
|
||||
callback = function()
|
||||
local ft = vim.bo.filetype
|
||||
|
|
@ -251,21 +293,16 @@ return {
|
|||
float = { border = 'single' },
|
||||
view_options = {
|
||||
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 ~= ".."
|
||||
if not dir then
|
||||
return false
|
||||
return is_dotfile
|
||||
end
|
||||
if vim.startswith(name, '.') then
|
||||
return false
|
||||
if is_dotfile then
|
||||
return not git_status[dir].tracked[name]
|
||||
else
|
||||
return git_status[dir].ignored[name]
|
||||
end
|
||||
local git_dir = vim.fn.finddir('.git', dir .. ';')
|
||||
if git_dir == '' then
|
||||
return false
|
||||
end
|
||||
local fullpath = dir .. '/' .. name
|
||||
local result =
|
||||
vim.fn.systemlist({ 'git', 'check-ignore', fullpath })
|
||||
return #result > 0
|
||||
end,
|
||||
},
|
||||
keymaps = {
|
||||
|
|
@ -275,7 +312,7 @@ return {
|
|||
['<C-r>'] = 'actions.refresh',
|
||||
['<C-s>'] = { 'actions.select', opts = { vertical = true } },
|
||||
['<C-x>'] = { 'actions.select', opts = { horizontal = true } },
|
||||
['q'] = function()
|
||||
q = function()
|
||||
local ok, bufremove = pcall(require, 'mini.bufremove')
|
||||
if ok then
|
||||
bufremove.delete()
|
||||
|
|
@ -283,6 +320,14 @@ return {
|
|||
vim.cmd.bd()
|
||||
end
|
||||
end,
|
||||
k = function()
|
||||
oil_detail = not oil_detail
|
||||
if oil_detail then
|
||||
require("oil").set_columns({ "icon", "permissions", "size", "mtime" })
|
||||
else
|
||||
require("oil").set_columns({ "icon" })
|
||||
end
|
||||
end
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
@ -311,15 +356,15 @@ return {
|
|||
},
|
||||
},
|
||||
{ 'tpope/vim-abolish', event = 'VeryLazy' },
|
||||
{ 'tpope/vim-sleuth', event = 'BufReadPost' },
|
||||
{ 'tpope/vim-sleuth', event = 'BufReadPost' },
|
||||
{
|
||||
'kylechui/nvim-surround',
|
||||
config = true,
|
||||
keys = {
|
||||
{ 'cs', mode = 'n' },
|
||||
{ 'ds', mode = 'n' },
|
||||
{ 'ys', mode = 'n' },
|
||||
{ 'yS', mode = 'n' },
|
||||
{ 'cs', mode = 'n' },
|
||||
{ 'ds', mode = 'n' },
|
||||
{ 'ys', mode = 'n' },
|
||||
{ 'yS', mode = 'n' },
|
||||
{ 'yss', mode = 'n' },
|
||||
{ 'ySs', mode = 'n' },
|
||||
},
|
||||
|
|
|
|||
|
|
@ -54,8 +54,11 @@ unbind ?; bind ? if -F '#{pane_in_mode}' { send-keys -X cancel } { copy-mode ; c
|
|||
|
||||
bind -T copy-mode-vi v send-keys -X begin-selection
|
||||
bind -T copy-mode-vi y send-keys -X copy-pipe 'test -n "$WAYLAND_DISPLAY" && wl-copy || xclip -in -sel c'
|
||||
bind -T copy-mode-vi DoubleClick1Pane select-pane \; send-keys -X select-word \; run-shell -d 0.3 \; send-keys -X copy-pipe 'test -n "$WAYLAND_DISPLAY" && wl-copy || xclip -in -sel c'
|
||||
bind -T copy-mode-vi TripleClick1Pane select-pane \; send-keys -X select-line \; run-shell -d 0.3 \; send-keys -X copy-pipe 'test -n "$WAYLAND_DISPLAY" && wl-copy || xclip -in -sel c'
|
||||
bind -n DoubleClick1Pane select-pane \; copy-mode -M \; send-keys -X select-word \; run-shell -d 0.3 \; send-keys -X copy-pipe 'test -n "$WAYLAND_DISPLAY" && wl-copy || xclip -in -sel c' \; send-keys -X clear-selection
|
||||
bind -n TripleClick1Pane select-pane \; copy-mode -M \; send-keys -X select-line \; run-shell -d 0.3 \; send-keys -X copy-pipe 'test -n "$WAYLAND_DISPLAY" && wl-copy || xclip -in -sel c' \; send-keys -X clear-selection
|
||||
bind -T copy-mode-vi DoubleClick1Pane select-pane \; send-keys -X select-word \; run-shell -d 0.3 \; send-keys -X copy-pipe 'test -n "$WAYLAND_DISPLAY" && wl-copy || xclip -in -sel c' \; send-keys -X clear-selection
|
||||
bind -T copy-mode-vi TripleClick1Pane select-pane \; send-keys -X select-line \; run-shell -d 0.3 \; send-keys -X copy-pipe 'test -n "$WAYLAND_DISPLAY" && wl-copy || xclip -in -sel c' \; send-keys -X clear-selection
|
||||
bind -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe 'test -n "$WAYLAND_DISPLAY" && wl-copy || xclip -in -sel c' \; send-keys -X clear-selection
|
||||
|
||||
unbind b; bind b set status\; refresh -S
|
||||
unbind m; bind m set -g mouse\; run-shell 'mux bar'\; refresh -S
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue