mirror of
https://github.com/hyzendust/KickestEnd.nvim.git
synced 2026-02-15 08:41:13 +01:00
Fix: text hightlight on select all and copy
This commit is contained in:
@@ -16,13 +16,11 @@ return {
|
||||
return
|
||||
end
|
||||
local path = node:get_id()
|
||||
|
||||
-- If the node is a directory, just toggle expand/collapse
|
||||
if node.type == 'directory' then
|
||||
state.commands.toggle_node(state, node)
|
||||
return
|
||||
end
|
||||
|
||||
-- --- File handling starts here ---
|
||||
-- Reuse already open buffer in any tab safely
|
||||
for _, tab in ipairs(vim.api.nvim_list_tabpages()) do
|
||||
@@ -48,7 +46,6 @@ return {
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- Reuse empty buffer in current tab
|
||||
local wins = vim.api.nvim_tabpage_list_wins(0)
|
||||
local empty_buf = nil
|
||||
@@ -67,13 +64,11 @@ return {
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if empty_buf then
|
||||
vim.cmd('edit ' .. vim.fn.fnameescape(path))
|
||||
else
|
||||
vim.cmd('tabnew ' .. vim.fn.fnameescape(path))
|
||||
end
|
||||
|
||||
-- Always close Neo-tree window if open
|
||||
for _, win in ipairs(vim.api.nvim_list_wins()) do
|
||||
if vim.api.nvim_win_is_valid(win) then
|
||||
@@ -84,7 +79,6 @@ return {
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- Smart_open_split for split windows
|
||||
local function smart_open_split(state, direction)
|
||||
local node = state.tree:get_node()
|
||||
@@ -97,7 +91,6 @@ return {
|
||||
state.commands.toggle_node(state, node)
|
||||
return
|
||||
end
|
||||
|
||||
-- Check if file is open in another tab
|
||||
local open_tab, open_win
|
||||
for _, tab in ipairs(vim.api.nvim_list_tabpages()) do
|
||||
@@ -113,7 +106,6 @@ return {
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
if open_tab then
|
||||
local choice = vim.fn.confirm('File is already open in a tab. Open split here anyway?', '&Yes\n&No', 2)
|
||||
if choice ~= 1 then
|
||||
@@ -124,7 +116,6 @@ return {
|
||||
end
|
||||
-- Else user chose Yes → continue to open split in current tab
|
||||
end
|
||||
|
||||
-- Open split in current tab
|
||||
if direction == 'v' then
|
||||
state.commands.open_vsplit(state)
|
||||
@@ -140,7 +131,6 @@ return {
|
||||
|
||||
vim.cmd('edit ' .. vim.fn.fnameescape(path))
|
||||
end
|
||||
|
||||
require('neo-tree').setup {
|
||||
close_if_last_window = true,
|
||||
popup_border_style = 'rounded',
|
||||
|
||||
@@ -30,7 +30,6 @@ return {
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
-- Enable telescope fzf native, if installed
|
||||
pcall(require('telescope').load_extension, 'fzf')
|
||||
|
||||
@@ -191,7 +190,6 @@ return {
|
||||
end,
|
||||
}
|
||||
end, { desc = 'Switch to Open Buffers' })
|
||||
|
||||
-- Telescope live_grep in git root
|
||||
-- Function to find the git root directory based on the current buffer's path
|
||||
local function find_git_root()
|
||||
@@ -206,7 +204,6 @@ return {
|
||||
-- Extract the directory from the current file's path
|
||||
current_dir = vim.fn.fnamemodify(current_file, ':h')
|
||||
end
|
||||
|
||||
-- Find the Git root directory from the current file's path
|
||||
local git_root = vim.fn.systemlist('git -C ' .. vim.fn.escape(current_dir, ' ') .. ' rev-parse --show-toplevel')[1]
|
||||
if vim.v.shell_error ~= 0 then
|
||||
@@ -215,7 +212,6 @@ return {
|
||||
end
|
||||
return git_root
|
||||
end
|
||||
|
||||
-- Custom live_grep function to search in git root
|
||||
local function live_grep_git_root()
|
||||
local git_root = find_git_root()
|
||||
@@ -225,9 +221,7 @@ return {
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
vim.api.nvim_create_user_command('LiveGrepGitRoot', live_grep_git_root, {})
|
||||
|
||||
-- See `:help telescope.builtin`
|
||||
vim.keymap.set('n', '<leader>/', function()
|
||||
-- You can pass additional configuration to telescope to change theme, layout, etc.
|
||||
@@ -236,7 +230,6 @@ return {
|
||||
previewer = false,
|
||||
})
|
||||
end, { desc = '[/] Fuzzily search in current buffer' })
|
||||
|
||||
local function telescope_live_grep_open_files()
|
||||
require('telescope.builtin').live_grep {
|
||||
grep_open_files = true,
|
||||
|
||||
Reference in New Issue
Block a user