Formatting

This commit is contained in:
Bertrand Benjamin 2022-10-10 14:16:20 +02:00
parent 20b9e02adb
commit 1fe23703f4
2 changed files with 16 additions and 15 deletions

View File

@ -1,13 +1,13 @@
local has_words_before = function()
if vim.api.nvim_buf_get_option(0, "buftype") == "prompt" then
return false
end
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
if vim.api.nvim_buf_get_option(0, "buftype") == "prompt" then
return false
end
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
end
local feedkey = function(key, mode)
vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes(key, true, true, true), mode, true)
vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes(key, true, true, true), mode, true)
end
local lsp_symbols = {
@ -41,9 +41,9 @@ local lsp_symbols = {
local status, cmp = pcall(require, "cmp")
if (not status) then return end
cmp.setup{
cmp.setup {
completion = {
completeopt = 'menuone,noinsert,noselect',
completeopt = 'menuone,noinsert,noselect',
},
formatting = {
format = function(entry, vim_item)
@ -66,7 +66,7 @@ cmp.setup{
end,
},
mapping = {
["<cr>"] = cmp.mapping.confirm({select = false, behavior = cmp.ConfirmBehavior.Replace}),
["<cr>"] = cmp.mapping.confirm({ select = false, behavior = cmp.ConfirmBehavior.Replace }),
-- ["<Tab>"] = cmp.mapping.confirm({select = true, behavior = cmp.ConfirmBehavior.Insert}),
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
@ -123,8 +123,7 @@ cmp.setup.cmdline('/', {
cmp.setup.cmdline(':', {
mapping = cmp.mapping.preset.cmdline(),
sources = cmp.config.sources({
{ name = 'path' }
}, {
{ name = 'path' },
{ name = 'cmdline' }
})
})

View File

@ -97,7 +97,9 @@ return packer.startup(function(use)
}
use { 'nvim-telescope/telescope-fzf-native.nvim', run = 'make' }
use { "nvim-telescope/telescope-file-browser.nvim" }
use {
"nvim-telescope/telescope-file-browser.nvim"
}
use {
'lervag/vimtex',