11 Commits

11 changed files with 186 additions and 208 deletions

View File

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

View File

@@ -2,26 +2,31 @@
"LuaSnip": { "branch": "master", "commit": "3732756842a2f7e0e76a7b0487e9692072857277" }, "LuaSnip": { "branch": "master", "commit": "3732756842a2f7e0e76a7b0487e9692072857277" },
"alpha-nvim": { "branch": "main", "commit": "3979b01cb05734331c7873049001d3f2bb8477f4" }, "alpha-nvim": { "branch": "main", "commit": "3979b01cb05734331c7873049001d3f2bb8477f4" },
"auto-session": { "branch": "main", "commit": "292492ab7af4bd8b9e37e28508bc8ce995722fd5" }, "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" }, "friendly-snippets": { "branch": "main", "commit": "572f5660cf05f8cd8834e096d7b4c921ba18e175" },
"gruvbox.nvim": { "branch": "main", "commit": "5e0a460d8e0f7f669c158dedd5f9ae2bcac31437" }, "gruvbox.nvim": { "branch": "main", "commit": "5e0a460d8e0f7f669c158dedd5f9ae2bcac31437" },
"harpoon": { "branch": "harpoon2", "commit": "87b1a3506211538f460786c23f98ec63ad9af4e5" }, "harpoon": { "branch": "harpoon2", "commit": "87b1a3506211538f460786c23f98ec63ad9af4e5" },
"lazy.nvim": { "branch": "main", "commit": "85c7ff3711b730b4030d03144f6db6375044ae82" }, "lazy.nvim": { "branch": "main", "commit": "85c7ff3711b730b4030d03144f6db6375044ae82" },
"lualine.nvim": { "branch": "master", "commit": "3946f0122255bc377d14a59b27b609fb3ab25768" }, "lualine.nvim": { "branch": "master", "commit": "3946f0122255bc377d14a59b27b609fb3ab25768" },
"markview.nvim": { "branch": "main", "commit": "31f9a2611e0f373d19281c129b9a40272c124d26" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "b1d9a914b02ba5660f1e272a03314b31d4576fe2" }, "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" }, "noice.nvim": { "branch": "main", "commit": "7bfd942445fb63089b59f97ca487d605e715f155" },
"nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" }, "nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" },
"nvim-lspconfig": { "branch": "master", "commit": "2010fc6ec03e2da552b4886fceb2f7bc0fc2e9c0" }, "nvim-cmp": { "branch": "main", "commit": "d78fb3b64eedb701c9939f97361c06483af575e0" },
"nvim-treesitter": { "branch": "main", "commit": "81aec1e45d58b587fa055a938cd6642c6b94ba4d" }, "nvim-lspconfig": { "branch": "master", "commit": "abf6d190f2c06818489c0bd4b926e7e3a06c5e51" },
"nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" },
"nvim-web-devicons": { "branch": "master", "commit": "8dcb311b0c92d460fac00eac706abd43d94d68af" }, "nvim-web-devicons": { "branch": "master", "commit": "8dcb311b0c92d460fac00eac706abd43d94d68af" },
"oil.nvim": { "branch": "master", "commit": "7e1cd7703ff2924d7038476dcbc04b950203b902" }, "oil.nvim": { "branch": "master", "commit": "7e1cd7703ff2924d7038476dcbc04b950203b902" },
"outline.nvim": { "branch": "main", "commit": "6b62f73a6bf317531d15a7ae1b724e85485d8148" }, "outline.nvim": { "branch": "main", "commit": "6b62f73a6bf317531d15a7ae1b724e85485d8148" },
"plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" }, "plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" },
"sqlite.nvim": { "branch": "master", "commit": "a8466c830a89794c2eafa41b41dd11fdf4a0d7ca" }, "sqlite.nvim": { "branch": "master", "commit": "a8466c830a89794c2eafa41b41dd11fdf4a0d7ca" },
"telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" }, "telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" },
"telescope.nvim": { "branch": "master", "commit": "0294ae3eafe662c438addb8692d9c98ef73a983e" }, "telescope.nvim": { "branch": "master", "commit": "3a12a853ebf21ec1cce9a92290e3013f8ae75f02" },
"time-tracker.nvim": { "branch": "master", "commit": "4127c4b5fecaf5f5cb3aa840707e58bb88eb9bf0" }, "time-tracker.nvim": { "branch": "master", "commit": "4127c4b5fecaf5f5cb3aa840707e58bb88eb9bf0" },
"todo-comments.nvim": { "branch": "main", "commit": "31e3c38ce9b29781e4422fc0322eb0a21f4e8668" }, "todo-comments.nvim": { "branch": "main", "commit": "31e3c38ce9b29781e4422fc0322eb0a21f4e8668" },
"toggleterm.nvim": { "branch": "main", "commit": "9a88eae817ef395952e08650b3283726786fb5fb" }, "toggleterm.nvim": { "branch": "main", "commit": "9a88eae817ef395952e08650b3283726786fb5fb" },
@@ -29,6 +34,6 @@
"vim-flog": { "branch": "master", "commit": "665b16ac8915f746bc43c9572b4581a5e9047216" }, "vim-flog": { "branch": "master", "commit": "665b16ac8915f746bc43c9572b4581a5e9047216" },
"vim-fugitive": { "branch": "master", "commit": "61b51c09b7c9ce04e821f6cf76ea4f6f903e3cf4" }, "vim-fugitive": { "branch": "master", "commit": "61b51c09b7c9ce04e821f6cf76ea4f6f903e3cf4" },
"vim-surround": { "branch": "master", "commit": "3d188ed2113431cf8dac77be61b842acb64433d9" }, "vim-surround": { "branch": "master", "commit": "3d188ed2113431cf8dac77be61b842acb64433d9" },
"vimtex": { "branch": "master", "commit": "4ee6801bf6bd48420c31da6b59ed24ba720b18d9" }, "vimtex": { "branch": "master", "commit": "32bcb3922c20588e00de68f73c86312eda2141ad" },
"which-key.nvim": { "branch": "main", "commit": "3aab2147e74890957785941f0c1ad87d0a44c15a" } "which-key.nvim": { "branch": "main", "commit": "3aab2147e74890957785941f0c1ad87d0a44c15a" }
} }

View File

@@ -31,64 +31,21 @@ vim.lsp.config("texlab", {
}) })
vim.lsp.config('clangd', {
-- cmd = {
-- "clangd",
-- Completion config "--background-index",
-- "--clang-tidy",
-- "--completion-style=bundled",
"--cross-file-rename",
"--header-insertion=iwyu",
vim.o.completeopt = "menu,menuone,noinsert,fuzzy" -- Required for embedded system compilers
"--query-driver=/**/*g++",
vim.api.nvim_set_keymap("i", "<C-Space>", "<C-x><C-o>", { noremap = true }) "--offset-encoding=utf-16"
-- "-j=8",
vim.api.nvim_create_autocmd('LspAttach', { -- "--malloc-trim",
group = vim.api.nvim_create_augroup('my.lsp', {}), -- "--pch-storage=memory"
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,
}) })
@@ -125,3 +82,38 @@ vim.api.nvim_create_autocmd("CursorHold", {
}) })
end, 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

@@ -6,16 +6,12 @@ return {
local loader = require("luasnip.loaders.from_lua") local loader = require("luasnip.loaders.from_lua")
loader.lazy_load({ paths = { "./snippets" } }) loader.lazy_load({ paths = { "./snippets" } })
-- TODO: Find out how to enable autosnippets without having the status line disappear
require("luasnip").config.set_config({ require("luasnip").config.set_config({
-- enable_autosnippets = true, enable_autosnippets = true,
store_selection_keys = "<leader>v" store_selection_keys = "<leader>v"
}) })
vim.keymap.set({ "i", "s" }, "<c-j>", function() require("luasnip").jump(1) end, { silent = true }) vim.keymap.set({ "i", "s" }, "<c-j>", function() require("luasnip").jump(1) end, { silent = true })
vim.keymap.set({ "i", "s" }, "<c-k>", function() require("luasnip").jump(-1) end, { silent = true }) vim.keymap.set({ "i", "s" }, "<c-k>", function() require("luasnip").jump(-1) end, { silent = true })
-- TODO: Is this keymap used?
vim.keymap.set({ "i" }, "<c-j>", function() require("luasnip").expand() end, { silent = true })
end end
} }

View File

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

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" }, dependencies = { "https://github.com/MunifTanjim/nui.nvim" },
event = "VeryLazy", event = "VeryLazy",
opts = { opts = {
messages = { enabled = false }, -- messages = { enabled = false },
views = { views = {
history = { history = {
{ event = "lsp", kind = "" }, { 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 { return {
{
"nvim-treesitter/nvim-treesitter", "nvim-treesitter/nvim-treesitter",
branch = 'main',
lazy = false, -- This plugin does not support lazy loading
build = ":TSUpdate", build = ":TSUpdate",
opts = { branxh = "main",
lazy = false, -- This plugin doesn't support lazy loading
config = function(_, opts)
require("nvim-treesitter.configs").setup({
ensure_installed = { ensure_installed = {
"cpp", "cpp",
"c", "c",
"python",
"rust",
"lua", "lua",
"markdown", "vim",
"vimdoc", "vimdoc",
"query"
}, },
sync_install = false,
auto_install = true, auto_install = true,
highlight = { highlight = {
-- disable = { "latex" },
enable = true, enable = true,
-- TODO: Is this required? additional_vim_regex_highlighting = {
additional_vim_regex_highlighting = { "latex" } -- Required for vimtex "latex"
} }
} }
})
end
}
} }

View File

@@ -1,9 +1,6 @@
return { return {
"lervag/vimtex", "lervag/vimtex",
ft = { lazy = false, -- For backward search to work, :VimtexInverseSearch must always be available
"tex",
"bib"
},
config = function() config = function()
-- General configuration -- General configuration
@@ -20,44 +17,31 @@ return {
} }
} }
-- TODO: Fix `VimTex: Viewer cannot find Zathura window ID` vim.g.vimtex_view_method = 'zathura_simple'
vim.g.vimtex_view_method = 'zathura'
vim.g.vimtex_quickfix_mode = 0 vim.g.vimtex_quickfix_mode = 0
-- Concealment -- Concealment
-- TODO: Use lua instead of vimscript vim.o.conceallevel = 1
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,
\}
let g:vimtex_syntax_custom_cmds = [ vim.g.vimtex_syntax_conceal = {
\ {'name': 'bm', 'mathmode': 1, 'argstyle': 'bold', 'conceal': 1}, 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,
}
-- Synctex configuration vim.g.vimtex_syntax_custom_cmds = {
{ name = 'bm', mathmode = 1, argstyle = 'bold', conceal = 1 },
vim.g.vimtex_compiler_progname = 'nvr' }
local options = string.format(
'--reuse-window --inverse-search="nvr --servername %s +%%2 %%1" --forward-search-file @tex --forward-search-line @line @pdf',
vim.v.servername)
local command = string.format("let g:vimtex_view_general_options='%s'", options)
vim.cmd(command)
end end
} }

View File

@@ -13,10 +13,10 @@ set completion-highlight-bg "rgba(131,165,152,1)" # bright:blue
set completion-highlight-fg "rgba(80,73,69,1)" # bg2 set completion-highlight-fg "rgba(80,73,69,1)" # bg2
# Define the color in index mode # Define the color in index mode
set index-bg "rgba(80,73,69,1)" # bg2 # set index-bg "rgba(80,73,69,1)" # bg2
set index-fg "rgba(235,219,178,1)" # fg # set index-fg "rgba(235,219,178,1)" # fg
set index-active-bg "rgba(131,165,152,1)" # bright:blue # set index-active-bg "rgba(131,165,152,1)" # bright:blue
set index-active-fg "rgba(80,73,69,1)" # bg2 # set index-active-fg "rgba(80,73,69,1)" # bg2
set inputbar-bg "rgba(29,32,33,1)" # bg set inputbar-bg "rgba(29,32,33,1)" # bg
set inputbar-fg "rgba(235,219,178,1)" # fg set inputbar-fg "rgba(235,219,178,1)" # fg