Changed a few things with CMP

This commit is contained in:
Afonso Franco 2023-01-01 16:30:31 +00:00
parent cc96473d89
commit 793f053367
Signed by: afonso
GPG key ID: C459E0BB3DCEE899
4 changed files with 151 additions and 145 deletions

View file

@ -7,6 +7,9 @@ vim.wo.relativenumber= true
vim.opt.hlsearch = false
vim.opt.incsearch = true
vim.opt.smartindent = true
--Move lines
vim.keymap.set("v", "J", ":m '>+1<CR>gv=gv")
vim.keymap.set("v", "K", ":m '<-2<CR>gv=gv")
--Remove Wrap
vim.opt.wrap = false
--Not let cursor go bellow 10 chars.
@ -16,6 +19,9 @@ vim.opt.tabstop = 4
vim.opt.softtabstop = 4
vim.opt.shiftwidth = 4
vim.opt.expandtab = true
--quickfix keybinds
vim.keymap.set("n", "<C-k>", "<cmd>cnext<CR>zz")
vim.keymap.set("n", "<C-j>", "<cmd>cprev<CR>zz")
--Undo dir
vim.opt.undodir = os.getenv("HOME") .. "/.vim/undodir"
vim.opt.undofile = true

View file

@ -116,12 +116,17 @@ cmp.setup {
cmp.config.compare.recently_used,
}
},
sources = {
sources = cmp.config.sources(
{
{ name = "nvim_lsp" },
{ name = "luasnip" },
{ name = "buffer" },
{ name = "path" },
},
{
--This sources will only show up if there aren't any sources from the other list
{ name = "buffer", keyword_length = 5 },
}
),
confirm_opts = {
behavior = cmp.ConfirmBehavior.Replace,
select = false,
@ -134,7 +139,7 @@ cmp.setup {
},
experimental = {
ghost_text = false,
ghost_text = true,
native_menu = false,
},
}

View file

@ -1,5 +1,4 @@
local mason_lspconfig = require "mason-lspconfig"
local notify = require "notify"
mason_lspconfig.setup({
ensure_installed = { "sumneko_lua", "rust_analyzer", "texlab", "hls", "yamlls" },
@ -48,11 +47,6 @@ local on_attach = function(client, bufnr)
end
end
local on_init = function (client, initialize_result)
-- Alert user that LSP finished loading
notify("Finished loading " ..client.name, "info", {title = "LSP"})
end
local lspconfig = require "lspconfig"
-- ADD NVIM CMP AS A CAPABILITY
@ -71,7 +65,6 @@ mason_lspconfig.setup_handlers {
function(server_name)
lspconfig[server_name].setup {
on_attach = on_attach,
on_init = on_init,
flags = lsp_flags,
capabilities = capabilities,
}

View file

@ -24,36 +24,38 @@ local plugins = packer.startup({ function(use)
end
}
use { 'stevearc/dressing.nvim' } -- Rename variable pop up
use { "stevearc/dressing.nvim" } -- Rename variable pop up
use { "windwp/nvim-autopairs",
config = function() require("nvim-autopairs").setup {}
end
}
use { 'kyazdani42/nvim-web-devicons' }
use { "kyazdani42/nvim-web-devicons" }
use {
'nvim-lualine/lualine.nvim',
requires = { 'kyazdani42/nvim-web-devicons', opt = true },
"nvim-lualine/lualine.nvim",
requires = { "kyazdani42/nvim-web-devicons", opt = true },
config = function()
require 'plugins.lualine'
end
}
use { 'rcarriga/nvim-notify',
config = function()
vim.notify = require("notify")
use {"j-hui/fidget.nvim",
config = function ()
require("fidget").setup{}
end
}
use {"voldikss/vim-floaterm"}
--------------------------------------------------SUGGESTION BOX-----------------------------------------
use { "hrsh7th/nvim-cmp",
requires = {
'hrsh7th/cmp-nvim-lsp', -- lsp
'hrsh7th/cmp-buffer', --buffer completions
'hrsh7th/cmp-path', --path completions
'hrsh7th/cmp-cmdline' --cmdline completions
"hrsh7th/cmp-nvim-lsp", -- lsp
"hrsh7th/cmp-buffer", --buffer completions
"hrsh7th/cmp-path", --path completions
"hrsh7th/cmp-cmdline" --cmdline completions
},
config = function()
require "plugins.cmp"
@ -92,9 +94,9 @@ local plugins = packer.startup({ function(use)
------------------------------------------------------------------------------------------
use { 'nvim-tree/nvim-tree.lua',
use { "nvim-tree/nvim-tree.lua",
requires = {
'nvim-tree/nvim-web-devicons', -- optional, for file icons
"nvim-tree/nvim-web-devicons", -- optional, for file icons
},
config = function()
require("nvim-tree").setup()
@ -119,8 +121,8 @@ local plugins = packer.startup({ function(use)
}
--Tabs
use { 'romgrk/barbar.nvim',
requires = 'kyazdani42/nvim-web-devicons',
use { "romgrk/barbar.nvim",
requires = "kyazdani42/nvim-web-devicons",
config = function()
require "plugins.barbar"
end
@ -128,9 +130,9 @@ local plugins = packer.startup({ function(use)
--fuzzy file finding
use {
'nvim-telescope/telescope.nvim', tag = '0.1.0',
"nvim-telescope/telescope.nvim", tag = '0.1.0',
-- or , branch = '0.1.x',
requires = { { 'nvim-lua/plenary.nvim' } },
requires = { { "nvim-lua/plenary.nvim" } },
config = function() require('plugins.telescope') end
}