Compare commits
1 commit
upgrade-20
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4b96003de4 |
10 changed files with 278 additions and 165 deletions
1
init.lua
1
init.lua
|
|
@ -1,4 +1,5 @@
|
||||||
vim.g.mapleader = " "
|
vim.g.mapleader = " "
|
||||||
|
vim.g.copilot_no_tab_map = true
|
||||||
|
|
||||||
require('plugins')
|
require('plugins')
|
||||||
require('lsp')
|
require('lsp')
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
-- local conform = require("conform")
|
local conform = require("conform")
|
||||||
|
|
||||||
local on_attach = function(client, bufnr)
|
local on_attach = function(client, bufnr)
|
||||||
if client.config.flags then
|
if client.config.flags then
|
||||||
|
|
@ -28,13 +28,13 @@ local on_attach = function(client, bufnr)
|
||||||
vim.keymap.set({ "n", "v" }, "<space>ca", vim.lsp.buf.code_action, opts)
|
vim.keymap.set({ "n", "v" }, "<space>ca", vim.lsp.buf.code_action, opts)
|
||||||
vim.keymap.set("n", "gr", vim.lsp.buf.references, opts)
|
vim.keymap.set("n", "gr", vim.lsp.buf.references, opts)
|
||||||
|
|
||||||
vim.keymap.set("n", "<space>f", function()
|
vim.keymap.set("n", "<space>F", function()
|
||||||
vim.lsp.buf.format({ async = true })
|
vim.lsp.buf.format({ async = true })
|
||||||
end, opts)
|
end, opts)
|
||||||
|
|
||||||
-- vim.keymap.set("n", "<space>f", function()
|
vim.keymap.set("n", "<space>f", function()
|
||||||
-- conform.format({ bufnr = bufnr })
|
conform.format({ bufnr = bufnr })
|
||||||
-- end, opts)
|
end, opts)
|
||||||
|
|
||||||
vim.keymap.set("i", "<C-n>", vim.lsp.completion.get, { desc = "trigger autocompletion" })
|
vim.keymap.set("i", "<C-n>", vim.lsp.completion.get, { desc = "trigger autocompletion" })
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -1,25 +1,25 @@
|
||||||
-- local cmp = require("cmp")
|
local cmp = require("cmp")
|
||||||
|
|
||||||
-- cmp.setup({
|
cmp.setup({
|
||||||
-- snippet = {
|
snippet = {
|
||||||
-- expand = function(args)
|
expand = function(args)
|
||||||
-- require("luasnip").lsp_expand(args.body) -- For `luasnip` users.
|
require("luasnip").lsp_expand(args.body) -- For `luasnip` users.
|
||||||
-- end,
|
end,
|
||||||
-- },
|
},
|
||||||
-- window = {
|
window = {
|
||||||
-- completion = cmp.config.window.bordered(),
|
completion = cmp.config.window.bordered(),
|
||||||
-- documentation = cmp.config.window.bordered(),
|
documentation = cmp.config.window.bordered(),
|
||||||
-- },
|
},
|
||||||
-- mapping = cmp.mapping.preset.insert({
|
mapping = cmp.mapping.preset.insert({
|
||||||
-- ["<C-b>"] = cmp.mapping.scroll_docs(-4),
|
["<C-b>"] = cmp.mapping.scroll_docs(-4),
|
||||||
-- ["<C-f>"] = cmp.mapping.scroll_docs(4),
|
["<C-f>"] = cmp.mapping.scroll_docs(4),
|
||||||
-- ["<CR>"] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
|
["<CR>"] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
|
||||||
-- }),
|
}),
|
||||||
|
|
||||||
-- sources = cmp.config.sources({
|
sources = cmp.config.sources({
|
||||||
-- { name = "nvim_lsp" },
|
{ name = "nvim_lsp" },
|
||||||
-- { name = "luasnip" }, -- For luasnip users.
|
{ name = "luasnip" }, -- For luasnip users.
|
||||||
-- }, {
|
}, {
|
||||||
-- { name = "buffer" },
|
{ name = "buffer" },
|
||||||
-- }),
|
}),
|
||||||
-- })
|
})
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
-- require("codecompanion").setup({
|
require("codecompanion").setup({
|
||||||
-- strategies = {
|
strategies = {
|
||||||
-- chat = {
|
chat = {
|
||||||
-- adapter = {
|
adapter = {
|
||||||
-- name = "copilot",
|
name = "copilot",
|
||||||
-- model = "claude-sonnet-4",
|
model = "claude-sonnet-4",
|
||||||
-- },
|
},
|
||||||
-- },
|
},
|
||||||
-- },
|
},
|
||||||
-- })
|
})
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
-- local formatter = require("conform")
|
local formatter = require("conform")
|
||||||
|
|
||||||
-- formatter.setup({
|
formatter.setup({
|
||||||
-- formatters_by_ft = {
|
formatters_by_ft = {
|
||||||
-- lua = { "stylua" },
|
lua = { "stylua" },
|
||||||
-- -- Use a sub-list to run only the first available formatter
|
-- Use a sub-list to run only the first available formatter
|
||||||
-- javascript = { "prettierd", "prettier" },
|
javascript = { "prettierd", "prettier" },
|
||||||
-- typescript = { "prettier" },
|
typescript = { "prettier" },
|
||||||
-- },
|
},
|
||||||
-- })
|
})
|
||||||
|
|
|
||||||
|
|
@ -1,32 +1,32 @@
|
||||||
-- local harpoon = require("harpoon")
|
local harpoon = require("harpoon")
|
||||||
|
|
||||||
-- harpoon:setup({})
|
harpoon:setup({})
|
||||||
|
|
||||||
-- vim.keymap.set("n", "<leader>hh", function() harpoon.ui:toggle_quick_menu(harpoon:list()) end)
|
vim.keymap.set("n", "<leader>hh", function() harpoon.ui:toggle_quick_menu(harpoon:list()) end)
|
||||||
-- vim.keymap.set("n", "<leader>h", function() harpoon:list():append() end)
|
vim.keymap.set("n", "<leader>h", function() harpoon:list():append() end)
|
||||||
|
|
||||||
-- vim.keymap.set("n", "<leader>1", function() harpoon:list():select(1) end)
|
vim.keymap.set("n", "<leader>1", function() harpoon:list():select(1) end)
|
||||||
-- vim.keymap.set("n", "<leader>2", function() harpoon:list():select(2) end)
|
vim.keymap.set("n", "<leader>2", function() harpoon:list():select(2) end)
|
||||||
-- vim.keymap.set("n", "<leader>3", function() harpoon:list():select(3) end)
|
vim.keymap.set("n", "<leader>3", function() harpoon:list():select(3) end)
|
||||||
-- vim.keymap.set("n", "<leader>4", function() harpoon:list():select(4) end)
|
vim.keymap.set("n", "<leader>4", function() harpoon:list():select(4) end)
|
||||||
-- vim.keymap.set("n", "<leader>5", function() harpoon:list():select(5) end)
|
vim.keymap.set("n", "<leader>5", function() harpoon:list():select(5) end)
|
||||||
-- vim.keymap.set("n", "<leader>6", function() harpoon:list():select(6) end)
|
vim.keymap.set("n", "<leader>6", function() harpoon:list():select(6) end)
|
||||||
-- vim.keymap.set("n", "<leader>7", function() harpoon:list():select(7) end)
|
vim.keymap.set("n", "<leader>7", function() harpoon:list():select(7) end)
|
||||||
-- vim.keymap.set("n", "<leader>8", function() harpoon:list():select(8) end)
|
vim.keymap.set("n", "<leader>8", function() harpoon:list():select(8) end)
|
||||||
-- vim.keymap.set("n", "<leader>9", function() harpoon:list():select(9) end)
|
vim.keymap.set("n", "<leader>9", function() harpoon:list():select(9) end)
|
||||||
|
|
||||||
-- vim.keymap.set("n", "<leader>d1", function() harpoon:list():removeAt(1) end)
|
vim.keymap.set("n", "<leader>d1", function() harpoon:list():removeAt(1) end)
|
||||||
-- vim.keymap.set("n", "<leader>d2", function() harpoon:list():removeAt(2) end)
|
vim.keymap.set("n", "<leader>d2", function() harpoon:list():removeAt(2) end)
|
||||||
-- vim.keymap.set("n", "<leader>d3", function() harpoon:list():removeAt(3) end)
|
vim.keymap.set("n", "<leader>d3", function() harpoon:list():removeAt(3) end)
|
||||||
-- vim.keymap.set("n", "<leader>d4", function() harpoon:list():removeAt(4) end)
|
vim.keymap.set("n", "<leader>d4", function() harpoon:list():removeAt(4) end)
|
||||||
-- vim.keymap.set("n", "<leader>d5", function() harpoon:list():removeAt(5) end)
|
vim.keymap.set("n", "<leader>d5", function() harpoon:list():removeAt(5) end)
|
||||||
-- vim.keymap.set("n", "<leader>d6", function() harpoon:list():removeAt(6) end)
|
vim.keymap.set("n", "<leader>d6", function() harpoon:list():removeAt(6) end)
|
||||||
-- vim.keymap.set("n", "<leader>d7", function() harpoon:list():removeAt(7) end)
|
vim.keymap.set("n", "<leader>d7", function() harpoon:list():removeAt(7) end)
|
||||||
-- vim.keymap.set("n", "<leader>d8", function() harpoon:list():removeAt(8) end)
|
vim.keymap.set("n", "<leader>d8", function() harpoon:list():removeAt(8) end)
|
||||||
-- vim.keymap.set("n", "<leader>d9", function() harpoon:list():removeAt(9) end)
|
vim.keymap.set("n", "<leader>d9", function() harpoon:list():removeAt(9) end)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-- -- Toggle previous & next buffers stored within Harpoon list
|
-- Toggle previous & next buffers stored within Harpoon list
|
||||||
-- vim.keymap.set("n", "<C-h>", function() harpoon:list():prev() end)
|
vim.keymap.set("n", "<C-h>", function() harpoon:list():prev() end)
|
||||||
-- vim.keymap.set("n", "<C-l>", function() harpoon:list():next() end)
|
vim.keymap.set("n", "<C-l>", function() harpoon:list():next() end)
|
||||||
|
|
|
||||||
|
|
@ -1,20 +1,20 @@
|
||||||
-- local configs = require("nvim-treesitter.configs")
|
local configs = require("nvim-treesitter.configs")
|
||||||
|
|
||||||
-- configs.setup({
|
configs.setup({
|
||||||
-- ensure_installed = {
|
ensure_installed = {
|
||||||
-- "c",
|
"c",
|
||||||
-- "lua",
|
"lua",
|
||||||
-- "vim",
|
"vim",
|
||||||
-- "vimdoc",
|
"vimdoc",
|
||||||
-- "query",
|
"query",
|
||||||
-- "elixir",
|
"elixir",
|
||||||
-- "heex",
|
"heex",
|
||||||
-- "javascript",
|
"javascript",
|
||||||
-- "html",
|
"html",
|
||||||
-- "css",
|
"css",
|
||||||
-- "typescript",
|
"typescript",
|
||||||
-- },
|
},
|
||||||
-- sync_install = false,
|
sync_install = false,
|
||||||
-- highlight = { enable = true },
|
highlight = { enable = true },
|
||||||
-- indent = { enable = true },
|
indent = { enable = true },
|
||||||
-- })
|
})
|
||||||
|
|
|
||||||
182
lua/plugins.lua
182
lua/plugins.lua
|
|
@ -1,68 +1,126 @@
|
||||||
vim.pack.add({
|
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||||
{ src = "https://github.com/gruvbox-community/gruvbox" },
|
|
||||||
{ src = "https://github.com/lewis6991/gitsigns.nvim" },
|
if not vim.loop.fs_stat(lazypath) then
|
||||||
{ src = "https://github.com/tpope/vim-commentary" },
|
vim.fn.system({
|
||||||
{ src = "https://github.com/stevearc/oil.nvim" },
|
"git",
|
||||||
{
|
"clone",
|
||||||
src = "https://github.com/folke/snacks.nvim",
|
"--filter=blob:none",
|
||||||
opts = {
|
"https://github.com/folke/lazy.nvim.git",
|
||||||
explorer = { enabled = true },
|
"--branch=stable", -- latest stable release
|
||||||
indent = { enabled = true },
|
lazypath,
|
||||||
input = { enabled = true },
|
})
|
||||||
picker = { enabled = true },
|
end
|
||||||
lazygit = { enabled = true },
|
|
||||||
},
|
vim.opt.rtp:prepend(lazypath)
|
||||||
},
|
|
||||||
{ src = "https://github.com/neovim/nvim-lspconfig" }, -- Required
|
require("lazy").setup({
|
||||||
{
|
{ "gruvbox-community/gruvbox" },
|
||||||
src = "https://github.com/williamboman/mason.nvim",
|
{ "lewis6991/gitsigns.nvim" },
|
||||||
build = function()
|
{ "tpope/vim-commentary" },
|
||||||
pcall(vim.cmd, "MasonUpdate")
|
{ "tpope/vim-surround" },
|
||||||
end,
|
{ "sphamba/smear-cursor.nvim", opts = {}, },
|
||||||
},
|
{
|
||||||
{ src = "https://github.com/williamboman/mason-lspconfig.nvim" }, -- Optional
|
"folke/snacks.nvim",
|
||||||
-- {
|
priority = 1000,
|
||||||
-- src = "https://github.com/ThePrimeagen/harpoon",
|
lazy = false,
|
||||||
-- branch = "harpoon2",
|
opts = {
|
||||||
-- },
|
-- bigfile = { enabled = true },
|
||||||
-- {
|
-- dashboard = { enabled = true },
|
||||||
-- src = "https://github.com/iamcco/markdown-preview.nvim",
|
-- explorer = { enabled = true },
|
||||||
-- cmd = { "MarkdownPreviewToggle", "MarkdownPreview", "MarkdownPreviewStop" },
|
-- animate = { enabled = true },
|
||||||
-- ft = { "markdown" },
|
explorer = { enabled = true },
|
||||||
-- build = function()
|
indent = { enabled = true },
|
||||||
-- vim.fn["mkdp#util#install"]()
|
input = { enabled = true },
|
||||||
-- end,
|
picker = { enabled = true },
|
||||||
-- },
|
-- notifier = { enabled = true },
|
||||||
-- { src = "https://github.com/mhinz/vim-startify" },
|
-- quickfile = { enabled = true },
|
||||||
-- {
|
-- scope = { enabled = true },
|
||||||
-- src = "https://github.com/kristijanhusak/vim-dadbod-ui",
|
scroll = { enabled = true },
|
||||||
-- dependencies = {
|
statuscolumn = { enabled = true },
|
||||||
-- { "tpope/vim-dadbod", lazy = true },
|
-- words = { enabled = true },
|
||||||
-- { "kristijanhusak/vim-dadbod-completion", ft = { "sql", "mysql", "plsql" }, lazy = true },
|
lazygit = { enabled = true },
|
||||||
-- },
|
},
|
||||||
-- cmd = {
|
},
|
||||||
-- "DBUI",
|
{
|
||||||
-- "DBUIToggle",
|
"MeanderingProgrammer/render-markdown.nvim",
|
||||||
-- "DBUIAddConnection",
|
ft = { "markdown", "codecompanion" },
|
||||||
-- "DBUIFindBuffer",
|
},
|
||||||
-- },
|
{
|
||||||
-- init = function()
|
"nvim-treesitter/nvim-treesitter",
|
||||||
-- -- Your DBUI configuration
|
build = ":TSUpdate",
|
||||||
-- vim.g.db_ui_use_nerd_fonts = 1
|
},
|
||||||
-- end,
|
{ "neovim/nvim-lspconfig" }, -- Required
|
||||||
-- },
|
{ -- Optional
|
||||||
-- {
|
"williamboman/mason.nvim",
|
||||||
-- src = "https://github.com/olimorris/codecompanion.nvim",
|
build = function()
|
||||||
-- dependencies = {
|
pcall(vim.cmd, "MasonUpdate")
|
||||||
-- "nvim-lua/plenary.nvim",
|
end,
|
||||||
-- "nvim-treesitter/nvim-treesitter",
|
},
|
||||||
-- },
|
{ "williamboman/mason-lspconfig.nvim" }, -- Optional
|
||||||
-- },
|
{
|
||||||
|
"stevearc/conform.nvim",
|
||||||
|
},
|
||||||
|
-- Autocompletion
|
||||||
|
{ "hrsh7th/nvim-cmp" }, -- Required
|
||||||
|
{ "hrsh7th/cmp-nvim-lsp" }, -- Required
|
||||||
|
{ "L3MON4D3/LuaSnip" }, -- Required
|
||||||
|
-- roslyn
|
||||||
|
{
|
||||||
|
"seblyng/roslyn.nvim",
|
||||||
|
ft = "cs",
|
||||||
|
opts = {
|
||||||
|
-- your configuration comes here; leave empty for default settings
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"stevearc/oil.nvim",
|
||||||
|
opts = {},
|
||||||
|
dependencies = { { "echasnovski/mini.icons", opts = {} } },
|
||||||
|
lazy = false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"ThePrimeagen/harpoon",
|
||||||
|
branch = "harpoon2",
|
||||||
|
dependencies = { "nvim-lua/plenary.nvim" },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"iamcco/markdown-preview.nvim",
|
||||||
|
cmd = { "MarkdownPreviewToggle", "MarkdownPreview", "MarkdownPreviewStop" },
|
||||||
|
ft = { "markdown" },
|
||||||
|
build = function()
|
||||||
|
vim.fn["mkdp#util#install"]()
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
{ "mhinz/vim-startify" },
|
||||||
|
{
|
||||||
|
"kristijanhusak/vim-dadbod-ui",
|
||||||
|
dependencies = {
|
||||||
|
{ "tpope/vim-dadbod", lazy = true },
|
||||||
|
{ "kristijanhusak/vim-dadbod-completion", ft = { "sql", "mysql", "plsql" }, lazy = true },
|
||||||
|
},
|
||||||
|
cmd = {
|
||||||
|
"DBUI",
|
||||||
|
"DBUIToggle",
|
||||||
|
"DBUIAddConnection",
|
||||||
|
"DBUIFindBuffer",
|
||||||
|
},
|
||||||
|
init = function()
|
||||||
|
-- Your DBUI configuration
|
||||||
|
vim.g.db_ui_use_nerd_fonts = 1
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"olimorris/codecompanion.nvim",
|
||||||
|
dependencies = {
|
||||||
|
"nvim-lua/plenary.nvim",
|
||||||
|
"nvim-treesitter/nvim-treesitter",
|
||||||
|
},
|
||||||
|
},
|
||||||
}, opts)
|
}, opts)
|
||||||
|
|
||||||
local files = vim.split(vim.fn.globpath(vim.fn.stdpath("config") .. "/lua/plugin", "*.lua", true), "\n")
|
local files = vim.split(vim.fn.globpath(vim.fn.stdpath("config") .. "/lua/plugin", "*.lua", true), "\n")
|
||||||
|
|
||||||
for _, f in ipairs(files) do
|
for _, f in ipairs(files) do
|
||||||
local name = vim.fn.fnamemodify(f, ":t:r")
|
local name = vim.fn.fnamemodify(f, ":t:r")
|
||||||
require("plugin." .. name)
|
require("plugin." .. name)
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,16 @@
|
||||||
vim.keymap.set("n", "<leader>kk", "<CMD>Oil<CR>", { desc = "Open parent directory" })
|
vim.keymap.set("n", "<leader>kk", "<CMD>Oil<CR>", { desc = "Open parent directory" })
|
||||||
|
|
||||||
|
-- jk to escape
|
||||||
|
vim.keymap.set("i", "jk", "<Esc>")
|
||||||
|
|
||||||
|
-- allow moving line / lines in all modes with M-j/k
|
||||||
|
vim.keymap.set("n", "<M-j>", ":m .+1<CR>==")
|
||||||
|
vim.keymap.set("n", "<M-k>", ":m .-2<CR>==")
|
||||||
|
vim.keymap.set("i", "<M-j>", "<Esc>:m .+1<CR>==gi")
|
||||||
|
vim.keymap.set("i", "<M-k>", "<Esc>:m .-2<CR>==gi")
|
||||||
|
vim.keymap.set("v", "<M-j>", ":m '>+1<CR>gv=gv")
|
||||||
|
vim.keymap.set("v", "<M-k>", ":m '<-2<CR>gv=gv")
|
||||||
|
|
||||||
-- C-x to close buffer
|
-- C-x to close buffer
|
||||||
vim.keymap.set("n", "<C-x>", ":bd<CR>")
|
vim.keymap.set("n", "<C-x>", ":bd<CR>")
|
||||||
|
|
||||||
|
|
@ -17,3 +28,8 @@ vim.keymap.set("n", "<leader>tc", ":tabc<CR>")
|
||||||
|
|
||||||
-- copy current file path
|
-- copy current file path
|
||||||
vim.keymap.set("n", "<leader>cp", ":let @+ = expand('%')<CR>")
|
vim.keymap.set("n", "<leader>cp", ":let @+ = expand('%')<CR>")
|
||||||
|
|
||||||
|
-- code companion
|
||||||
|
vim.keymap.set({"n", "v"}, "<leader>cc", ":CodeCompanionChat Toggle<CR>")
|
||||||
|
vim.keymap.set("v", "<leader>acc", "<cmd>CodeCompanionChat Add<cr>")
|
||||||
|
|
||||||
|
|
|
||||||
62
lua/set.lua
62
lua/set.lua
|
|
@ -33,15 +33,53 @@ vim.opt.updatetime = 50
|
||||||
-- use system clipboard
|
-- use system clipboard
|
||||||
vim.opt.clipboard = "unnamedplus"
|
vim.opt.clipboard = "unnamedplus"
|
||||||
|
|
||||||
-- vim.g.clipboard = {
|
vim.g.clipboard = {
|
||||||
-- name = "win32yank-wsl",
|
name = "win32yank-wsl",
|
||||||
-- copy = {
|
copy = {
|
||||||
-- ["+"] = "win32yank.exe -i --crlf",
|
["+"] = "win32yank.exe -i --crlf",
|
||||||
-- ["*"] = "win32yank.exe -i --crlf"
|
["*"] = "win32yank.exe -i --crlf"
|
||||||
-- },
|
},
|
||||||
-- paste = {
|
paste = {
|
||||||
-- ["+"] = "win32yank.exe -o --crlf",
|
["+"] = "win32yank.exe -o --crlf",
|
||||||
-- ["*"] = "win32yank.exe -o --crlf"
|
["*"] = "win32yank.exe -o --crlf"
|
||||||
-- },
|
},
|
||||||
-- cache_enable = 0,
|
cache_enable = 0,
|
||||||
-- }
|
}
|
||||||
|
|
||||||
|
local function fzf_open_terminal()
|
||||||
|
local tmp = vim.fn.tempname()
|
||||||
|
local cwd = vim.fn.getcwd()
|
||||||
|
|
||||||
|
local rg = [[rg --files --hidden --glob "!.git/**" --glob "!node_modules/**" --glob "!.angular/**"]]
|
||||||
|
local awk = [[awk -F'/' '{dir = (NF>1 ? substr($0, 1, length($0)-length($NF)-1) : "."); printf("%s [%s]\t%s\n", $NF, dir, $0)}']]
|
||||||
|
local inner = string.format("cd %s && %s | %s | fzf --height 40%% > %s",
|
||||||
|
vim.fn.shellescape(cwd), rg, awk, vim.fn.shellescape(tmp))
|
||||||
|
|
||||||
|
vim.cmd('belowright split')
|
||||||
|
local bufnr = vim.api.nvim_create_buf(false, true)
|
||||||
|
vim.api.nvim_win_set_buf(0, bufnr)
|
||||||
|
|
||||||
|
-- pass argv form to avoid fish parsing issues
|
||||||
|
vim.fn.termopen({'bash', '-ic', inner}, {
|
||||||
|
on_exit = function()
|
||||||
|
local lines = vim.fn.readfile(tmp)
|
||||||
|
os.remove(tmp)
|
||||||
|
if #lines == 0 then
|
||||||
|
vim.schedule(function()
|
||||||
|
if vim.api.nvim_buf_is_valid(bufnr) then vim.api.nvim_buf_delete(bufnr, {force=true}) end
|
||||||
|
end)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
local sel = lines[1]:match("\t(.*)$") or lines[1]
|
||||||
|
vim.schedule(function()
|
||||||
|
|
||||||
|
if vim.api.nvim_buf_is_valid(bufnr) then vim.api.nvim_buf_delete(bufnr, {force=true}) end
|
||||||
|
vim.cmd('edit ' .. vim.fn.fnameescape(sel))
|
||||||
|
end)
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
vim.cmd('startinsert')
|
||||||
|
end
|
||||||
|
|
||||||
|
vim.keymap.set('n', '<leader>o', fzf_open_terminal, {noremap=true, silent=true})
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue