diff options
Diffstat (limited to 'mac')
4 files changed, 227 insertions, 150 deletions
diff --git a/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/lf.lua b/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/lf.lua deleted file mode 100644 index 3f82222..0000000 --- a/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/lf.lua +++ /dev/null @@ -1,121 +0,0 @@ -return { - "lmburns/lf.nvim", - dependencies = { - { - "akinsho/toggleterm.nvim", - version = "*", - config = function() - require("toggleterm").setup({ - open_mapping = [[<leader><c-s>]], -- or { [[<c-\>]], [[<c-¥>]] } if you also use a Japanese keyboard. - }) - vim.keymap.set( - "n", - "<leader><C-\\>", - "<Cmd>ToggleTerm direction=float name=Terminal<cr>", - { desc = "Toggle float terminal" } - ) - vim.keymap.set( - "n", - "<leader><C-t>", - "<Cmd>ToggleTermToggleAll<cr>", - { desc = "Toggle all float terminals" } - ) - vim.keymap.set("n", "<leader><C-u>", "<Cmd>TermSelect<cr>", { desc = "Select float terminal" }) - - local function set_opfunc(opfunc) - _G._opfunc = opfunc -- Define the function globally - vim.go.operatorfunc = "v:lua._opfunc" -- Assign the global function - end - - local trim_spaces = false - vim.keymap.set("v", "<leader><C-l>", function() - require("toggleterm").send_lines_to_terminal("single_line", trim_spaces, { args = vim.v.count }) - end, { desc = "Send line to terminal" }) - -- Replace with these for the other two options - -- require("toggleterm").send_lines_to_terminal("visual_lines", trim_spaces, { args = vim.v.count }) - -- require("toggleterm").send_lines_to_terminal("visual_selection", trim_spaces, { args = vim.v.count }) - - -- For use as an operator map: - -- Send motion to terminal - vim.keymap.set("n", "<leader><C-l>", function() - set_opfunc(function(motion_type) - require("toggleterm").send_lines_to_terminal(motion_type, false, { args = vim.v.count }) - end) - vim.api.nvim_feedkeys("g@", "n", false) - end, { desc = "Send motions to terminal" }) - -- Double the command to send line to terminal - vim.keymap.set("n", "<leader><C-a>", function() - set_opfunc(function(motion_type) - require("toggleterm").send_lines_to_terminal(motion_type, false, { args = vim.v.count }) - end) - vim.api.nvim_feedkeys("g@_", "n", false) - end, { desc = "Send double command to terminal" }) - -- Send whole file - vim.keymap.set("n", "<leader><C-g>", function() - set_opfunc(function(motion_type) - require("toggleterm").send_lines_to_terminal(motion_type, false, { args = vim.v.count }) - end) - vim.api.nvim_feedkeys("ggg@G''", "n", false) - end, { desc = "Send whole file to terminal (clipboard)" }) - end, - }, - }, - config = function() - vim.g.lf_netrw = 1 - local fn = vim.fn - - -- Defaults - require("lf").setup({ - default_action = "drop", -- Default action when `Lf` opens a file - default_actions = { - ["e"] = "tabedit", - ["<C-t>"] = "tab drop", - ["<C-v>"] = "vsplit", - ["<C-x>"] = "split", - }, - winblend = 0, -- Pseudotransparency level - direction = "float", -- Window type - border = "rounded", -- Border kind - height = fn.float2nr(fn.round(0.75 * vim.o.lines)), -- Height of the *floating* window - width = fn.float2nr(fn.round(0.75 * vim.o.columns)), -- Width of the *floating* window - escape_quit = true, -- Map escape to the quit command - focus_on_open = true, -- Focus the current file when opening Lf - mappings = true, -- Enable terminal buffer mapping - tmux = true, -- Tmux statusline can be disabled - disable_netrw_warning = true, -- Don't display a message when opening a directory - highlights = { - Normal = { link = "Normal" }, -- Use normal highlighting - NormalFloat = { link = "NormalFloat" }, -- Use float highlighting - FloatBorder = { link = "@constant" }, -- Use constant highlighting - }, - - -- Layout configurations - layout_mapping = "<M-r>", -- Resize window with this key - views = { - { width = 0.800, height = 0.800 }, - { width = 0.600, height = 0.600 }, - { width = 0.950, height = 0.950 }, - { width = 0.500, height = 0.500, col = 0, row = 0 }, - { width = 0.500, height = 0.500, col = 0, row = 0.5 }, - { width = 0.500, height = 0.500, col = 0.5, row = 0 }, - { width = 0.500, height = 0.500, col = 0.5, row = 0.5 }, - }, - }) - - vim.keymap.set("n", "<leader>el", "<Cmd>Lf<CR>") - - -- Autocommand to set key mapping in terminal buffer - vim.api.nvim_create_autocmd("User", { - pattern = "LfTermEnter", - callback = function(a) - vim.api.nvim_buf_set_keymap( - a.buf, - "t", - "q", - "<Cmd>q<CR>", - { nowait = true, noremap = true, silent = true } - ) - end, - }) - end, -} diff --git a/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/lsp.lua b/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/lsp.lua index 4520597..b7b5812 100644 --- a/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/lsp.lua +++ b/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/lsp.lua @@ -101,7 +101,6 @@ return { -- "mutt_ls", "pyright", "ruff", - "sqls", "ts_ls", }, automatic_enable = true, @@ -213,11 +212,6 @@ return { -- }, }) end, - ["sqls"] = function() - lspconfig.sqls.setup({ - capabilities = capabilities, - }) - end, ["ts_ls"] = function() lspconfig.ruff.setup({ capabilities = capabilities, @@ -236,10 +230,6 @@ return { svelte = { "eslint_d" }, python = { "pylint" }, sh = { "shellcheck" }, - sql = { "sqlfluff" }, - svelte = { "eslint_d" }, - typescript = { "eslint_d" }, - typescriptreact = { "eslint_d" }, } local lint_augroup = vim.api.nvim_create_augroup("lint", { clear = true }) @@ -267,8 +257,6 @@ return { "ruff", -- python formatter "shellcheck", -- bash lint "shfmt", -- sh formatter - "sqlfluff", -- sql linter - "sql-formatter", -- sql formatter "stylua", -- lua formatter }, integrations = { @@ -347,7 +335,6 @@ return { markdown = { "prettier" }, python = { "ruff", "isort", "black" }, sh = { "shfmt" }, - sql = { "sql-formatter" }, svelte = { "prettier" }, -- typescript = { "prettier" }, -- typescriptreact = { "prettier" }, @@ -361,19 +348,7 @@ return { if vim.g.disable_autoformat or vim.b[bufnr].disable_autoformat then return end - local ft = vim.bo[bufnr].filetype - local off = { - javascript = true, - typescript = true, - javascriptreact = true, - typescriptreact = true, - json = true, - css = true, - } - if off[ft] then - return false - end - return { lsp_fallback = true, timeout_ms = 1000, async = false } + return { lsp_format = "fallback", timeout_ms = 1000, async = false } end, }) diff --git a/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/neo-tree.lua b/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/neo-tree.lua index c190df5..c05716d 100644 --- a/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/neo-tree.lua +++ b/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/neo-tree.lua @@ -31,8 +31,8 @@ return { ---@module "neo-tree" ---@type neotree.Config? opts = { - hijack_netrw_behavior = "disabled", -- netrw disabled, opening a directory opens neo-tree filesystem = { + hijack_netrw_behavior = "disabled", -- open_default, open_current follow_current_file = { enabled = false }, commands = { -- over write default 'delete' command to 'trash'. diff --git a/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/yazi.lua b/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/yazi.lua index 972ae71..b41ee24 100644 --- a/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/yazi.lua +++ b/mac/.config/TheSiahxyz/lua/TheSiahxyz/plugins/yazi.lua @@ -4,6 +4,64 @@ return { event = "VeryLazy", dependencies = { { "nvim-lua/plenary.nvim", lazy = true }, + { + "akinsho/toggleterm.nvim", + version = "*", + config = function() + require("toggleterm").setup({ + open_mapping = [[<leader><c-s>]], -- or { [[<c-\>]], [[<c-¥>]] } if you also use a Japanese keyboard. + }) + vim.keymap.set( + "n", + "<leader><C-\\>", + "<Cmd>ToggleTerm direction=float name=Terminal<cr>", + { desc = "Toggle float terminal" } + ) + vim.keymap.set( + "n", + "<leader><C-t>", + "<Cmd>ToggleTermToggleAll<cr>", + { desc = "Toggle all float terminals" } + ) + vim.keymap.set("n", "<leader><C-u>", "<Cmd>TermSelect<cr>", { desc = "Select float terminal" }) + + local function set_opfunc(opfunc) + _G._opfunc = opfunc -- Define the function globally + vim.go.operatorfunc = "v:lua._opfunc" -- Assign the global function + end + + local trim_spaces = false + vim.keymap.set("v", "<leader><C-l>", function() + require("toggleterm").send_lines_to_terminal("single_line", trim_spaces, { args = vim.v.count }) + end, { desc = "Send line to terminal" }) + -- Replace with these for the other two options + -- require("toggleterm").send_lines_to_terminal("visual_lines", trim_spaces, { args = vim.v.count }) + -- require("toggleterm").send_lines_to_terminal("visual_selection", trim_spaces, { args = vim.v.count }) + + -- For use as an operator map: + -- Send motion to terminal + vim.keymap.set("n", "<leader><C-l>", function() + set_opfunc(function(motion_type) + require("toggleterm").send_lines_to_terminal(motion_type, false, { args = vim.v.count }) + end) + vim.api.nvim_feedkeys("g@", "n", false) + end, { desc = "Send motions to terminal" }) + -- Double the command to send line to terminal + vim.keymap.set("n", "<leader><C-a>", function() + set_opfunc(function(motion_type) + require("toggleterm").send_lines_to_terminal(motion_type, false, { args = vim.v.count }) + end) + vim.api.nvim_feedkeys("g@_", "n", false) + end, { desc = "Send double command to terminal" }) + -- Send whole file + vim.keymap.set("n", "<leader><C-g>", function() + set_opfunc(function(motion_type) + require("toggleterm").send_lines_to_terminal(motion_type, false, { args = vim.v.count }) + end) + vim.api.nvim_feedkeys("ggg@G''", "n", false) + end, { desc = "Send whole file to terminal (clipboard)" }) + end, + }, }, keys = { { @@ -26,10 +84,175 @@ return { }, ---@type YaziConfig | {} opts = { - -- if you want to open yazi instead of netrw, see below for more info + -- Below is the default configuration. It is optional to set these values. + -- You can customize the configuration for each yazi call by passing it to + -- yazi() explicitly + + -- enable this if you want to open yazi instead of netrw. + -- Note that if you enable this, you need to call yazi.setup() to + -- initialize the plugin. lazy.nvim does this for you in certain cases. + -- + -- If you are also using neotree, you may prefer not to bring it up when + -- opening a directory: + -- { + -- "nvim-neo-tree/neo-tree.nvim", + -- opts = { + -- filesystem = { + -- hijack_netrw_behavior = "disabled", + -- }, + -- }, + -- } open_for_directories = false, + + -- open visible splits and quickfix items as yazi tabs for easy navigation + -- https://github.com/mikavilpas/yazi.nvim/pull/359 + open_multiple_tabs = false, + + -- when yazi is closed with no file chosen, change the Neovim working + -- directory to the directory that yazi was in before it was closed. Defaults + -- to being off (`false`) + change_neovim_cwd_on_close = false, + + highlight_groups = { + -- See https://github.com/mikavilpas/yazi.nvim/pull/180 + hovered_buffer = nil, + -- See https://github.com/mikavilpas/yazi.nvim/pull/351 + hovered_buffer_in_same_directory = nil, + }, + + -- the floating window scaling factor. 1 means 100%, 0.9 means 90%, etc. + floating_window_scaling_factor = 0.8, + + -- the transparency of the yazi floating window (0-100). See :h winblend + yazi_floating_window_winblend = 0, + + -- the type of border to use for the floating window. Can be many values, + -- including 'none', 'rounded', 'single', 'double', 'shadow', etc. For + -- more information, see :h nvim_open_win + yazi_floating_window_border = "single", + + -- the zindex of the yazi floating window. Can be used to make the yazi + -- window fullscreen. See `:h nvim_open_win()` for more information. + yazi_floating_window_zindex = nil, + + -- the log level to use. Off by default, but can be used to diagnose + -- issues. You can find the location of the log file by running + -- `:checkhealth yazi` in Neovim. Also check out the "reproducing issues" + -- section below + log_level = vim.log.levels.OFF, + + -- what Neovim should do a when a file was opened (selected) in yazi. + -- Defaults to simply opening the file. + open_file_function = function(chosen_file, config, state) end, + + -- customize the keymaps that are active when yazi is open and focused. The + -- defaults are listed below. Note that the keymaps simply hijack input and + -- they are never sent to yazi, so only try to map keys that are never + -- needed by yazi. + -- + -- Also: + -- - use e.g. `open_file_in_tab = false` to disable a keymap + -- - you can customize only some of the keymaps (not all of them) + -- - you can opt out of all keymaps by setting `keymaps = false` keymaps = { show_help = "<f1>", + open_file_in_vertical_split = "<c-v>", + open_file_in_horizontal_split = "<c-x>", + open_file_in_tab = "<c-t>", + grep_in_directory = "<c-s>", + replace_in_directory = "<c-g>", + cycle_open_buffers = "<tab>", + copy_relative_path_to_selected_files = "<c-y>", + send_to_quickfix_list = "<c-q>", + change_working_directory = "<c-\\>", + open_and_pick_window = "<c-o>", + }, + + -- completely override the keymappings for yazi. This function will be + -- called in the context of the yazi terminal buffer. + set_keymappings_function = function(yazi_buffer_id, config, context) end, + + -- some yazi.nvim commands copy text to the clipboard. This is the register + -- yazi.nvim should use for copying. Defaults to "*", the system clipboard + clipboard_register = "*", + + hooks = { + -- if you want to execute a custom action when yazi has been opened, + -- you can define it here. + yazi_opened = function(preselected_path, yazi_buffer_id, config) + -- you can optionally modify the config for this specific yazi + -- invocation if you want to customize the behaviour + end, + + -- when yazi was successfully closed + yazi_closed_successfully = function(chosen_file, config, state) end, + + -- when yazi opened multiple files. The default is to send them to the + -- quickfix list, but if you want to change that, you can define it here + yazi_opened_multiple_files = function(chosen_files, config, state) end, + + -- This function is called when yazi is ready to process events. + on_yazi_ready = function(buffer, config, process_api) end, + }, + + -- highlight buffers in the same directory as the hovered buffer + highlight_hovered_buffers_in_same_directory = true, + + integrations = { + --- What should be done when the user wants to grep in a directory + grep_in_directory = function(directory) + -- the default implementation uses telescope if available, otherwise nothing + end, + + grep_in_selected_files = function(selected_files) + -- similar to grep_in_directory, but for selected files + end, + + --- Similarly, search and replace in the files in the directory + replace_in_directory = function(directory) + -- default: grug-far.nvim + end, + + replace_in_selected_files = function(selected_files) + -- default: grug-far.nvim + end, + + -- `grealpath` on OSX, (GNU) `realpath` otherwise + resolve_relative_path_application = "", + + -- the way to resolve relative paths. The default_implementation can be + -- customized with a function. See + -- documentation/copy-relative-path-to-files.md for more information. + resolve_relative_path_implementation = function(args, get_relative_path) end, + + -- how to delete (close) a buffer. Defaults to a bundled version of + -- `snacks.bufdelete`, copied from https://github.com/folke/snacks.nvim, + -- which maintains the window layout. See the `types.lua` file for more + -- information for the available options. + bufdelete_implementation = "bundled-snacks", + + -- add an action to a file picker to copy the relative path to the + -- selected file(s). The implementation is the same as for the + -- `copy_relative_path_to_selected_files` yazi.nvim keymap. Currently + -- only snacks.nvim is supported. Documentation can be found in the + -- keybindings section of the readme. + -- + -- available options: + -- - nil (default, no action added) + -- - "snacks.picker" (snacks.nvim) + picker_add_copy_relative_path_action = nil, + }, + + future_features = { + -- use a file to store the last directory that yazi was in before it was + -- closed. Defaults to `true`. + use_cwd_file = true, + + -- use a new shell escaping implementation that is more robust and works + -- on more platforms. Defaults to `true`. If set to `false`, the old + -- shell escaping implementation will be used, which is less robust and + -- may not work on all platforms. + new_shell_escaping = true, }, }, -- 👇 if you use `open_for_directories=true`, this is recommended @@ -37,7 +260,7 @@ return { -- mark netrw as loaded so it's not loaded at all. -- -- More details: https://github.com/mikavilpas/yazi.nvim/issues/802 - vim.g.loaded_netrwPlugin = 1 + -- vim.g.loaded_netrwPlugin = 1 local wk = require("which-key") wk.add({ mode = { "n" }, |
