nvim: configure cmp activation + formatting
This commit is contained in:
@@ -1,8 +1,8 @@
|
|||||||
-- Custom warning symbols
|
-- Custom warning symbols
|
||||||
local signs = { Error = " ", Warn = " ", Hint = " ", Info = " " }
|
local signs = { Error = " ", Warn = " ", Hint = " ", Info = " " }
|
||||||
for type, icon in pairs(signs) do
|
for type, icon in pairs(signs) do
|
||||||
local hl = "DiagnosticSign" .. type
|
local hl = "DiagnosticSign" .. type
|
||||||
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl })
|
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl })
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Easily install LSPs with `:LSPInstall`
|
-- Easily install LSPs with `:LSPInstall`
|
||||||
@@ -18,15 +18,15 @@ require("nvim-lsp-installer").setup({
|
|||||||
})
|
})
|
||||||
|
|
||||||
local lsp = require('lspconfig')
|
local lsp = require('lspconfig')
|
||||||
local navic = require('nvim-navic') -- breadcrumbs
|
local navic = require('nvim-navic') -- breadcrumbs
|
||||||
|
|
||||||
-- Normal LSPs
|
-- Normal LSPs
|
||||||
-- Install with `:LSPInstall`
|
-- Install with `:LSPInstall`
|
||||||
local servers = { "pylsp", "sumneko_lua", "hls" }
|
local servers = { "pylsp", "sumneko_lua", "hls" }
|
||||||
for _,i in ipairs(servers) do
|
for _, i in ipairs(servers) do
|
||||||
lsp[i].setup({
|
lsp[i].setup({
|
||||||
on_attach = function(client, bufnr)
|
on_attach = function(client, bufnr)
|
||||||
navic.attach(client, bufnr) -- breadcrumbs
|
navic.attach(client, bufnr) -- breadcrumbs
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
@@ -37,7 +37,7 @@ lsp.texlab.setup({
|
|||||||
settings = {
|
settings = {
|
||||||
texlab = {
|
texlab = {
|
||||||
build = {
|
build = {
|
||||||
args = { '-pdf', '-interaction=nonstopmode', '-synctex=1', '-shell-escape','%f' },
|
args = { '-pdf', '-interaction=nonstopmode', '-synctex=1', '-shell-escape', '%f' },
|
||||||
onSave = true,
|
onSave = true,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -57,7 +57,7 @@ local opts = {
|
|||||||
},
|
},
|
||||||
server = {
|
server = {
|
||||||
on_attach = function(client, bufnr)
|
on_attach = function(client, bufnr)
|
||||||
navic.attach(client, bufnr) -- breadcrumbs
|
navic.attach(client, bufnr) -- breadcrumbs
|
||||||
end,
|
end,
|
||||||
settings = {
|
settings = {
|
||||||
["rust-analyzer"] = {
|
["rust-analyzer"] = {
|
||||||
|
|||||||
@@ -134,6 +134,7 @@ return require('packer').startup(function(use)
|
|||||||
"json",
|
"json",
|
||||||
"latex",
|
"latex",
|
||||||
"lua",
|
"lua",
|
||||||
|
"make",
|
||||||
"python",
|
"python",
|
||||||
"rust",
|
"rust",
|
||||||
},
|
},
|
||||||
@@ -152,30 +153,28 @@ return require('packer').startup(function(use)
|
|||||||
use("simrat39/rust-tools.nvim") -- Cooler LSP stuff for Rust
|
use("simrat39/rust-tools.nvim") -- Cooler LSP stuff for Rust
|
||||||
|
|
||||||
-- Snippets
|
-- Snippets
|
||||||
-- TODO: max candidates
|
|
||||||
-- TODO: time trigger activation
|
|
||||||
use({
|
use({
|
||||||
'hrsh7th/nvim-cmp',
|
'hrsh7th/nvim-cmp',
|
||||||
requires = {
|
requires = {
|
||||||
"L3MON4D3/LuaSnip",
|
"L3MON4D3/LuaSnip", -- Snippet engine
|
||||||
"hrsh7th/cmp-buffer",
|
"hrsh7th/cmp-buffer", -- Source: buffer
|
||||||
"hrsh7th/cmp-nvim-lsp",
|
"hrsh7th/cmp-nvim-lsp", -- Source: LSP symbols
|
||||||
"hrsh7th/cmp-path",
|
"hrsh7th/cmp-path", -- Source: path
|
||||||
"rafamadriz/friendly-snippets",
|
"rafamadriz/friendly-snippets", -- Source: JSON style snippets for LuaSnip
|
||||||
"saadparwaiz1/cmp_luasnip",
|
"saadparwaiz1/cmp_luasnip", -- Make LuaSnip work with cmp
|
||||||
},
|
},
|
||||||
config = function()
|
config = function()
|
||||||
local cmp = require 'cmp'
|
local cmp = require 'cmp'
|
||||||
cmp.setup({
|
cmp.setup({
|
||||||
snippet = {
|
snippet = {
|
||||||
expand = function(args)
|
expand = function(args) -- set a snippet engine
|
||||||
require("luasnip").lsp_expand(args.body)
|
require("luasnip").lsp_expand(args.body)
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
sources = {
|
sources = {
|
||||||
{ name = 'luasnip' },
|
{ name = 'luasnip', keyword_length = 3, max_item_count = 3 },
|
||||||
{ name = 'nvim_lsp' },
|
{ name = 'nvim_lsp', keyword_length = 3, max_item_count = 10 },
|
||||||
{ name = 'buffer' },
|
{ name = 'buffer', keyword_length = 5, max_item_count = 3 },
|
||||||
{ name = 'path' },
|
{ name = 'path' },
|
||||||
},
|
},
|
||||||
formatting = {
|
formatting = {
|
||||||
@@ -187,7 +186,7 @@ return require('packer').startup(function(use)
|
|||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
-- Load in friendly-snippets
|
-- Load friendly-snippets
|
||||||
require('luasnip.loaders.from_vscode').lazy_load()
|
require('luasnip.loaders.from_vscode').lazy_load()
|
||||||
-- TODO: Add own snippets
|
-- TODO: Add own snippets
|
||||||
--[[ require("luasnip.loaders.from_vscode").lazy_load({
|
--[[ require("luasnip.loaders.from_vscode").lazy_load({
|
||||||
@@ -228,10 +227,10 @@ return require('packer').startup(function(use)
|
|||||||
}
|
}
|
||||||
|
|
||||||
-- git client
|
-- git client
|
||||||
use {
|
use {
|
||||||
'TimUntersberger/neogit',
|
'TimUntersberger/neogit',
|
||||||
requires = 'nvim-lua/plenary.nvim',
|
requires = 'nvim-lua/plenary.nvim',
|
||||||
config = function()
|
config = function()
|
||||||
local neogit = require('neogit')
|
local neogit = require('neogit')
|
||||||
neogit.setup {
|
neogit.setup {
|
||||||
signs = {
|
signs = {
|
||||||
@@ -239,8 +238,8 @@ return require('packer').startup(function(use)
|
|||||||
item = { "", "" },
|
item = { "", "" },
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
|
|
||||||
-- Automatically set up your configuration after cloning packer.nvim
|
-- Automatically set up your configuration after cloning packer.nvim
|
||||||
-- Put this at the end after all plugins
|
-- Put this at the end after all plugins
|
||||||
|
|||||||
@@ -97,12 +97,16 @@ input type:keyboard {
|
|||||||
set $bemenu bemenu \
|
set $bemenu bemenu \
|
||||||
-l 7 \
|
-l 7 \
|
||||||
--nb "#282828" \
|
--nb "#282828" \
|
||||||
|
--nf "#ffffff" \
|
||||||
|
--ab "#282828" \
|
||||||
|
--af "#ffffff" \
|
||||||
--fb "#282828" \
|
--fb "#282828" \
|
||||||
--tf "#93b259" \
|
--tf "#93b259" \
|
||||||
--tb "#282828" \
|
--tb "#282828" \
|
||||||
--hf "#ffffff" \
|
--hf "#ffffff" \
|
||||||
--hb "#393939" \
|
--hb "#393939" \
|
||||||
--fn "SFMono Nerd Font 13" -i -H 25 -W 0.35
|
--fn "SFMono Nerd Font 13" -i -H 25 -W 0.35
|
||||||
|
|
||||||
set $files fd -I "pdf$" $HOME | cut -f 4- -d "/"
|
set $files fd -I "pdf$" $HOME | cut -f 4- -d "/"
|
||||||
set $lock_screen \
|
set $lock_screen \
|
||||||
printf \
|
printf \
|
||||||
|
|||||||
Reference in New Issue
Block a user