Compare commits

...

5 Commits

8 changed files with 160 additions and 113 deletions

View File

@ -23,8 +23,5 @@ require("lazy").setup({
spec = {
{ import = "plugins" },
},
checker = { enabled = true },
change_detection = {
enabled = false
},
change_detection = { enabled = false },
})

View File

@ -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" },
"gruvbox-material": { "branch": "master", "commit": "4bfc6983abc249c5943a60d8eb3980a3c2ababe1" },
"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" },

View File

@ -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,
})

View File

@ -8,7 +8,7 @@ return {
-- 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"
})

View File

@ -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
-- }

View File

@ -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 = "" },

View 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
}

View File

@ -1,23 +1,29 @@
return {
"nvim-treesitter/nvim-treesitter",
branch = 'main',
lazy = false, -- This plugin does not support lazy loading
build = ":TSUpdate",
opts = {
ensure_installed = {
"cpp",
"c",
"python",
"rust",
"lua",
"markdown",
"vimdoc",
},
auto_install = true,
highlight = {
enable = true,
-- TODO: Is this required?
additional_vim_regex_highlighting = { "latex" } -- Required for vimtex
}
{
"nvim-treesitter/nvim-treesitter",
build = ":TSUpdate",
branxh = "main",
lazy = false, -- This plugin doesn't support lazy loading
config = function(_, opts)
require("nvim-treesitter.configs").setup({
ensure_installed = {
"cpp",
"c",
"lua",
"vim",
"vimdoc",
"query"
},
sync_install = false,
auto_install = true,
highlight = {
-- disable = { "latex" },
enable = true,
additional_vim_regex_highlighting = {
"latex"
}
}
})
end
}
}