Simplify autocomplete config, neovide config, compile command like emacs
This commit is contained in:
parent
11ccd37e73
commit
a579f0011f
104
init.lua
104
init.lua
|
|
@ -9,6 +9,12 @@ vim.cmd("imap <C-g> <Esc>")
|
|||
vim.cmd("lmap <C-g> <Esc>")
|
||||
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
|
||||
-- Exit terminal mode with Esc
|
||||
-- vim.cmd("tnoremap <Esc> <C-\\><C-n>")
|
||||
|
|
@ -21,9 +27,11 @@ vim.api.nvim_create_autocmd({ 'VimEnter' }, {
|
|||
command = 'startinsert',
|
||||
})
|
||||
|
||||
-- Enable line numbers
|
||||
-- vim.cmd("set number")
|
||||
-- Relative and Absolute line numbers. Hybrid.
|
||||
vim.opt.nu = true
|
||||
vim.opt.relativenumber = true
|
||||
vim.opt.nu = false
|
||||
vim.opt.relativenumber = false
|
||||
-- vim.o.statuscolumn = "%s %l %r " -- Both displayed on their own seperate lines
|
||||
|
||||
-- Highlight current cursor line
|
||||
|
|
@ -35,8 +43,6 @@ vim.api.nvim_set_option("clipboard", "unnamedplus")
|
|||
-- Lazy plugin manager
|
||||
require("config.lazy")
|
||||
|
||||
-- Enable line numbers
|
||||
vim.cmd("set number")
|
||||
-- Turn off highlighting after search completion
|
||||
vim.cmd("set nohlsearch")
|
||||
|
||||
|
|
@ -116,6 +122,15 @@ vim.api.nvim_create_autocmd({ 'TermRequest' }, {
|
|||
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
|
||||
vim.g.firenvim_config = {
|
||||
globalSettings = { alt = "all" },
|
||||
|
|
@ -138,6 +153,8 @@ if vim.g.started_by_firenvim == true then
|
|||
-- Press escape 2 times to leave editor
|
||||
vim.keymap.set("n", "<Esc><Esc>", "<Cmd>call firenvim#focus_page()<CR>", {})
|
||||
|
||||
|
||||
|
||||
-- Press shift enter to save and attempt to submit form on page
|
||||
local function saveAndEnter()
|
||||
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://github.com/neovim/nvim-lspconfig/blob/master/doc/configs.md
|
||||
lsp_zero.on_attach(function(client, bufnr)
|
||||
lsp_zero.default_keymaps({
|
||||
buffer = bufnr,
|
||||
preserve_mappings = false
|
||||
})
|
||||
lsp_zero.default_keymaps({
|
||||
buffer = bufnr,
|
||||
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)
|
||||
|
||||
--local lspconfig = require("lspconfig")
|
||||
|
|
@ -292,39 +327,26 @@ vim.lsp.enable("jsonls", {
|
|||
require('tiny-inline-diagnostic').setup()
|
||||
vim.diagnostic.config({ virtual_text = false }) -- Only if needed in your configuration, if you already have native LSP diagnostics
|
||||
|
||||
local cmp = require('cmp')
|
||||
cmp.setup({
|
||||
sources = {
|
||||
{name = 'nvim_lsp'},
|
||||
},
|
||||
mapping = {
|
||||
['<Tab>'] = cmp.mapping.confirm({select = true}),
|
||||
['<C-e>'] = cmp.mapping.abort(),
|
||||
['<Up>'] = cmp.mapping.select_prev_item({behavior = 'select'}),
|
||||
['<C-k>'] = cmp.mapping.select_prev_item({behavior = 'select'}),
|
||||
['<Down>'] = cmp.mapping.select_next_item({behavior = 'select'}),
|
||||
['<C-j>'] = cmp.mapping.select_next_item({behavior = 'select'}),
|
||||
['<C-p>'] = cmp.mapping(function()
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item({behavior = 'insert'})
|
||||
else
|
||||
cmp.complete()
|
||||
end
|
||||
end),
|
||||
['<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,
|
||||
},
|
||||
})
|
||||
-- Neovide Configuration
|
||||
if vim.g.neovide then
|
||||
vim.keymap.set('n', '<D-s>', ':w<CR>') -- Save
|
||||
vim.keymap.set('v', '<D-c>', '"+y') -- Copy
|
||||
vim.keymap.set('n', '<D-v>', '"+P') -- Paste normal mode
|
||||
vim.keymap.set('v', '<D-v>', '"+P') -- Paste visual mode
|
||||
vim.keymap.set('c', '<D-v>', '<C-R>+') -- Paste command mode
|
||||
vim.keymap.set('i', '<D-v>', '<ESC>l"+Pli') -- Paste insert mode
|
||||
|
||||
vim.keymap.set({ "n", "v" }, "<C-=>", ":lua vim.g.neovide_scale_factor = vim.g.neovide_scale_factor + 0.1<CR>")
|
||||
vim.keymap.set({ "n", "v" }, "<C-->", ":lua vim.g.neovide_scale_factor = vim.g.neovide_scale_factor - 0.1<CR>")
|
||||
vim.keymap.set({ "n" , "v" }, "<C-0>", ":lua vim.g.neovide_scale_factor = 1<CR>")
|
||||
end
|
||||
|
||||
-- Allow clipboard copy paste in neovim
|
||||
vim.api.nvim_set_keymap('', '<D-v>', '+p<CR>', { noremap = true, silent = true})
|
||||
vim.api.nvim_set_keymap('!', '<D-v>', '<C-R>+', { noremap = true, silent = true})
|
||||
vim.api.nvim_set_keymap('t', '<D-v>', '<C-R>+', { noremap = true, silent = true})
|
||||
vim.api.nvim_set_keymap('v', '<D-v>', '<C-R>+', { noremap = true, silent = true})
|
||||
|
||||
|
||||
-- DAP Configuration
|
||||
local dap = require("dap")
|
||||
|
|
|
|||
|
|
@ -1,30 +1,30 @@
|
|||
{
|
||||
"LuaSnip": { "branch": "master", "commit": "787dee55ca364cc9119787165418fe93b74c1842" },
|
||||
"cmp-nvim-lsp": { "branch": "main", "commit": "cbc7b02bb99fae35cb42f514762b89b5126651ef" },
|
||||
"LuaSnip": { "branch": "master", "commit": "3732756842a2f7e0e76a7b0487e9692072857277" },
|
||||
"baleia.nvim": { "branch": "main", "commit": "fb3aff021b2b64ef820d0230d2c22ebfaf71bb6a" },
|
||||
"compile-mode.nvim": { "branch": "main", "commit": "e94543312729df6cc6efc8a136e9a58d52099df2" },
|
||||
"cord.nvim": { "branch": "master", "commit": "1af0ff6826b10f9ae8b01c63d16a90b8b31e7c48" },
|
||||
"dashboard-nvim": { "branch": "master", "commit": "0775e567b6c0be96d01a61795f7b64c1758262f6" },
|
||||
"firenvim": { "branch": "master", "commit": "a18ef908ac06b52ad9333b70e3e630b0a56ecb3d" },
|
||||
"gitsigns.nvim": { "branch": "main", "commit": "20ad4419564d6e22b189f6738116b38871082332" },
|
||||
"gitsigns.nvim": { "branch": "main", "commit": "cdafc320f03f2572c40ab93a4eecb733d4016d07" },
|
||||
"gruvbox.nvim": { "branch": "main", "commit": "5e0a460d8e0f7f669c158dedd5f9ae2bcac31437" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "85c7ff3711b730b4030d03144f6db6375044ae82" },
|
||||
"lsp-zero.nvim": { "branch": "v3.x", "commit": "77550f2f6cbf0959ef1583d845661af075f3442b" },
|
||||
"mini.statusline": { "branch": "main", "commit": "14919901649d20d020e659c63c03baa75cd94f33" },
|
||||
"neogen": { "branch": "main", "commit": "d7f9461727751fb07f82011051338a9aba07581d" },
|
||||
"nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" },
|
||||
"nvim-cmp": { "branch": "main", "commit": "62b4ee61bec7ece12a4ac0c7acc325ca118a886f" },
|
||||
"nvim-dap": { "branch": "master", "commit": "b38f7d30366d9169d0a623c4c85fbcf99d8d58bb" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "abf6d190f2c06818489c0bd4b926e7e3a06c5e51" },
|
||||
"nvim-tree.lua": { "branch": "master", "commit": "1eda2569394f866360e61f590f1796877388cb8a" },
|
||||
"nvim-dap": { "branch": "master", "commit": "5860c7c501eb428d3137ee22c522828d20cca0b3" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "f1237a8b3c243608a7116fa1ad216c441d7c2264" },
|
||||
"nvim-tree.lua": { "branch": "master", "commit": "3fb91e18a727ecc0385637895ec397dea90be42a" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" },
|
||||
"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" },
|
||||
"snacks.nvim": { "branch": "main", "commit": "836e07336ba523d4da480cd66f0241815393e98e" },
|
||||
"telescope.nvim": { "branch": "master", "commit": "3a12a853ebf21ec1cce9a92290e3013f8ae75f02" },
|
||||
"tiny-inline-diagnostic.nvim": { "branch": "main", "commit": "71f998696a4d63a1fa42a6c70d5931a2001e485b" },
|
||||
"snacks.nvim": { "branch": "main", "commit": "fe7cfe9800a182274d0f868a74b7263b8c0c020b" },
|
||||
"telescope.nvim": { "branch": "master", "commit": "1f8a534a320dca8d73f6de58c2e8eea4dd4ced89" },
|
||||
"tiny-inline-diagnostic.nvim": { "branch": "main", "commit": "44b61d4cb9dd6c423793e6cb21dcc313d223e690" },
|
||||
"vim-jsdoc": { "branch": "master", "commit": "6e5bc2a1f98a69e4902081c9f5969b228a7a5fd6" },
|
||||
"vim-suda": { "branch": "master", "commit": "c492741b4679b3cdd4d9e34138209784e061d916" },
|
||||
"which-key.nvim": { "branch": "main", "commit": "3aab2147e74890957785941f0c1ad87d0a44c15a" },
|
||||
"xcodebuild.nvim": { "branch": "main", "commit": "c6b573db1c584e0c36ee7719e6117b10d4100f73" },
|
||||
"yui": { "branch": "master", "commit": "ec7141eba11f43faf3187649114213a30f5b4ce6" }
|
||||
"xcodebuild.nvim": { "branch": "main", "commit": "54e826a31e5b882d132e2576d477893b3d7edd8a" },
|
||||
"yui": { "branch": "master", "commit": "141b95aac549639bf12e948e3f03e39fff7cb5f0" }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
},
|
||||
} ,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
@ -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
|
||||
}
|
||||
Loading…
Reference in New Issue