some more fixes for different nvim versions

This commit is contained in:
2022-09-10 13:39:45 +02:00
parent c19072c4cd
commit 612ec0cbe6
3 changed files with 38 additions and 27 deletions

View File

@@ -1,6 +1,34 @@
if vim.version().minor >= 8 then
local function status_line()
local file_name = "%-.32t"
local modified = " %-m"
local right_align = "%="
local line_no = "%10([%l/%L%)]"
local pct_thru_file = "%5p%%"
require('lualine').setup({
options = { theme = 'gruvbox-baby' },
sections = { lualine_c = { 'getcwd' } },
inactive_sections = { lualine_c = { 'getcwd', { 'filename', path = 1, file_status = true } } },
})
return string.format(
"%s%s%s%s%s",
file_name,
modified,
right_align,
line_no,
pct_thru_file
)
end
vim.opt.laststatus = 3
vim.opt.winbar = status_line()
require('lualine').setup({
options = { theme = 'gruvbox-baby' },
sections = { lualine_c = { 'getcwd' } },
inactive_sections = { lualine_c = { 'getcwd', { 'filename', path = 1, file_status = true } } },
globalstatus = true,
})
else
require('lualine').setup({
options = { theme = 'gruvbox-baby' },
sections = { lualine_c = { 'filename' } },
globalstatus = false,
-- inactive_sections = { lualine_c = { 'filename' } },
})
end

View File

@@ -63,7 +63,11 @@ local on_attach = function(client, bufnr)
-- Set some keybinds conditional on server capabilities
if client.server_capabilities.documentFormattingProvider then
vim.keymap.set('n', '<space>f', vim.lsp.buf.format, opts)
if vim.version().minor >= 8 then
vim.keymap.set('n', '<space>f', vim.lsp.buf.format, opts)
else
vim.keymap.set('n', '<space>f', vim.lsp.buf.formatting, opts)
end
end
if client.server_capabilities.documentRangeFormattingProvider then
vim.keymap.set('v', '<space>f', vim.lsp.buf.range_formatting, opts)