From a07b964ee5f9ecef1939bbf5ecdb60ece8192151 Mon Sep 17 00:00:00 2001 From: "Christoph J. Scherr" Date: Wed, 6 Mar 2024 11:43:46 +0100 Subject: [PATCH] vscode --- init.lua | 5 +++++ lua/mappings.lua | 2 +- lua/vscode.lua | 23 +++++++++++++++++++++++ 3 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 lua/vscode.lua diff --git a/init.lua b/init.lua index f67b142..d86f4f2 100644 --- a/init.lua +++ b/init.lua @@ -137,6 +137,11 @@ local function augroup(name) return vim.api.nvim_create_augroup("plex_" .. name, {}) end +-- guis +if vim.g.vscode then + require("vscode") +end + -- mappings local load_mappings = function(section, mapping_opt) vim.schedule(function() diff --git a/lua/mappings.lua b/lua/mappings.lua index 4c43534..8dc931f 100644 --- a/lua/mappings.lua +++ b/lua/mappings.lua @@ -329,7 +329,7 @@ M.edit = { -- format ["ff"] = { - vim.lsp.buf.format(), + "gg=G", "format buffer", }, }, diff --git a/lua/vscode.lua b/lua/vscode.lua new file mode 100644 index 0000000..74f11ba --- /dev/null +++ b/lua/vscode.lua @@ -0,0 +1,23 @@ +vim.api.nvim_exec([[ + " THEME CHANGER + function! SetCursorLineNrColorInsert(mode) + " Insert mode: blue + if a:mode == "i" + call VSCodeNotify('nvim-theme.insert') + + " Replace mode: red + elseif a:mode == "r" + call VSCodeNotify('nvim-theme.replace') + endif + endfunction + + augroup CursorLineNrColorSwap + autocmd! + autocmd ModeChanged *:[vV\x16]* call VSCodeNotify('nvim-theme.visual') + autocmd ModeChanged *:[R]* call VSCodeNotify('nvim-theme.replace') + autocmd InsertEnter * call SetCursorLineNrColorInsert(v:insertmode) + autocmd InsertLeave * call VSCodeNotify('nvim-theme.normal') + autocmd CursorHold * call VSCodeNotify('nvim-theme.normal') + autocmd ModeChanged [vV\x16]*:* call VSCodeNotify('nvim-theme.normal') + augroup END +]], false)