mirror of
https://github.com/pojokcodeid/nvim-lazy.git
synced 2025-06-24 09:48:51 +02:00
fix: support neovim v0.10
This commit is contained in:
parent
f00aeb3add
commit
5179bb1047
13 changed files with 515 additions and 513 deletions
|
@ -1,6 +0,0 @@
|
|||
column_width = 120
|
||||
line_endings = "Unix"
|
||||
indent_type = "Spaces"
|
||||
indent_width = 2
|
||||
quote_style = "AutoPreferDouble"
|
||||
no_call_parentheses = true
|
|
@ -2,7 +2,7 @@
|
|||
"Comment.nvim": { "branch": "master", "commit": "e51f2b142d88bb666dcaa77d93a07f4b419aca70" },
|
||||
"LuaSnip": { "branch": "master", "commit": "03c8e67eb7293c404845b3982db895d59c0d1538" },
|
||||
"alpha-nvim": { "branch": "main", "commit": "41283fb402713fc8b327e60907f74e46166f4cfd" },
|
||||
"bufferline.nvim": { "branch": "main", "commit": "0dfc19b7a15a3bc47b975fcffde03859c46dd097" },
|
||||
"bufferline.nvim": { "branch": "main", "commit": "73edc1f2732678e7a681e3d3be49782610914f6b" },
|
||||
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
|
||||
"cmp-cmdline": { "branch": "main", "commit": "d250c63aa13ead745e3a40f61fdd3470efde3923" },
|
||||
"cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" },
|
||||
|
@ -15,7 +15,7 @@
|
|||
"friendly-snippets": { "branch": "main", "commit": "dd2fd1281d4b22e7b4a5bfafa3e142d958e251f2" },
|
||||
"gitsigns.nvim": { "branch": "main", "commit": "76927d14d3fbd4ba06ccb5246e79d93b5442c188" },
|
||||
"indent-blankline.nvim": { "branch": "master", "commit": "ece00d5fb44d196680a81fd2761062d2fa44663b" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "758bb5de98b805acc5eeed8cdc8ac7f0bc4b0b86" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "8f19915175395680808de529e4220da8dafc0759" },
|
||||
"lsp-progress.nvim": { "branch": "main", "commit": "55a04895ea20c365b670051a3128265d43bdfa3d" },
|
||||
"lualine.nvim": { "branch": "master", "commit": "0a5a66803c7407767b799067986b4dc3036e1983" },
|
||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "9ae570e206360e47d30b4c35a4550c165f4ea7b7" },
|
||||
|
@ -39,7 +39,7 @@
|
|||
"nvim-tree.lua": { "branch": "master", "commit": "2bc725a3ebc23f0172fb0ab4d1134b81bcc13812" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "73fb37ed77b18ac357ca8e6e35835a8db6602332" },
|
||||
"nvim-treesitter-textobjects": { "branch": "master", "commit": "5f9bf4b1ead7707e4e74e5319ee56bdc81fb73db" },
|
||||
"nvim-ts-autotag": { "branch": "main", "commit": "6f38e4231c34497259121a007c61a0fd2f16403e" },
|
||||
"nvim-ts-autotag": { "branch": "main", "commit": "62db4b3054ec6847e5cb189b4dea452ce0c7ad7f" },
|
||||
"nvim-ts-context-commentstring": { "branch": "main", "commit": "cbab9ad88036915beebd13b47e100743ff2ed2d5" },
|
||||
"nvim-ufo": { "branch": "main", "commit": "a5390706f510d39951dd581f6d2a972741b3fa26" },
|
||||
"nvim-web-devicons": { "branch": "master", "commit": "5b9067899ee6a2538891573500e8fd6ff008440f" },
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
require("custom.default")
|
||||
require("custom.dashboard")
|
||||
require("config.lazy")
|
||||
require("config.lazy_lib")
|
||||
require("user.colorscheme")
|
||||
require("user.keymaps")
|
||||
-- require("user.snip")
|
||||
|
|
|
@ -37,7 +37,7 @@ return {
|
|||
lazy = true,
|
||||
},
|
||||
config = function()
|
||||
require("user.lsp.null-ls")
|
||||
require("user.lsp.null-lscfg")
|
||||
end,
|
||||
},
|
||||
event = "InsertEnter",
|
||||
|
|
|
@ -1,74 +1,76 @@
|
|||
local status_ok, chatgpt = pcall(require, "chatgpt")
|
||||
if not status_ok then
|
||||
return
|
||||
return
|
||||
end
|
||||
|
||||
chatgpt.setup({
|
||||
welcome_message = WELCOME_MESSAGE, -- set to "" if you don't like the fancy godot robot
|
||||
loading_text = "loading",
|
||||
question_sign = "", -- you can use emoji if you want e.g. 🙂
|
||||
answer_sign = "ﮧ", -- 🤖
|
||||
max_line_length = 120,
|
||||
yank_register = "+",
|
||||
chat_layout = {
|
||||
relative = "editor",
|
||||
position = "50%",
|
||||
size = {
|
||||
height = "80%",
|
||||
width = "80%",
|
||||
},
|
||||
},
|
||||
settings_window = {
|
||||
border = {
|
||||
style = "rounded",
|
||||
text = {
|
||||
top = " Settings ",
|
||||
},
|
||||
},
|
||||
},
|
||||
chat_window = {
|
||||
filetype = "chatgpt",
|
||||
border = {
|
||||
highlight = "FloatBorder",
|
||||
style = "rounded",
|
||||
text = {
|
||||
top = " ChatGPT ",
|
||||
},
|
||||
},
|
||||
},
|
||||
chat_input = {
|
||||
prompt = " ",
|
||||
border = {
|
||||
highlight = "FloatBorder",
|
||||
style = "rounded",
|
||||
text = {
|
||||
top_align = "center",
|
||||
top = " Prompt ",
|
||||
},
|
||||
},
|
||||
},
|
||||
openai_params = {
|
||||
model = "text-davinci-003",
|
||||
frequency_penalty = 0,
|
||||
presence_penalty = 0,
|
||||
max_tokens = 300,
|
||||
temperature = 0,
|
||||
top_p = 1,
|
||||
n = 1,
|
||||
},
|
||||
openai_edit_params = {
|
||||
model = "code-davinci-edit-001",
|
||||
temperature = 0,
|
||||
top_p = 1,
|
||||
n = 1,
|
||||
},
|
||||
keymaps = {
|
||||
close = { "<C-c>", "<Esc>" },
|
||||
yank_last = "<C-y>",
|
||||
scroll_up = "<C-u>",
|
||||
scroll_down = "<C-d>",
|
||||
toggle_settings = "<C-o>",
|
||||
new_session = "<C-n>",
|
||||
cycle_windows = "<Tab>",
|
||||
},
|
||||
})
|
||||
local WELCOME_MESSAGE = [[
|
||||
Welcome to ChatGPT.
|
||||
]]
|
||||
chatgpt.setup {
|
||||
welcome_message = WELCOME_MESSAGE, -- set to "" if you don't like the fancy godot robot
|
||||
loading_text = "loading",
|
||||
question_sign = "", -- you can use emoji if you want e.g. 🙂
|
||||
answer_sign = "ﮧ", -- 🤖
|
||||
max_line_length = 120,
|
||||
yank_register = "+",
|
||||
chat_layout = {
|
||||
relative = "editor",
|
||||
position = "50%",
|
||||
size = {
|
||||
height = "80%",
|
||||
width = "80%",
|
||||
},
|
||||
},
|
||||
settings_window = {
|
||||
border = {
|
||||
style = "rounded",
|
||||
text = {
|
||||
top = " Settings ",
|
||||
},
|
||||
},
|
||||
},
|
||||
chat_window = {
|
||||
filetype = "chatgpt",
|
||||
border = {
|
||||
highlight = "FloatBorder",
|
||||
style = "rounded",
|
||||
text = {
|
||||
top = " ChatGPT ",
|
||||
},
|
||||
},
|
||||
},
|
||||
chat_input = {
|
||||
prompt = " ",
|
||||
border = {
|
||||
highlight = "FloatBorder",
|
||||
style = "rounded",
|
||||
text = {
|
||||
top_align = "center",
|
||||
top = " Prompt ",
|
||||
},
|
||||
},
|
||||
},
|
||||
openai_params = {
|
||||
model = "text-davinci-003",
|
||||
frequency_penalty = 0,
|
||||
presence_penalty = 0,
|
||||
max_tokens = 300,
|
||||
temperature = 0,
|
||||
top_p = 1,
|
||||
n = 1,
|
||||
},
|
||||
openai_edit_params = {
|
||||
model = "code-davinci-edit-001",
|
||||
temperature = 0,
|
||||
top_p = 1,
|
||||
n = 1,
|
||||
},
|
||||
keymaps = {
|
||||
close = { "<C-c>", "<Esc>" },
|
||||
yank_last = "<C-y>",
|
||||
scroll_up = "<C-u>",
|
||||
scroll_down = "<C-d>",
|
||||
toggle_settings = "<C-o>",
|
||||
new_session = "<C-n>",
|
||||
cycle_windows = "<Tab>",
|
||||
},
|
||||
}
|
||||
|
|
|
@ -1,33 +1,33 @@
|
|||
local M = {}
|
||||
|
||||
function M.smart_quit()
|
||||
local bufnr = vim.api.nvim_get_current_buf()
|
||||
local buf_windows = vim.call("win_findbuf", bufnr)
|
||||
local modified = vim.api.nvim_buf_get_option(bufnr, "modified")
|
||||
if modified and #buf_windows == 1 then
|
||||
vim.ui.input({
|
||||
prompt = "You have unsaved changes. Quit anyway? (y/n) ",
|
||||
}, function(input)
|
||||
if input == "y" then
|
||||
vim.cmd("q!")
|
||||
end
|
||||
end)
|
||||
else
|
||||
vim.cmd("q!")
|
||||
end
|
||||
local bufnr = vim.api.nvim_get_current_buf()
|
||||
local buf_windows = vim.call("win_findbuf", bufnr)
|
||||
local modified = vim.api.nvim_buf_get_var(bufnr, "modified")
|
||||
if modified and #buf_windows == 1 then
|
||||
vim.ui.input({
|
||||
prompt = "You have unsaved changes. Quit anyway? (y/n) ",
|
||||
}, function(input)
|
||||
if input == "y" then
|
||||
vim.cmd "q!"
|
||||
end
|
||||
end)
|
||||
else
|
||||
vim.cmd "q!"
|
||||
end
|
||||
end
|
||||
|
||||
function M.isempty(s)
|
||||
return s == nil or s == ""
|
||||
return s == nil or s == ""
|
||||
end
|
||||
|
||||
function M.get_buf_option(opt)
|
||||
local status_ok, buf_option = pcall(vim.api.nvim_buf_get_option, 0, opt)
|
||||
if not status_ok then
|
||||
return nil
|
||||
else
|
||||
return buf_option
|
||||
end
|
||||
local status_ok, buf_option = pcall(vim.api.nvim_buf_get_var, 0, opt)
|
||||
if not status_ok then
|
||||
return nil
|
||||
else
|
||||
return buf_option
|
||||
end
|
||||
end
|
||||
|
||||
return M
|
||||
|
|
|
@ -1,24 +1,24 @@
|
|||
local opts = { noremap = true, silent = true }
|
||||
|
||||
function _LIVE_SERVER()
|
||||
local Terminal = require("toggleterm.terminal").Terminal
|
||||
local live_server = Terminal:new({
|
||||
cmd = "live-server",
|
||||
hidden = true,
|
||||
direction = "tab",
|
||||
})
|
||||
live_server:toggle()
|
||||
local Terminal = require("toggleterm.terminal").Terminal
|
||||
local live_server = Terminal:new {
|
||||
cmd = "live-server",
|
||||
hidden = true,
|
||||
direction = "tab",
|
||||
}
|
||||
live_server:toggle()
|
||||
end
|
||||
|
||||
function _CLOSE_BUFFER()
|
||||
local buf = vim.api.nvim_get_current_buf()
|
||||
-- delete current buffer
|
||||
require("bufdelete").bufdelete(buf, true)
|
||||
local buf = vim.api.nvim_get_current_buf()
|
||||
-- delete current buffer
|
||||
require("bufdelete").bufdelete(buf, true)
|
||||
end
|
||||
|
||||
function _OPEN_ALACRITTY()
|
||||
-- open alacritty new windows current directory
|
||||
vim.cmd("silent !alacritty --working-directory " .. vim.fn.getcwd())
|
||||
-- open alacritty new windows current directory
|
||||
vim.cmd("silent !alacritty --working-directory " .. vim.fn.getcwd())
|
||||
end
|
||||
|
||||
local term_opts = { silent = true }
|
||||
|
@ -151,39 +151,39 @@ keymap("x", "<A-j>", ":move '>+1<CR>gv-gv", opts)
|
|||
keymap("x", "<A-k>", ":move '<-2<CR>gv-gv", opts)
|
||||
|
||||
local map = function(mode, lhs, rhs, desc)
|
||||
if desc then
|
||||
desc = desc
|
||||
end
|
||||
vim.keymap.set(mode, lhs, rhs, { silent = true, desc = desc, buffer = bufnr, noremap = true })
|
||||
if desc then
|
||||
desc = desc
|
||||
end
|
||||
vim.keymap.set(mode, lhs, rhs, { silent = true, desc = desc, buffer = 0, noremap = true })
|
||||
end
|
||||
-- if pcall(require, "dap") then
|
||||
-- modified function keys found with `showkey -a` in the terminal to get key code
|
||||
-- run `nvim -V3log +quit` and search through the "Terminal info" in the `log` file for the correct keyname
|
||||
if vim.fn.has("win32") == 0 then
|
||||
map("n", "<F5>", function()
|
||||
require("dap").continue()
|
||||
end, "")
|
||||
map("n", "<F17>", function()
|
||||
require("dap").terminate()
|
||||
end, "") -- Shift+F5
|
||||
map("n", "<F29>", function()
|
||||
require("dap").restart_frame()
|
||||
end, "") -- Control+F5
|
||||
map("n", "<F6>", function()
|
||||
require("dap").pause()
|
||||
end, "")
|
||||
map("n", "<F9>", function()
|
||||
require("dap").toggle_breakpoint()
|
||||
end, "")
|
||||
map("n", "<F10>", function()
|
||||
require("dap").step_over()
|
||||
end, "")
|
||||
map("n", "<F11>", function()
|
||||
require("dap").step_into()
|
||||
end, "")
|
||||
map("n", "<F23>", function()
|
||||
require("dap").step_out()
|
||||
end, "") -- Shift+F11
|
||||
if vim.fn.has "win32" == 0 then
|
||||
map("n", "<F5>", function()
|
||||
require("dap").continue()
|
||||
end, "")
|
||||
map("n", "<F17>", function()
|
||||
require("dap").terminate()
|
||||
end, "") -- Shift+F5
|
||||
map("n", "<F29>", function()
|
||||
require("dap").restart_frame()
|
||||
end, "") -- Control+F5
|
||||
map("n", "<F6>", function()
|
||||
require("dap").pause()
|
||||
end, "")
|
||||
map("n", "<F9>", function()
|
||||
require("dap").toggle_breakpoint()
|
||||
end, "")
|
||||
map("n", "<F10>", function()
|
||||
require("dap").step_over()
|
||||
end, "")
|
||||
map("n", "<F11>", function()
|
||||
require("dap").step_into()
|
||||
end, "")
|
||||
map("n", "<F23>", function()
|
||||
require("dap").step_out()
|
||||
end, "") -- Shift+F11
|
||||
end
|
||||
|
||||
-- Terminal --
|
||||
|
|
|
@ -3,7 +3,7 @@ if not status_ok then
|
|||
return
|
||||
end
|
||||
|
||||
require("user.lsp.mason")
|
||||
require("user.lsp.mason_cfg")
|
||||
--require("user.lsp.config") -- ini hanya untuk windows supaya jdtls jalan, kalau pakai linu x remark saja
|
||||
require("user.lsp.handlers").setup()
|
||||
--require("user.lsp.null-ls")
|
||||
--require("user.lsp.null-lscfg")
|
||||
|
|
|
@ -23,7 +23,6 @@ startify.section.top_buttons.val = {
|
|||
startify.button("t", " Find text", ":Telescope live_grep <CR>"),
|
||||
startify.button("c", " Configuration", ":e $MYVIMRC <CR>"),
|
||||
startify.button("z", " Lazy", ":Lazy<CR>"),
|
||||
-- startify.button("q", " Quit Neovim", ":qa<CR>"),
|
||||
}
|
||||
-- disable MRU
|
||||
startify.section.mru.val = { { type = "padding", val = 4 } }
|
||||
|
@ -70,6 +69,7 @@ vim.api.nvim_create_autocmd({ "User" }, {
|
|||
end,
|
||||
})
|
||||
-- ignore filetypes in MRU
|
||||
local default_mru_ignore = {}
|
||||
startify.mru_opts.ignore = function(path, ext)
|
||||
return (string.find(path, "COMMIT_EDITMSG")) or (vim.tbl_contains(default_mru_ignore, ext))
|
||||
end
|
||||
|
|
|
@ -1,151 +1,157 @@
|
|||
local active = true
|
||||
local icons = vim.g.pcode_icons
|
||||
local excludes = function()
|
||||
return vim.tbl_contains({
|
||||
"help",
|
||||
"startify",
|
||||
"dashboard",
|
||||
"packer",
|
||||
"neo-tree",
|
||||
"neogitstatus",
|
||||
"NvimTree",
|
||||
"Trouble",
|
||||
"alpha",
|
||||
"lir",
|
||||
"Outline",
|
||||
"spectre_panel",
|
||||
"toggleterm",
|
||||
"DressingSelect",
|
||||
"Jaq",
|
||||
"harpoon",
|
||||
"dap-repl",
|
||||
"dap-terminal",
|
||||
"dapui_console",
|
||||
"dapui_hover",
|
||||
"lab",
|
||||
"notify",
|
||||
"noice",
|
||||
"",
|
||||
} or {}, vim.bo.filetype)
|
||||
return vim.tbl_contains({
|
||||
"help",
|
||||
"startify",
|
||||
"dashboard",
|
||||
"packer",
|
||||
"neo-tree",
|
||||
"neogitstatus",
|
||||
"NvimTree",
|
||||
"Trouble",
|
||||
"alpha",
|
||||
"lir",
|
||||
"Outline",
|
||||
"spectre_panel",
|
||||
"toggleterm",
|
||||
"DressingSelect",
|
||||
"Jaq",
|
||||
"harpoon",
|
||||
"dap-repl",
|
||||
"dap-terminal",
|
||||
"dapui_console",
|
||||
"dapui_hover",
|
||||
"lab",
|
||||
"notify",
|
||||
"noice",
|
||||
"",
|
||||
} or {}, vim.bo.filetype)
|
||||
end
|
||||
|
||||
local get_filename = function()
|
||||
local filename = vim.fn.expand("%:t")
|
||||
local extension = vim.fn.expand("%:e")
|
||||
local f = require("user.functions")
|
||||
local filename = vim.fn.expand "%:t"
|
||||
local extension = vim.fn.expand "%:e"
|
||||
local f = require "user.functions"
|
||||
|
||||
if not f.isempty(filename) then
|
||||
local file_icon, hl_group = require("nvim-web-devicons").get_icon(filename, extension, { default = true })
|
||||
if not f.isempty(filename) then
|
||||
local file_icon, hl_group = require("nvim-web-devicons").get_icon(filename, extension, { default = true })
|
||||
|
||||
if f.isempty(file_icon) then
|
||||
file_icon = icons.kind.File
|
||||
end
|
||||
if f.isempty(file_icon) then
|
||||
file_icon = icons.kind.File
|
||||
end
|
||||
|
||||
local buf_ft = vim.bo.filetype
|
||||
local buf_ft = vim.bo.filetype
|
||||
|
||||
if buf_ft == "dapui_breakpoints" then
|
||||
file_icon = icons.ui.Bug
|
||||
end
|
||||
if buf_ft == "dapui_breakpoints" then
|
||||
file_icon = icons.ui.Bug
|
||||
end
|
||||
|
||||
if buf_ft == "dapui_stacks" then
|
||||
file_icon = icons.ui.Stacks
|
||||
end
|
||||
if buf_ft == "dapui_stacks" then
|
||||
file_icon = icons.ui.Stacks
|
||||
end
|
||||
|
||||
if buf_ft == "dapui_scopes" then
|
||||
file_icon = icons.ui.Scopes
|
||||
end
|
||||
if buf_ft == "dapui_scopes" then
|
||||
file_icon = icons.ui.Scopes
|
||||
end
|
||||
|
||||
if buf_ft == "dapui_watches" then
|
||||
file_icon = icons.ui.Watches
|
||||
end
|
||||
if buf_ft == "dapui_watches" then
|
||||
file_icon = icons.ui.Watches
|
||||
end
|
||||
|
||||
-- if buf_ft == "dapui_console" then
|
||||
-- file_icon = lvim.icons.ui.DebugConsole
|
||||
-- end
|
||||
-- if buf_ft == "dapui_console" then
|
||||
-- file_icon = lvim.icons.ui.DebugConsole
|
||||
-- end
|
||||
|
||||
local navic_text = vim.api.nvim_get_hl_by_name("Normal", true)
|
||||
vim.api.nvim_set_hl(0, "Winbar", { fg = navic_text.foreground })
|
||||
-- local navic_text = vim.api.nvim_get_hl_by_name("Normal", true)
|
||||
-- vim.api.nvim_set_hl(0, "Winbar", { fg = navic_text.foreground })
|
||||
-- Dapatkan definisi highlight group "Normal"
|
||||
local normal_hl = vim.fn.getcompletion("Normal", "highlight")[1]
|
||||
-- Dapatkan warna foreground dan background
|
||||
local fg_color = vim.fn.synIDattr(vim.fn.hlID(normal_hl), "fg")
|
||||
local bg_color = vim.fn.synIDattr(vim.fn.hlID(normal_hl), "bg")
|
||||
vim.api.nvim_set_hl(0, "Winbar", { fg = fg_color, bg = bg_color })
|
||||
|
||||
return " " .. "%#" .. hl_group .. "#" .. file_icon .. "%*" .. " " .. "%#Winbar#" .. filename .. "%*"
|
||||
end
|
||||
return " " .. "%#" .. hl_group .. "#" .. file_icon .. "%*" .. " " .. "%#Winbar#" .. filename .. "%*"
|
||||
end
|
||||
end
|
||||
|
||||
local get_gps = function()
|
||||
local status_gps_ok, gps = pcall(require, "nvim-navic")
|
||||
if not status_gps_ok then
|
||||
return ""
|
||||
end
|
||||
local status_gps_ok, gps = pcall(require, "nvim-navic")
|
||||
if not status_gps_ok then
|
||||
return ""
|
||||
end
|
||||
|
||||
local status_ok, gps_location = pcall(gps.get_location, {})
|
||||
if not status_ok then
|
||||
return ""
|
||||
end
|
||||
local status_ok, gps_location = pcall(gps.get_location, {})
|
||||
if not status_ok then
|
||||
return ""
|
||||
end
|
||||
|
||||
if not gps.is_available() or gps_location == "error" then
|
||||
return ""
|
||||
end
|
||||
if not gps.is_available() or gps_location == "error" then
|
||||
return ""
|
||||
end
|
||||
|
||||
if not require("user.functions").isempty(gps_location) then
|
||||
return "%#NavicSeparator#" .. icons.ui.ChevronRight .. "%* " .. gps_location
|
||||
else
|
||||
return ""
|
||||
end
|
||||
if not require("user.functions").isempty(gps_location) then
|
||||
return "%#NavicSeparator#" .. icons.ui.ChevronRight .. "%* " .. gps_location
|
||||
else
|
||||
return ""
|
||||
end
|
||||
end
|
||||
|
||||
local get_winbar = function()
|
||||
if excludes() then
|
||||
return
|
||||
end
|
||||
local f = require("user.functions")
|
||||
local value = get_filename()
|
||||
if excludes() then
|
||||
return
|
||||
end
|
||||
local f = require "user.functions"
|
||||
local value = get_filename()
|
||||
|
||||
local gps_added = false
|
||||
if not f.isempty(value) then
|
||||
local gps_value = get_gps()
|
||||
value = value .. " " .. gps_value
|
||||
if not f.isempty(gps_value) then
|
||||
gps_added = true
|
||||
end
|
||||
end
|
||||
local gps_added = false
|
||||
if not f.isempty(value) then
|
||||
local gps_value = get_gps()
|
||||
value = value .. " " .. gps_value
|
||||
if not f.isempty(gps_value) then
|
||||
gps_added = true
|
||||
end
|
||||
end
|
||||
|
||||
if not f.isempty(value) and f.get_buf_option("mod") then
|
||||
-- TODO: replace with circle
|
||||
local mod = "%#LspCodeLens#" .. icons.ui.Circle .. "%*"
|
||||
if gps_added then
|
||||
value = value .. " " .. mod
|
||||
else
|
||||
value = value .. mod
|
||||
end
|
||||
end
|
||||
if not f.isempty(value) and f.get_buf_option "mod" then
|
||||
-- TODO: replace with circle
|
||||
local mod = "%#LspCodeLens#" .. icons.ui.Circle .. "%*"
|
||||
if gps_added then
|
||||
value = value .. " " .. mod
|
||||
else
|
||||
value = value .. mod
|
||||
end
|
||||
end
|
||||
|
||||
local num_tabs = #vim.api.nvim_list_tabpages()
|
||||
local num_tabs = #vim.api.nvim_list_tabpages()
|
||||
|
||||
if num_tabs > 1 and not f.isempty(value) then
|
||||
local tabpage_number = tostring(vim.api.nvim_tabpage_get_number(0))
|
||||
value = value .. "%=" .. tabpage_number .. "/" .. tostring(num_tabs)
|
||||
end
|
||||
if num_tabs > 1 and not f.isempty(value) then
|
||||
local tabpage_number = tostring(vim.api.nvim_tabpage_get_number(0))
|
||||
value = value .. "%=" .. tabpage_number .. "/" .. tostring(num_tabs)
|
||||
end
|
||||
|
||||
local status_ok, _ = pcall(vim.api.nvim_set_option_value, "winbar", value, { scope = "local" })
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
local status_ok, _ = pcall(vim.api.nvim_set_option_value, "winbar", value, { scope = "local" })
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
vim.api.nvim_create_augroup("_winbar", {})
|
||||
if vim.fn.has("nvim-0.8") == 1 then
|
||||
vim.api.nvim_create_autocmd(
|
||||
{ "CursorHoldI", "CursorHold", "BufWinEnter", "BufFilePost", "InsertEnter", "BufWritePost", "TabClosed" },
|
||||
{
|
||||
group = "_winbar",
|
||||
callback = function()
|
||||
if active then
|
||||
local status_ok, _ = pcall(vim.api.nvim_buf_get_var, 0, "lsp_floating_window")
|
||||
if not status_ok then
|
||||
-- TODO:
|
||||
get_winbar()
|
||||
end
|
||||
end
|
||||
end,
|
||||
}
|
||||
)
|
||||
if vim.fn.has "nvim-0.8" == 1 then
|
||||
vim.api.nvim_create_autocmd(
|
||||
{ "CursorHoldI", "CursorHold", "BufWinEnter", "BufFilePost", "InsertEnter", "BufWritePost", "TabClosed" },
|
||||
{
|
||||
group = "_winbar",
|
||||
callback = function()
|
||||
if active then
|
||||
local status_ok, _ = pcall(vim.api.nvim_buf_get_var, 0, "lsp_floating_window")
|
||||
if not status_ok then
|
||||
-- TODO:
|
||||
get_winbar()
|
||||
end
|
||||
end
|
||||
end,
|
||||
}
|
||||
)
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue