Compare commits
7 Commits
641fac3142
...
feature/nv
| Author | SHA1 | Date | |
|---|---|---|---|
| 08585a0010 | |||
| 48ad61643f | |||
| 959cc167c6 | |||
| ba425ecf49 | |||
| b2be54b2b9 | |||
| ffb7d66888 | |||
| 924ba5c280 |
@@ -23,8 +23,5 @@ require("lazy").setup({
|
||||
spec = {
|
||||
{ import = "plugins" },
|
||||
},
|
||||
checker = { enabled = true },
|
||||
change_detection = {
|
||||
enabled = false
|
||||
},
|
||||
change_detection = { enabled = false },
|
||||
})
|
||||
|
||||
@@ -2,19 +2,24 @@
|
||||
"LuaSnip": { "branch": "master", "commit": "3732756842a2f7e0e76a7b0487e9692072857277" },
|
||||
"alpha-nvim": { "branch": "main", "commit": "3979b01cb05734331c7873049001d3f2bb8477f4" },
|
||||
"auto-session": { "branch": "main", "commit": "292492ab7af4bd8b9e37e28508bc8ce995722fd5" },
|
||||
"copilot.lua": { "branch": "master", "commit": "5bde2cfe01f049f522eeb8b52c5c723407db8bdf" },
|
||||
"cmp-buffer": { "branch": "main", "commit": "b74fab3656eea9de20a9b8116afa3cfc4ec09657" },
|
||||
"cmp-cmdline": { "branch": "main", "commit": "d126061b624e0af6c3a556428712dd4d4194ec6d" },
|
||||
"cmp-nvim-lsp": { "branch": "main", "commit": "cbc7b02bb99fae35cb42f514762b89b5126651ef" },
|
||||
"cmp-path": { "branch": "main", "commit": "c642487086dbd9a93160e1679a1327be111cbc25" },
|
||||
"cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" },
|
||||
"copilot.lua": { "branch": "master", "commit": "e919876a5523b06406f0bc7285477da87a338a61" },
|
||||
"friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" },
|
||||
"gruvbox.nvim": { "branch": "main", "commit": "5e0a460d8e0f7f669c158dedd5f9ae2bcac31437" },
|
||||
"harpoon": { "branch": "harpoon2", "commit": "87b1a3506211538f460786c23f98ec63ad9af4e5" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "85c7ff3711b730b4030d03144f6db6375044ae82" },
|
||||
"lualine.nvim": { "branch": "master", "commit": "3946f0122255bc377d14a59b27b609fb3ab25768" },
|
||||
"markview.nvim": { "branch": "main", "commit": "fb1f8476f4bd0fa4e692b5eef56bca80c7db338d" },
|
||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "b1d9a914b02ba5660f1e272a03314b31d4576fe2" },
|
||||
"mason.nvim": { "branch": "main", "commit": "ad7146aa61dcaeb54fa900144d768f040090bff0" },
|
||||
"mason.nvim": { "branch": "main", "commit": "57e5a8addb8c71fb063ee4acda466c7cf6ad2800" },
|
||||
"noice.nvim": { "branch": "main", "commit": "7bfd942445fb63089b59f97ca487d605e715f155" },
|
||||
"nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "b34fbdffdcb6295c7a25df6ba375452a2e73c32e" },
|
||||
"nvim-treesitter": { "branch": "main", "commit": "b50774079aa3de80a06dce1634e7e1aa26d25848" },
|
||||
"nvim-cmp": { "branch": "main", "commit": "d78fb3b64eedb701c9939f97361c06483af575e0" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "abf6d190f2c06818489c0bd4b926e7e3a06c5e51" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" },
|
||||
"nvim-web-devicons": { "branch": "master", "commit": "8dcb311b0c92d460fac00eac706abd43d94d68af" },
|
||||
"oil.nvim": { "branch": "master", "commit": "7e1cd7703ff2924d7038476dcbc04b950203b902" },
|
||||
"outline.nvim": { "branch": "main", "commit": "6b62f73a6bf317531d15a7ae1b724e85485d8148" },
|
||||
|
||||
@@ -31,64 +31,21 @@ vim.lsp.config("texlab", {
|
||||
|
||||
})
|
||||
|
||||
|
||||
--
|
||||
--
|
||||
-- Completion config
|
||||
--
|
||||
--
|
||||
|
||||
|
||||
vim.o.completeopt = "menu,menuone,noinsert,fuzzy"
|
||||
|
||||
vim.api.nvim_set_keymap("i", "<C-Space>", "<C-x><C-o>", { noremap = true })
|
||||
|
||||
vim.api.nvim_create_autocmd('LspAttach', {
|
||||
group = vim.api.nvim_create_augroup('my.lsp', {}),
|
||||
callback = function(args)
|
||||
local client = assert(vim.lsp.get_client_by_id(args.data.client_id))
|
||||
|
||||
-- Make tab accept the selected completion
|
||||
vim.keymap.set('i', '<Tab>', function()
|
||||
if vim.fn.pumvisible() == 1 then
|
||||
return '<C-y>'
|
||||
else
|
||||
return '<Tab>'
|
||||
end
|
||||
end, { expr = true })
|
||||
|
||||
-- Make enter just insert a newline (don't accept completion)
|
||||
vim.keymap.set('i', '<CR>', function()
|
||||
if vim.fn.pumvisible() == 1 then
|
||||
return '<C-e><CR>'
|
||||
else
|
||||
return '<CR>'
|
||||
end
|
||||
end, { expr = true })
|
||||
|
||||
if client:supports_method('textDocument/completion') then
|
||||
-- Trigger autocompletion on every keypress
|
||||
local chars = {}; for i = 32, 126 do table.insert(chars, string.char(i)) end
|
||||
client.server_capabilities.completionProvider.triggerCharacters = chars
|
||||
|
||||
vim.lsp.completion.enable(true, client.id, args.buf, { autotrigger = true })
|
||||
end
|
||||
|
||||
vim.keymap.set('n', '<M-L>',
|
||||
function() vim.lsp.buf.format() end, {
|
||||
desc = "Format",
|
||||
noremap = true,
|
||||
silent = true
|
||||
})
|
||||
vim.keymap.set('i', '<M-L>',
|
||||
function() vim.lsp.buf.format() end, {
|
||||
desc = "Format",
|
||||
noremap = true,
|
||||
silent = true
|
||||
})
|
||||
|
||||
vim.keymap.set("n", "gd", function() vim.lsp.buf.definition() end, { desc = "Go to definition" })
|
||||
end,
|
||||
vim.lsp.config('clangd', {
|
||||
cmd = {
|
||||
"clangd",
|
||||
"--background-index",
|
||||
"--clang-tidy",
|
||||
"--completion-style=bundled",
|
||||
"--cross-file-rename",
|
||||
"--header-insertion=iwyu",
|
||||
-- Required for embedded system compilers
|
||||
"--query-driver=/**/*g++",
|
||||
"--offset-encoding=utf-16"
|
||||
-- "-j=8",
|
||||
-- "--malloc-trim",
|
||||
-- "--pch-storage=memory"
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
@@ -125,3 +82,38 @@ vim.api.nvim_create_autocmd("CursorHold", {
|
||||
})
|
||||
end,
|
||||
})
|
||||
|
||||
|
||||
--
|
||||
--
|
||||
-- Keymaps
|
||||
--
|
||||
--
|
||||
|
||||
|
||||
-- TODO: Do I need this if I use nvim-cmp?
|
||||
vim.o.completeopt = "menu,menuone,noinsert,fuzzy"
|
||||
|
||||
vim.api.nvim_set_keymap("i", "<C-Space>", "<C-x><C-o>", { noremap = true })
|
||||
|
||||
vim.api.nvim_create_autocmd('LspAttach', {
|
||||
group = vim.api.nvim_create_augroup('my.lsp', {}),
|
||||
callback = function(args)
|
||||
vim.keymap.set('n', '<M-L>',
|
||||
function() vim.lsp.buf.format() end, {
|
||||
desc = "Format",
|
||||
noremap = true,
|
||||
silent = true
|
||||
})
|
||||
vim.keymap.set('i', '<M-L>',
|
||||
function() vim.lsp.buf.format() end, {
|
||||
desc = "Format",
|
||||
noremap = true,
|
||||
silent = true
|
||||
})
|
||||
vim.keymap.set("n", "gd",
|
||||
function() vim.lsp.buf.definition() end, {
|
||||
desc = "Go to definition"
|
||||
})
|
||||
end,
|
||||
})
|
||||
|
||||
@@ -6,9 +6,8 @@ return {
|
||||
local loader = require("luasnip.loaders.from_lua")
|
||||
loader.lazy_load({ paths = { "./snippets" } })
|
||||
|
||||
-- TODO: Find out how to enable autosnippets without having the status line disappear
|
||||
require("luasnip").config.set_config({
|
||||
-- enable_autosnippets = true,
|
||||
enable_autosnippets = true,
|
||||
store_selection_keys = "<leader>v"
|
||||
})
|
||||
|
||||
@@ -1,49 +0,0 @@
|
||||
-- TODO: Implement
|
||||
|
||||
-- A server implementation is just a function that returns a table with several methods
|
||||
-- `dispatchers` is a table with a couple methods that allow the server to interact with the client
|
||||
local function server(dispatchers)
|
||||
local closing = false
|
||||
local srv = {}
|
||||
|
||||
-- This method is called each time the client makes a request to the server
|
||||
-- `method` is the LSP method name
|
||||
-- `params` is the payload that the client sends
|
||||
-- `callback` is a function which takes two parameters: `err` and `result`
|
||||
-- The callback must be called to send a response to the client
|
||||
-- To learn more about what method names are available and the structure of
|
||||
-- the payloads you'll need to read the specification:
|
||||
-- https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/
|
||||
function srv.request(method, params, callback)
|
||||
if method == 'initialize' then
|
||||
callback(nil, { capabilities = {} })
|
||||
elseif method == 'shutdown' then
|
||||
callback(nil, nil)
|
||||
end
|
||||
return true, 1
|
||||
end
|
||||
|
||||
-- This method is called each time the client sends a notification to the server
|
||||
-- The difference between `request` and `notify` is that notifications don't expect a response
|
||||
function srv.notify(method, params)
|
||||
if method == 'exit' then
|
||||
dispatchers.on_exit(0, 15)
|
||||
end
|
||||
end
|
||||
|
||||
-- Indicates if the client is shutting down
|
||||
function srv.is_closing()
|
||||
return closing
|
||||
end
|
||||
|
||||
-- Callend when the client wants to terminate the process
|
||||
function srv.terminate()
|
||||
closing = true
|
||||
end
|
||||
|
||||
return srv
|
||||
end
|
||||
|
||||
-- print( require("luasnip").get_current_choices())
|
||||
|
||||
-- vim.lsp.start({ name = "luasnip", cmd = server })
|
||||
@@ -1,23 +0,0 @@
|
||||
return {
|
||||
"OXY2DEV/markview.nvim",
|
||||
lazy = false,
|
||||
}
|
||||
-- return {
|
||||
-- "iamcco/markdown-preview.nvim",
|
||||
-- cmd = { "MarkdownPreview" },
|
||||
-- build = function(plugin)
|
||||
-- if vim.fn.executable "npx" then
|
||||
-- vim.cmd("!cd " .. plugin.dir .. " && cd app && npx --yes yarn install")
|
||||
-- else
|
||||
-- vim.cmd [[Lazy load markdown-preview.nvim]]
|
||||
-- vim.fn["mkdp#util#install"]()
|
||||
-- end
|
||||
-- end,
|
||||
-- init = function()
|
||||
-- if vim.fn.executable "npx" then
|
||||
-- vim.g.mkdp_filetypes = {
|
||||
-- "markdown"
|
||||
-- }
|
||||
-- end
|
||||
-- end
|
||||
-- }
|
||||
@@ -3,7 +3,7 @@ return {
|
||||
dependencies = { "https://github.com/MunifTanjim/nui.nvim" },
|
||||
event = "VeryLazy",
|
||||
opts = {
|
||||
messages = { enabled = false },
|
||||
-- messages = { enabled = false },
|
||||
views = {
|
||||
history = {
|
||||
{ event = "lsp", kind = "" },
|
||||
|
||||
70
nvim/.config/nvim/lua/plugins/nvim-cmp.lua
Normal file
70
nvim/.config/nvim/lua/plugins/nvim-cmp.lua
Normal file
@@ -0,0 +1,70 @@
|
||||
return
|
||||
{
|
||||
'hrsh7th/nvim-cmp',
|
||||
event = 'InsertEnter',
|
||||
dependencies = {
|
||||
'L3MON4D3/LuaSnip',
|
||||
'hrsh7th/cmp-buffer',
|
||||
'hrsh7th/cmp-path',
|
||||
'hrsh7th/cmp-nvim-lsp',
|
||||
-- TODO: Do I need these?
|
||||
'hrsh7th/cmp-cmdline',
|
||||
-- 'hrsh7th/cmp-nvim-lsp-signature-help',
|
||||
'saadparwaiz1/cmp_luasnip'
|
||||
},
|
||||
config = function()
|
||||
local cmp = require('cmp')
|
||||
|
||||
cmp.setup({
|
||||
snippet = {
|
||||
-- REQUIRED - you must specify a snippet engine
|
||||
expand = function(args)
|
||||
require('luasnip').lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
-- window = {
|
||||
-- -- completion = cmp.config.window.bordered(),
|
||||
-- -- documentation = cmp.config.window.bordered(),
|
||||
-- },
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
['<C-Space>'] = cmp.mapping.complete(),
|
||||
['<C-e>'] = cmp.mapping.abort(),
|
||||
['<Tab>'] = cmp.mapping.confirm({ select = true }),
|
||||
}),
|
||||
sources = cmp.config.sources({
|
||||
{ name = 'nvim_lsp' },
|
||||
{ name = 'luasnip' },
|
||||
}, {
|
||||
{ name = 'buffer' },
|
||||
})
|
||||
})
|
||||
|
||||
-- -- To use git you need to install the plugin petertriho/cmp-git and uncomment lines below
|
||||
-- -- Set configuration for specific filetype.
|
||||
-- cmp.setup.filetype('gitcommit', {
|
||||
-- sources = cmp.config.sources({
|
||||
-- { name = 'git' },
|
||||
-- }, {
|
||||
-- { name = 'buffer' },
|
||||
-- })
|
||||
-- })
|
||||
-- require("cmp_git").setup()
|
||||
|
||||
-- Use buffer source for `/` and `?` (if you enabled `native_menu`, this won't work anymore).
|
||||
cmp.setup.cmdline({ '/', '?' }, {
|
||||
mapping = cmp.mapping.preset.cmdline(),
|
||||
sources = {
|
||||
{ name = 'buffer' }
|
||||
}
|
||||
})
|
||||
|
||||
-- -- Set up lspconfig.
|
||||
-- local capabilities = require('cmp_nvim_lsp').default_capabilities()
|
||||
-- -- Replace <YOUR_LSP_SERVER> with each lsp server you've enabled.
|
||||
-- vim.lsp.config('<YOUR_LSP_SERVER>', {
|
||||
-- capabilities = capabilities
|
||||
-- })
|
||||
-- vim.lsp.enable('<YOUR_LSP_SERVER>')
|
||||
end
|
||||
|
||||
}
|
||||
@@ -1,23 +1,29 @@
|
||||
return {
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
branch = 'main',
|
||||
lazy = false, -- This plugin does not support lazy loading
|
||||
build = ":TSUpdate",
|
||||
opts = {
|
||||
branxh = "main",
|
||||
lazy = false, -- This plugin doesn't support lazy loading
|
||||
config = function(_, opts)
|
||||
require("nvim-treesitter.configs").setup({
|
||||
ensure_installed = {
|
||||
"cpp",
|
||||
"c",
|
||||
"python",
|
||||
"rust",
|
||||
"lua",
|
||||
"markdown",
|
||||
"vim",
|
||||
"vimdoc",
|
||||
"query"
|
||||
},
|
||||
sync_install = false,
|
||||
auto_install = true,
|
||||
highlight = {
|
||||
-- disable = { "latex" },
|
||||
enable = true,
|
||||
-- TODO: Is this required?
|
||||
additional_vim_regex_highlighting = { "latex" } -- Required for vimtex
|
||||
additional_vim_regex_highlighting = {
|
||||
"latex"
|
||||
}
|
||||
}
|
||||
})
|
||||
end
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,28 +22,26 @@ return {
|
||||
|
||||
-- Concealment
|
||||
|
||||
-- TODO: Use lua instead of vimscript
|
||||
vim.cmd([[set conceallevel=1]])
|
||||
vim.cmd([[
|
||||
let g:vimtex_syntax_conceal = {
|
||||
\ 'accents': 1,
|
||||
\ 'ligatures': 1,
|
||||
\ 'cites': 1,
|
||||
\ 'fancy': 1,
|
||||
\ 'spacing': 0,
|
||||
\ 'greek': 1,
|
||||
\ 'math_bounds': 1,
|
||||
\ 'math_delimiters': 1,
|
||||
\ 'math_fracs': 1,
|
||||
\ 'math_super_sub': 0,
|
||||
\ 'math_symbols': 1,
|
||||
\ 'sections': 0,
|
||||
\ 'styles': 0,
|
||||
\}
|
||||
vim.o.conceallevel = 1
|
||||
|
||||
let g:vimtex_syntax_custom_cmds = [
|
||||
\ {'name': 'bm', 'mathmode': 1, 'argstyle': 'bold', 'conceal': 1},
|
||||
\]
|
||||
]])
|
||||
vim.g.vimtex_syntax_conceal = {
|
||||
accents = 1,
|
||||
ligatures = 1,
|
||||
cites = 1,
|
||||
fancy = 1,
|
||||
spacing = 0,
|
||||
greek = 1,
|
||||
math_bounds = 1,
|
||||
math_delimiters = 1,
|
||||
math_fracs = 1,
|
||||
math_super_sub = 0,
|
||||
math_symbols = 1,
|
||||
sections = 0,
|
||||
styles = 0,
|
||||
}
|
||||
|
||||
vim.g.vimtex_syntax_custom_cmds = {
|
||||
{ name = 'bm', mathmode = 1, argstyle = 'bold', conceal = 1 },
|
||||
}
|
||||
end
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user