Refresh generated neovim config
This commit is contained in:
@ -77,6 +77,14 @@ function M.find_git_dir(dir_path)
|
||||
-- get file dir so we can search from that dir
|
||||
local file_dir = dir_path or vim.fn.expand('%:p:h')
|
||||
|
||||
if package.loaded.oil then
|
||||
local oil = require('oil')
|
||||
local ok, dir = pcall(oil.get_current_dir)
|
||||
if ok and dir and dir ~= '' then
|
||||
file_dir = vim.fn.fnamemodify(dir, ':p:h')
|
||||
end
|
||||
end
|
||||
|
||||
-- extract correct file dir from terminals
|
||||
if file_dir and file_dir:match('term://.*') then
|
||||
file_dir = vim.fn.expand(file_dir:gsub('term://(.+)//.+', '%1'))
|
||||
|
||||
@ -33,8 +33,19 @@ M.sources = {
|
||||
workspace_diag(diag_severity.HINT)
|
||||
end,
|
||||
nvim_diagnostic = function()
|
||||
local count
|
||||
|
||||
if vim.diagnostic.count ~= nil then -- neovim >= 0.10.0
|
||||
count = vim.diagnostic.count(0)
|
||||
return count[vim.diagnostic.severity.ERROR] or 0,
|
||||
count[vim.diagnostic.severity.WARN] or 0,
|
||||
count[vim.diagnostic.severity.INFO] or 0,
|
||||
count[vim.diagnostic.severity.HINT] or 0
|
||||
end
|
||||
|
||||
-- fallback
|
||||
local diagnostics = vim.diagnostic.get(0)
|
||||
local count = { 0, 0, 0, 0 }
|
||||
count = { 0, 0, 0, 0 }
|
||||
for _, diagnostic in ipairs(diagnostics) do
|
||||
count[diagnostic.severity] = count[diagnostic.severity] + 1
|
||||
end
|
||||
|
||||
@ -1,7 +1,32 @@
|
||||
-- Copyright (c) 2020-2021 hoob3rt
|
||||
-- MIT license, see LICENSE for more details.
|
||||
local function encoding()
|
||||
return vim.opt.fileencoding:get()
|
||||
local lualine_require = require('lualine_require')
|
||||
local M = lualine_require.require('lualine.component'):extend()
|
||||
|
||||
local default_options = {
|
||||
-- Show '[BOM]' when the file has a byte-order mark
|
||||
show_bomb = false,
|
||||
}
|
||||
|
||||
function M:init(options)
|
||||
M.super.init(self, options)
|
||||
self.options = vim.tbl_deep_extend('keep', self.options or {}, default_options)
|
||||
end
|
||||
|
||||
return encoding
|
||||
function M:update_status()
|
||||
local show_bomb = self.options.show_bomb
|
||||
|
||||
local result = vim.opt.fileencoding:get()
|
||||
|
||||
if not show_bomb then
|
||||
return result
|
||||
end
|
||||
|
||||
if vim.opt.bomb:get() then
|
||||
result = result .. ' [BOM]'
|
||||
end
|
||||
|
||||
return result
|
||||
end
|
||||
|
||||
return M
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
-- MIT license, see LICENSE for more details.
|
||||
local function location()
|
||||
local line = vim.fn.line('.')
|
||||
local col = vim.fn.virtcol('.')
|
||||
local col = vim.fn.charcol('.')
|
||||
return string.format('%3d:%-2d', line, col)
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user