Simplify autocomplete config, neovide config, compile command like emacs

This commit is contained in:
Curt Spark 2025-11-30 03:03:57 +00:00
parent 11ccd37e73
commit a579f0011f
6 changed files with 122 additions and 54 deletions

104
init.lua
View File

@ -9,6 +9,12 @@ vim.cmd("imap <C-g> <Esc>")
vim.cmd("lmap <C-g> <Esc>") vim.cmd("lmap <C-g> <Esc>")
vim.cmd("map <C-c> <Nop>") vim.cmd("map <C-c> <Nop>")
-- Tab Size
local set = vim.opt -- set options
set.tabstop = 8
set.softtabstop = 8
set.shiftwidth = 8
-- Terminal Config -- Terminal Config
-- Exit terminal mode with Esc -- Exit terminal mode with Esc
-- vim.cmd("tnoremap <Esc> <C-\\><C-n>") -- vim.cmd("tnoremap <Esc> <C-\\><C-n>")
@ -21,9 +27,11 @@ vim.api.nvim_create_autocmd({ 'VimEnter' }, {
command = 'startinsert', command = 'startinsert',
}) })
-- Enable line numbers
-- vim.cmd("set number")
-- Relative and Absolute line numbers. Hybrid. -- Relative and Absolute line numbers. Hybrid.
vim.opt.nu = true vim.opt.nu = false
vim.opt.relativenumber = true vim.opt.relativenumber = false
-- vim.o.statuscolumn = "%s %l %r " -- Both displayed on their own seperate lines -- vim.o.statuscolumn = "%s %l %r " -- Both displayed on their own seperate lines
-- Highlight current cursor line -- Highlight current cursor line
@ -35,8 +43,6 @@ vim.api.nvim_set_option("clipboard", "unnamedplus")
-- Lazy plugin manager -- Lazy plugin manager
require("config.lazy") require("config.lazy")
-- Enable line numbers
vim.cmd("set number")
-- Turn off highlighting after search completion -- Turn off highlighting after search completion
vim.cmd("set nohlsearch") vim.cmd("set nohlsearch")
@ -116,6 +122,15 @@ vim.api.nvim_create_autocmd({ 'TermRequest' }, {
end end
}) })
-- CME Configuration
-- Basically compile mode from emacs for neovim
vim.g.cme = {
-- Preferred user shell. Accepts any executor that supports -c.
shell = vim.o.shell,
-- Expand '%' to the current file name.
shell_expand = true,
}
-- Firenvim Configuration -- Firenvim Configuration
vim.g.firenvim_config = { vim.g.firenvim_config = {
globalSettings = { alt = "all" }, globalSettings = { alt = "all" },
@ -138,6 +153,8 @@ if vim.g.started_by_firenvim == true then
-- Press escape 2 times to leave editor -- Press escape 2 times to leave editor
vim.keymap.set("n", "<Esc><Esc>", "<Cmd>call firenvim#focus_page()<CR>", {}) vim.keymap.set("n", "<Esc><Esc>", "<Cmd>call firenvim#focus_page()<CR>", {})
-- Press shift enter to save and attempt to submit form on page -- Press shift enter to save and attempt to submit form on page
local function saveAndEnter() local function saveAndEnter()
vim.fn['firenvim#eval_js']('setTimeout (function() { document.activeElement.closest("form").submit(); }, 100)', 'MyFunction') vim.fn['firenvim#eval_js']('setTimeout (function() { document.activeElement.closest("form").submit(); }, 100)', 'MyFunction')
@ -186,10 +203,28 @@ local lsp_zero = require('lsp-zero')
-- https://lsp-zero.netlify.app/v3.x/language-server-configuration.html#default-keybindings -- https://lsp-zero.netlify.app/v3.x/language-server-configuration.html#default-keybindings
-- https://github.com/neovim/nvim-lspconfig/blob/master/doc/configs.md -- https://github.com/neovim/nvim-lspconfig/blob/master/doc/configs.md
lsp_zero.on_attach(function(client, bufnr) lsp_zero.on_attach(function(client, bufnr)
lsp_zero.default_keymaps({ lsp_zero.default_keymaps({
buffer = bufnr, buffer = bufnr,
preserve_mappings = false preserve_mappings = false
}) })
vim.lsp.completion.enable(true, client.id, bufnr, {
autotrigger = false,
convert = function(item)
return { abbr = item.label:gsub('%b()', '') }
end,
})
vim.lsp.inlay_hint.enable(true, { 0 })
vim.cmd("set tabstop=8")
vim.cmd("set shiftwidth=8")
vim.cmd("set softtabstop=8")
end)
-- LSP Autocompletion settings
vim.keymap.set('i', '<c-space>', function()
vim.lsp.completion.get()
end) end)
--local lspconfig = require("lspconfig") --local lspconfig = require("lspconfig")
@ -292,39 +327,26 @@ vim.lsp.enable("jsonls", {
require('tiny-inline-diagnostic').setup() require('tiny-inline-diagnostic').setup()
vim.diagnostic.config({ virtual_text = false }) -- Only if needed in your configuration, if you already have native LSP diagnostics vim.diagnostic.config({ virtual_text = false }) -- Only if needed in your configuration, if you already have native LSP diagnostics
local cmp = require('cmp') -- Neovide Configuration
cmp.setup({ if vim.g.neovide then
sources = { vim.keymap.set('n', '<D-s>', ':w<CR>') -- Save
{name = 'nvim_lsp'}, vim.keymap.set('v', '<D-c>', '"+y') -- Copy
}, vim.keymap.set('n', '<D-v>', '"+P') -- Paste normal mode
mapping = { vim.keymap.set('v', '<D-v>', '"+P') -- Paste visual mode
['<Tab>'] = cmp.mapping.confirm({select = true}), vim.keymap.set('c', '<D-v>', '<C-R>+') -- Paste command mode
['<C-e>'] = cmp.mapping.abort(), vim.keymap.set('i', '<D-v>', '<ESC>l"+Pli') -- Paste insert mode
['<Up>'] = cmp.mapping.select_prev_item({behavior = 'select'}),
['<C-k>'] = cmp.mapping.select_prev_item({behavior = 'select'}), vim.keymap.set({ "n", "v" }, "<C-=>", ":lua vim.g.neovide_scale_factor = vim.g.neovide_scale_factor + 0.1<CR>")
['<Down>'] = cmp.mapping.select_next_item({behavior = 'select'}), vim.keymap.set({ "n", "v" }, "<C-->", ":lua vim.g.neovide_scale_factor = vim.g.neovide_scale_factor - 0.1<CR>")
['<C-j>'] = cmp.mapping.select_next_item({behavior = 'select'}), vim.keymap.set({ "n" , "v" }, "<C-0>", ":lua vim.g.neovide_scale_factor = 1<CR>")
['<C-p>'] = cmp.mapping(function() end
if cmp.visible() then
cmp.select_prev_item({behavior = 'insert'}) -- Allow clipboard copy paste in neovim
else vim.api.nvim_set_keymap('', '<D-v>', '+p<CR>', { noremap = true, silent = true})
cmp.complete() vim.api.nvim_set_keymap('!', '<D-v>', '<C-R>+', { noremap = true, silent = true})
end vim.api.nvim_set_keymap('t', '<D-v>', '<C-R>+', { noremap = true, silent = true})
end), vim.api.nvim_set_keymap('v', '<D-v>', '<C-R>+', { noremap = true, silent = true})
['<C-n>'] = cmp.mapping(function()
if cmp.visible() then
cmp.select_next_item({behavior = 'insert'})
else
cmp.complete()
end
end),
},
snippet = {
expand = function(args)
require('luasnip').lsp_expand(args.body)
end,
},
})
-- DAP Configuration -- DAP Configuration
local dap = require("dap") local dap = require("dap")

View File

@ -1,30 +1,30 @@
{ {
"LuaSnip": { "branch": "master", "commit": "787dee55ca364cc9119787165418fe93b74c1842" }, "LuaSnip": { "branch": "master", "commit": "3732756842a2f7e0e76a7b0487e9692072857277" },
"cmp-nvim-lsp": { "branch": "main", "commit": "cbc7b02bb99fae35cb42f514762b89b5126651ef" }, "baleia.nvim": { "branch": "main", "commit": "fb3aff021b2b64ef820d0230d2c22ebfaf71bb6a" },
"compile-mode.nvim": { "branch": "main", "commit": "e94543312729df6cc6efc8a136e9a58d52099df2" },
"cord.nvim": { "branch": "master", "commit": "1af0ff6826b10f9ae8b01c63d16a90b8b31e7c48" }, "cord.nvim": { "branch": "master", "commit": "1af0ff6826b10f9ae8b01c63d16a90b8b31e7c48" },
"dashboard-nvim": { "branch": "master", "commit": "0775e567b6c0be96d01a61795f7b64c1758262f6" }, "dashboard-nvim": { "branch": "master", "commit": "0775e567b6c0be96d01a61795f7b64c1758262f6" },
"firenvim": { "branch": "master", "commit": "a18ef908ac06b52ad9333b70e3e630b0a56ecb3d" }, "firenvim": { "branch": "master", "commit": "a18ef908ac06b52ad9333b70e3e630b0a56ecb3d" },
"gitsigns.nvim": { "branch": "main", "commit": "20ad4419564d6e22b189f6738116b38871082332" }, "gitsigns.nvim": { "branch": "main", "commit": "cdafc320f03f2572c40ab93a4eecb733d4016d07" },
"gruvbox.nvim": { "branch": "main", "commit": "5e0a460d8e0f7f669c158dedd5f9ae2bcac31437" }, "gruvbox.nvim": { "branch": "main", "commit": "5e0a460d8e0f7f669c158dedd5f9ae2bcac31437" },
"lazy.nvim": { "branch": "main", "commit": "85c7ff3711b730b4030d03144f6db6375044ae82" }, "lazy.nvim": { "branch": "main", "commit": "85c7ff3711b730b4030d03144f6db6375044ae82" },
"lsp-zero.nvim": { "branch": "v3.x", "commit": "77550f2f6cbf0959ef1583d845661af075f3442b" }, "lsp-zero.nvim": { "branch": "v3.x", "commit": "77550f2f6cbf0959ef1583d845661af075f3442b" },
"mini.statusline": { "branch": "main", "commit": "14919901649d20d020e659c63c03baa75cd94f33" }, "mini.statusline": { "branch": "main", "commit": "14919901649d20d020e659c63c03baa75cd94f33" },
"neogen": { "branch": "main", "commit": "d7f9461727751fb07f82011051338a9aba07581d" }, "neogen": { "branch": "main", "commit": "d7f9461727751fb07f82011051338a9aba07581d" },
"nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" }, "nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" },
"nvim-cmp": { "branch": "main", "commit": "62b4ee61bec7ece12a4ac0c7acc325ca118a886f" }, "nvim-dap": { "branch": "master", "commit": "5860c7c501eb428d3137ee22c522828d20cca0b3" },
"nvim-dap": { "branch": "master", "commit": "b38f7d30366d9169d0a623c4c85fbcf99d8d58bb" }, "nvim-lspconfig": { "branch": "master", "commit": "f1237a8b3c243608a7116fa1ad216c441d7c2264" },
"nvim-lspconfig": { "branch": "master", "commit": "abf6d190f2c06818489c0bd4b926e7e3a06c5e51" }, "nvim-tree.lua": { "branch": "master", "commit": "3fb91e18a727ecc0385637895ec397dea90be42a" },
"nvim-tree.lua": { "branch": "master", "commit": "1eda2569394f866360e61f590f1796877388cb8a" },
"nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" }, "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": "01cb3a8ad7d5e8707041edc775af83dbf33838f4" },
"plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" }, "plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" },
"snacks.nvim": { "branch": "main", "commit": "836e07336ba523d4da480cd66f0241815393e98e" }, "snacks.nvim": { "branch": "main", "commit": "fe7cfe9800a182274d0f868a74b7263b8c0c020b" },
"telescope.nvim": { "branch": "master", "commit": "3a12a853ebf21ec1cce9a92290e3013f8ae75f02" }, "telescope.nvim": { "branch": "master", "commit": "1f8a534a320dca8d73f6de58c2e8eea4dd4ced89" },
"tiny-inline-diagnostic.nvim": { "branch": "main", "commit": "71f998696a4d63a1fa42a6c70d5931a2001e485b" }, "tiny-inline-diagnostic.nvim": { "branch": "main", "commit": "44b61d4cb9dd6c423793e6cb21dcc313d223e690" },
"vim-jsdoc": { "branch": "master", "commit": "6e5bc2a1f98a69e4902081c9f5969b228a7a5fd6" }, "vim-jsdoc": { "branch": "master", "commit": "6e5bc2a1f98a69e4902081c9f5969b228a7a5fd6" },
"vim-suda": { "branch": "master", "commit": "c492741b4679b3cdd4d9e34138209784e061d916" }, "vim-suda": { "branch": "master", "commit": "c492741b4679b3cdd4d9e34138209784e061d916" },
"which-key.nvim": { "branch": "main", "commit": "3aab2147e74890957785941f0c1ad87d0a44c15a" }, "which-key.nvim": { "branch": "main", "commit": "3aab2147e74890957785941f0c1ad87d0a44c15a" },
"xcodebuild.nvim": { "branch": "main", "commit": "c6b573db1c584e0c36ee7719e6117b10d4100f73" }, "xcodebuild.nvim": { "branch": "main", "commit": "54e826a31e5b882d132e2576d477893b3d7edd8a" },
"yui": { "branch": "master", "commit": "ec7141eba11f43faf3187649114213a30f5b4ce6" } "yui": { "branch": "master", "commit": "141b95aac549639bf12e948e3f03e39fff7cb5f0" }
} }

View File

@ -0,0 +1,17 @@
return {
"yilisharcs/cme.nvim",
specs = {
{
"https://github.com/nvim-lualine/lualine.nvim",
optional = true,
-- Fixes the small delay on `on_exit` updates
opts = {
options = {
refresh = {
statusline = 16,
},
} ,
},
},
},
}

View File

@ -0,0 +1,29 @@
return {
"ej-shafran/compile-mode.nvim",
version = "^5.0.0",
-- you can just use the latest version:
-- branch = "latest",
-- or the most up-to-date updates:
-- branch = "nightly",
dependencies = {
"nvim-lua/plenary.nvim",
-- if you want to enable coloring of ANSI escape codes in
-- compilation output, add:
{ "m00qek/baleia.nvim", tag = "v1.3.0" },
},
config = function()
---@type CompileModeOpts
vim.g.compile_mode = {
-- if you use something like `nvim-cmp` or `blink.cmp` for completion,
-- set this to fix tab completion in command mode:
-- input_word_completion = true,
-- to add ANSI escape code support, add:
baleia_setup = true,
-- to make `:Compile` replace special characters (e.g. `%`) in
-- the command (and behave more like `:!`), add:
-- bang_expansion = true,
}
end
}