some more fixes for different nvim versions

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

View File

@ -47,7 +47,6 @@ opt.expandtab= true
opt.smartindent= true
opt.title = true
opt.titlestring = '%{getcwd()} - %t'
opt.laststatus = 3
-- go to previous/next line with h,l,left arrow and right arrow
-- when cursor reaches end/beginning of line
@ -61,23 +60,3 @@ opt.foldlevel = 20
opt.foldmethod = 'expr'
opt.foldexpr = 'nvim_treesitter#foldexpr()'
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%%"
return string.format(
"%s%s%s%s%s",
file_name,
modified,
right_align,
line_no,
pct_thru_file
)
end
opt.winbar = status_line()
end

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({
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
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)