Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chore: unify the way when get option #1269

Merged
merged 2 commits into from
Jun 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lua/core/event.lua
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ vim.api.nvim_create_autocmd("BufEnter", {
local layout = vim.api.nvim_call_function("winlayout", {})
if
layout[1] == "leaf"
and vim.api.nvim_get_option_value("filetype", { buf = vim.api.nvim_win_get_buf(layout[2]) }) == "NvimTree"
and vim.bo[vim.api.nvim_win_get_buf(layout[2])].filetype == "NvimTree"
and layout[3] == nil
then
vim.api.nvim_command([[confirm quit]])
Expand Down
2 changes: 1 addition & 1 deletion lua/modules/configs/completion/null-ls.lua
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ return function()
-- Setup usercmd to register/deregister available source(s)
local function _gen_completion()
local sources_cont = null_ls.get_source({
filetype = vim.api.nvim_get_option_value("filetype", { scope = "local" }),
filetype = vim.bo.filetype,
})
local completion_items = {}
for _, server in pairs(sources_cont) do
Expand Down
6 changes: 3 additions & 3 deletions lua/modules/configs/ui/lualine.lua
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ return function()

lsp = {
function()
local buf_ft = vim.api.nvim_get_option_value("filetype", { scope = "local" })
local buf_ft = vim.bo.filetype
local clients = vim.lsp.get_clients()
local lsp_lists = {}
local available_servers = {}
Expand Down Expand Up @@ -201,7 +201,7 @@ return function()
return venv
end

if vim.api.nvim_get_option_value("filetype", { scope = "local" }) == "python" then
if vim.bo.filetype == "python" then
local venv = os.getenv("CONDA_DEFAULT_ENV")
if venv then
return icons.misc.PyEnv .. env_cleanup(venv)
Expand All @@ -219,7 +219,7 @@ return function()

tabwidth = {
function()
return icons.ui.Tab .. vim.api.nvim_get_option_value("tabstop", { scope = "local" })
return icons.ui.Tab .. vim.bo.tabstop
end,
padding = 1,
},
Expand Down