summaryrefslogtreecommitdiff
path: root/lua/aotrix
diff options
context:
space:
mode:
authorAotrix <[email protected]>2025-02-25 16:30:53 +0100
committerAotrix <[email protected]>2025-02-25 16:30:53 +0100
commit5d43db62374c9ca23198f94f3d92367f0796f94d (patch)
tree544b8a9b2b48666643abffc3cf8d5954b9fce9c0 /lua/aotrix
parent18751830d1d73c87c19019d56ddd8014db5a433b (diff)
added compiler.nvim
Diffstat (limited to 'lua/aotrix')
-rw-r--r--lua/aotrix/plugins/autoformat.lua1
-rw-r--r--lua/aotrix/plugins/compiler.lua28
-rw-r--r--lua/aotrix/plugins/telescope.lua98
3 files changed, 92 insertions, 35 deletions
diff --git a/lua/aotrix/plugins/autoformat.lua b/lua/aotrix/plugins/autoformat.lua
index d46f8af..05ae2f9 100644
--- a/lua/aotrix/plugins/autoformat.lua
+++ b/lua/aotrix/plugins/autoformat.lua
@@ -5,7 +5,6 @@ return {
format_on_save = {timeout_ms = 500, lsp_fallback = true},
formatters_by_ft = {
lua = {"lua-format"},
- python = {"black", "pyink"},
cpp = {"clang_format"},
cmake = {"cmake_format"}
},
diff --git a/lua/aotrix/plugins/compiler.lua b/lua/aotrix/plugins/compiler.lua
new file mode 100644
index 0000000..b0c7b45
--- /dev/null
+++ b/lua/aotrix/plugins/compiler.lua
@@ -0,0 +1,28 @@
+return {
+ "Zeioth/compiler.nvim",
+ dependencies = {
+ {
+ "stevearc/overseer.nvim",
+ opts = {
+ task_list = { -- this refers to the window that shows the result
+ direction = "bottom",
+ min_height = 25,
+ max_height = 25,
+ default_detail = 1,
+ bindings = {["q"] = function()
+ vim.cmd("OverseerClose")
+ end}
+ }
+ },
+ config = function(_, opts)
+ require("overseer").setup(opts)
+ end
+ }
+ },
+ cmd = {"CompilerOpen", "CompilerToggleResults"},
+ opts = {},
+ keys = {
+ {"mt", "<cmd>CompilerOpen<cr>", desc = "[M]ake [T]arget"},
+ {"mr", "<cmd>CompilerToggleResults<cr>", desc = "[M]ake [R]esults"}
+ }
+}
diff --git a/lua/aotrix/plugins/telescope.lua b/lua/aotrix/plugins/telescope.lua
index 27edfd0..e71e7c5 100644
--- a/lua/aotrix/plugins/telescope.lua
+++ b/lua/aotrix/plugins/telescope.lua
@@ -1,12 +1,12 @@
return {
- 'nvim-telescope/telescope.nvim', tag = '0.1.5',
+ 'nvim-telescope/telescope.nvim',
+ tag = '0.1.5',
-- or , branch = '0.1.x',
- dependencies = {
- 'nvim-lua/plenary.nvim',
- 'nvim-telescope/telescope-live-grep-args.nvim',
+ dependencies = {
+ 'nvim-lua/plenary.nvim', 'nvim-telescope/telescope-live-grep-args.nvim',
'nvim-telescope/telescope-file-browser.nvim',
{'nvim-telescope/telescope-fzf-native.nvim', build = 'make'},
- 'nvim-telescope/telescope-ui-select.nvim',
+ 'nvim-telescope/telescope-ui-select.nvim'
},
config = function()
@@ -20,28 +20,31 @@ return {
-- map actions.which_key to <C-h> (default: <C-/>)
-- actions.which_key shows the mappings for your picker,
-- e.g. git_{create, delete, ...}_branch for the git_branches picker
- ["<esc>"] = actions.close,
+ ["<esc>"] = actions.close
}
}
},
extensions = {
fzf = {},
- ['ui-select'] = {
- require('telescope.themes').get_dropdown(),
- },
- },
+ ['ui-select'] = {require('telescope.themes').get_dropdown()}
+ }
})
pcall(require('telescope').load_extension, 'fzf')
pcall(require('telescope').load_extension, 'ui-select')
- vim.keymap.set("n", "<leader>pv", function() require("telescope").extensions.file_browser.file_browser() end)
- vim.keymap.set("n", "<leader>pf", function() require("telescope.builtin").find_files() end)
+ vim.keymap.set("n", "<leader>pv", function()
+ require("telescope").extensions.file_browser.file_browser()
+ end)
+ vim.keymap.set("n", "<leader>pf",
+ function()
+ require("telescope.builtin").find_files()
+ end)
require('aotrix.multigrep').setup()
vim.api.nvim_create_autocmd('LspAttach', {
- group = vim.api.nvim_create_augroup('lsp-attach', { clear = true }),
+ group = vim.api.nvim_create_augroup('lsp-attach', {clear = true}),
callback = function(event)
-- NOTE: Remember that Lua is a real programming language, and as such it is possible
-- to define small helper and utility functions so you don't have to repeat yourself.
@@ -50,33 +53,43 @@ return {
-- for LSP related items. It sets the mode, buffer and description for us each time.
local map = function(keys, func, desc, mode)
mode = mode or 'n'
- vim.keymap.set(mode, keys, func, { buffer = event.buf, desc = 'LSP: ' .. desc })
+ vim.keymap.set(mode, keys, func,
+ {buffer = event.buf, desc = 'LSP: ' .. desc})
end
-- Jump to the definition of the word under your cursor.
-- This is where a variable was first declared, or where a function is defined, etc.
-- To jump back, press <C-t>.
- map('gd', require('telescope.builtin').lsp_definitions, '[G]oto [D]efinition')
+ map('gd', require('telescope.builtin').lsp_definitions,
+ '[G]oto [D]efinition')
-- Find references for the word under your cursor.
- map('gr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences')
+ map('gr', require('telescope.builtin').lsp_references,
+ '[G]oto [R]eferences')
-- Jump to the implementation of the word under your cursor.
-- Useful when your language has ways of declaring types without an actual implementation.
- map('gI', require('telescope.builtin').lsp_implementations, '[G]oto [I]mplementation')
+ map('gI', require('telescope.builtin').lsp_implementations,
+ '[G]oto [I]mplementation')
-- Jump to the type of the word under your cursor.
-- Useful when you're not sure what type a variable is and you want to see
-- the definition of its *type*, not where it was *defined*.
- map('<leader>D', require('telescope.builtin').lsp_type_definitions, 'Type [D]efinition')
+ map('<leader>D',
+ require('telescope.builtin').lsp_type_definitions,
+ 'Type [D]efinition')
-- Fuzzy find all the symbols in your current document.
-- Symbols are things like variables, functions, types, etc.
- map('<leader>ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols')
+ map('<leader>ds',
+ require('telescope.builtin').lsp_document_symbols,
+ '[D]ocument [S]ymbols')
-- Fuzzy find all the symbols in your current workspace.
-- Similar to document symbols, except searches over your entire project.
- map('<leader>ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols')
+ map('<leader>ws',
+ require('telescope.builtin').lsp_dynamic_workspace_symbols,
+ '[W]orkspace [S]ymbols')
-- Rename the variable under your cursor.
-- Most Language Servers support renaming across files, etc.
@@ -84,7 +97,8 @@ return {
-- Execute a code action, usually your cursor needs to be on top of an error
-- or a suggestion from your LSP for this to activate.
- map('<leader>ca', vim.lsp.buf.code_action, '[C]ode [A]ction', { 'n', 'x' })
+ map('<leader>ca', vim.lsp.buf.code_action, '[C]ode [A]ction',
+ {'n', 'x'})
-- WARN: This is not Goto Definition, this is Goto Declaration.
-- For example, in C this would take you to the header.
@@ -99,7 +113,7 @@ return {
if vim.fn.has 'nvim-0.11' == 1 then
return client:supports_method(method, bufnr)
else
- return client.supports_method(method, { bufnr = bufnr })
+ return client.supports_method(method, {bufnr = bufnr})
end
end
@@ -109,26 +123,36 @@ return {
--
-- When you move your cursor, the highlights will be cleared (the second autocommand).
local client = vim.lsp.get_client_by_id(event.data.client_id)
- if client and client_supports_method(client, vim.lsp.protocol.Methods.textDocument_documentHighlight, event.buf) then
- local highlight_augroup = vim.api.nvim_create_augroup('lsp-highlight', { clear = false })
- vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, {
+ if client and client_supports_method(client, vim.lsp.protocol
+ .Methods
+ .textDocument_documentHighlight,
+ event.buf) then
+ local highlight_augroup =
+ vim.api.nvim_create_augroup('lsp-highlight',
+ {clear = false})
+ vim.api.nvim_create_autocmd({'CursorHold', 'CursorHoldI'}, {
buffer = event.buf,
group = highlight_augroup,
- callback = vim.lsp.buf.document_highlight,
+ callback = vim.lsp.buf.document_highlight
})
- vim.api.nvim_create_autocmd({ 'CursorMoved', 'CursorMovedI' }, {
+ vim.api.nvim_create_autocmd({'CursorMoved', 'CursorMovedI'},
+ {
buffer = event.buf,
group = highlight_augroup,
- callback = vim.lsp.buf.clear_references,
+ callback = vim.lsp.buf.clear_references
})
vim.api.nvim_create_autocmd('LspDetach', {
- group = vim.api.nvim_create_augroup('lsp-detach', { clear = true }),
+ group = vim.api.nvim_create_augroup('lsp-detach',
+ {clear = true}),
callback = function(event2)
vim.lsp.buf.clear_references()
- vim.api.nvim_clear_autocmds { group = 'lsp-highlight', buffer = event2.buf }
- end,
+ vim.api.nvim_clear_autocmds {
+ group = 'lsp-highlight',
+ buffer = event2.buf
+ }
+ end
})
end
@@ -136,12 +160,18 @@ return {
-- code, if the language server you are using supports them
--
-- This may be unwanted, since they displace some of your code
- if client and client_supports_method(client, vim.lsp.protocol.Methods.textDocument_inlayHint, event.buf) then
+ if client and
+ client_supports_method(client, vim.lsp.protocol.Methods
+ .textDocument_inlayHint,
+ event.buf) then
map('<leader>th', function()
- vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled { bufnr = event.buf })
+ vim.lsp.inlay_hint.enable(
+ not vim.lsp.inlay_hint.is_enabled {
+ bufnr = event.buf
+ })
end, '[T]oggle Inlay [H]ints')
end
- end,
+ end
})
end