mirror of
https://github.com/pojokcodeid/nvim-lazy.git
synced 2025-06-26 10:48:40 +02:00
fix: error conflict vscode folder
This commit is contained in:
parent
da416417d8
commit
836ac75161
4 changed files with 4 additions and 4 deletions
265
lua/_vscode/functions.lua
Normal file
265
lua/_vscode/functions.lua
Normal file
|
@ -0,0 +1,265 @@
|
|||
function Active_whichkey()
|
||||
VSCodeNotify("whichkey.show")
|
||||
end
|
||||
|
||||
function Top_screen()
|
||||
Cmd("call <SNR>3_reveal('top', 0)")
|
||||
end
|
||||
|
||||
function Bottom_screen()
|
||||
Cmd("call <SNR>3_reveal('bottom', 0)")
|
||||
end
|
||||
|
||||
function Move_to_top_screen()
|
||||
Cmd("call <SNR>3_moveCursor('top')")
|
||||
end
|
||||
|
||||
function Move_to_bottom_screen()
|
||||
Cmd("call <SNR>3_moveCursor('bottom')")
|
||||
end
|
||||
|
||||
function Scroll_line_down()
|
||||
VSCodeCall("scrollLineDown")
|
||||
end
|
||||
|
||||
function Scroll_line_up()
|
||||
VSCodeCall("scrollLineUp")
|
||||
end
|
||||
|
||||
function Vscode_ctrl_d()
|
||||
VSCodeNotify("vscode-neovim.ctrl-d")
|
||||
end
|
||||
|
||||
function Vscode_ctrl_u()
|
||||
VSCodeNotify("vscode-neovim.ctrl-u")
|
||||
end
|
||||
|
||||
function Move_to_bottom_screen__center_screen()
|
||||
Move_to_bottom_screen()
|
||||
Center_screen()
|
||||
end
|
||||
|
||||
function Move_to_top_screen__center_screen()
|
||||
Move_to_top_screen()
|
||||
Center_screen()
|
||||
end
|
||||
|
||||
function Trim_trailing_whitespace()
|
||||
VSCodeCall("editor.action.trimTrailingWhitespace")
|
||||
end
|
||||
|
||||
function Save()
|
||||
VSCodeCall("workbench.action.files.save")
|
||||
end
|
||||
|
||||
function Save_no_format()
|
||||
VSCodeCall("workbench.action.files.saveWithoutFormatting")
|
||||
end
|
||||
|
||||
function Trim__save__no_format()
|
||||
Trim_trailing_whitespace()
|
||||
Save_no_format()
|
||||
end
|
||||
|
||||
function Trim__save__no_highlight()
|
||||
Trim_trailing_whitespace()
|
||||
Save()
|
||||
Remove_highlighting()
|
||||
end
|
||||
|
||||
function Format()
|
||||
VSCodeCall("editor.action.formatDocument")
|
||||
print("formatted!")
|
||||
end
|
||||
|
||||
function Trim__save__format()
|
||||
Trim_trailing_whitespace()
|
||||
Format()
|
||||
Save()
|
||||
end
|
||||
|
||||
function Reveal_definition_aside()
|
||||
VSCodeNotify("editor.action.revealDefinitionAside")
|
||||
end
|
||||
|
||||
function Go_to_implementation()
|
||||
VSCodeNotify("editor.action.goToImplementation")
|
||||
end
|
||||
|
||||
function Go_to_reference()
|
||||
VSCodeNotify("editor.action.goToReferences")
|
||||
end
|
||||
|
||||
function Rename_symbol()
|
||||
VSCodeNotify("editor.action.rename")
|
||||
end
|
||||
|
||||
function Outdent()
|
||||
---@diagnostic disable-next-line: unused-local
|
||||
for i = 1, vim.v.count1 do
|
||||
VSCodeNotify("editor.action.outdentLines")
|
||||
end
|
||||
end
|
||||
|
||||
function Indent()
|
||||
---@diagnostic disable-next-line: unused-local
|
||||
for i = 1, vim.v.count1 do
|
||||
VSCodeNotify("editor.action.indentLines")
|
||||
end
|
||||
end
|
||||
|
||||
function Outdent_vis()
|
||||
VSCodeNotify("editor.action.outdentLines", false)
|
||||
end
|
||||
|
||||
function Indent_vis()
|
||||
VSCodeNotify("editor.action.indentLines", false)
|
||||
end
|
||||
|
||||
function Comment()
|
||||
VSCodeNotify("editor.action.commentLine")
|
||||
end
|
||||
|
||||
function Convert_to_spaces()
|
||||
VSCodeNotify("editor.action.indentationToSpaces")
|
||||
end
|
||||
|
||||
function Convert_to_tabs()
|
||||
VSCodeNotify("editor.action.indentationToTabs")
|
||||
end
|
||||
|
||||
function Indent_with_spaces()
|
||||
VSCodeNotify("editor.action.indentUsingSpaces")
|
||||
end
|
||||
|
||||
function Indent_with_tabs()
|
||||
VSCodeNotify("editor.action.indentUsingTabs")
|
||||
end
|
||||
|
||||
function CloseEditor()
|
||||
VSCodeNotify("workbench.action.closeActiveEditor")
|
||||
end
|
||||
|
||||
function UndoCloseEditor()
|
||||
VSCodeNotify("workbench.action.reopenClosedEditor")
|
||||
end
|
||||
|
||||
function Git_stage_file()
|
||||
Trim_trailing_whitespace()
|
||||
Save()
|
||||
VSCodeNotify("git.stage")
|
||||
end
|
||||
|
||||
function Git_unstage_file()
|
||||
Save()
|
||||
VSCodeNotify("git.unstage")
|
||||
end
|
||||
|
||||
function Git_revert_change()
|
||||
VSCodeNotify("git.revertSelectedRanges")
|
||||
end
|
||||
|
||||
function Git_stage_change()
|
||||
VSCodeNotify("git.stageSelectedRanges")
|
||||
end
|
||||
|
||||
function Git_unstage_change()
|
||||
VSCodeNotify("git.unstageSelectedRanges")
|
||||
end
|
||||
|
||||
function Git_open_changes()
|
||||
VSCodeNotify("git.openChange")
|
||||
end
|
||||
|
||||
function Git_open_all_changes()
|
||||
VSCodeNotify("git.openAllChanges")
|
||||
end
|
||||
|
||||
function Accept_merge_both()
|
||||
VSCodeNotify("merge-conflict.accept.both")
|
||||
end
|
||||
|
||||
function Accept_merge_all_both()
|
||||
VSCodeNotify("merge-conflict.accept.all-both")
|
||||
end
|
||||
|
||||
function Accept_merge_current()
|
||||
VSCodeNotify("merge-conflict.accept.current")
|
||||
end
|
||||
|
||||
function Accept_merge_all_current()
|
||||
VSCodeNotify("merge-conflict.accept.all-current")
|
||||
end
|
||||
|
||||
function Accept_merge_incoming()
|
||||
VSCodeNotify("merge-conflict.accept.incoming")
|
||||
end
|
||||
|
||||
function Accept_merge_all_incoming()
|
||||
VSCodeNotify("merge-conflict.accept.all-incoming")
|
||||
end
|
||||
|
||||
function Accept_merge_selection()
|
||||
VSCodeNotify("merge-conflict.accept.selection")
|
||||
end
|
||||
|
||||
function Codesnap()
|
||||
VSCodeNotify("codesnap.start", true)
|
||||
end
|
||||
|
||||
function Comment_vis()
|
||||
VSCodeNotify("editor.action.commentLine", false)
|
||||
end
|
||||
|
||||
function Toggle_breakpoint()
|
||||
VSCodeNotify("editor.debug.action.toggleBreakpoint")
|
||||
end
|
||||
|
||||
function Copy_path()
|
||||
VSCodeNotify("copyFilePath")
|
||||
end
|
||||
|
||||
function Copy_relative_path()
|
||||
VSCodeNotify("copyRelativeFilePath")
|
||||
end
|
||||
|
||||
function Active_whichkey()
|
||||
VSCodeNotify("whichkey.show")
|
||||
end
|
||||
|
||||
function Navigation_down()
|
||||
VSCodeNotify("workbench.action.navigateDown")
|
||||
end
|
||||
|
||||
function Navigation_up()
|
||||
VSCodeNotify("workbench.action.navigateUp")
|
||||
end
|
||||
|
||||
function Navigation_left()
|
||||
VSCodeNotify("workbench.action.navigateLeft")
|
||||
end
|
||||
|
||||
function Navigation_right()
|
||||
VSCodeNotify("workbench.action.navigateRight")
|
||||
end
|
||||
|
||||
function Select_all()
|
||||
VSCodeNotify("editor.action.selectAll")
|
||||
end
|
||||
|
||||
function Copy_clipboard()
|
||||
VSCodeNotify("editor.action.clipboardCopyAction")
|
||||
end
|
||||
|
||||
function Paste_clipboard()
|
||||
VSCodeNotify("editor.action.clipboardPasteAction")
|
||||
end
|
||||
|
||||
function Save()
|
||||
VSCodeNotify("workbench.action.files.save")
|
||||
VSCodeNotify("workbench.action.files.saveAll")
|
||||
end
|
||||
|
||||
function Close()
|
||||
VSCodeNotify("workbench.action.closeActiveEditor")
|
||||
end
|
74
lua/_vscode/mappings.lua
Normal file
74
lua/_vscode/mappings.lua
Normal file
|
@ -0,0 +1,74 @@
|
|||
-- n = normal mode
|
||||
-- i = insert mode
|
||||
-- v = visual mode
|
||||
-- x = visual block mode
|
||||
-- t = terminal mode
|
||||
-- c = command mode
|
||||
-- o = operator pending mode
|
||||
|
||||
Map({ "n", "x" }, "<Space>", Active_whichkey)
|
||||
|
||||
Map("", "U", Trim__save__format)
|
||||
|
||||
Map("n", "gD", Reveal_definition_aside)
|
||||
Map("n", "gt", Go_to_implementation)
|
||||
Map("n", "gq", Go_to_reference)
|
||||
Map("n", ",r", Rename_symbol)
|
||||
Map("n", "<<", Outdent)
|
||||
Map("n", ">>", Indent)
|
||||
Map("n", "gcc", Comment)
|
||||
Map("n", "=s", Convert_to_spaces)
|
||||
Map("n", "=t", Convert_to_tabs)
|
||||
Map("n", "=d", Indent_with_spaces)
|
||||
Map("n", "=g", Indent_with_tabs)
|
||||
Map("n", "K", CloseEditor)
|
||||
Map("n", ",K", UndoCloseEditor)
|
||||
Map("n", "zk", Git_stage_file)
|
||||
Map("n", "zK", Git_unstage_file)
|
||||
Map("n", "zi", Git_open_changes)
|
||||
Map("n", "zI", Git_open_all_changes)
|
||||
Map("n", "zy", Toggle_breakpoint)
|
||||
Map("n", "yr", Copy_relative_path)
|
||||
Map("n", "yR", Copy_path)
|
||||
Map({ "n", "i", "v", "x" }, "<C-a>", Select_all)
|
||||
Map({ "n", "v", "x" }, "y", Copy_clipboard)
|
||||
Map({ "n", "v", "x" }, "p", Paste_clipboard)
|
||||
Map({ "n", "v", "x" }, "<C-s>", Save)
|
||||
Map({ "n" }, "q", Close)
|
||||
|
||||
Map("v", "gs", Codesnap)
|
||||
Map("v", "<", Outdent_vis)
|
||||
Map("v", ">", Indent_vis)
|
||||
Map("v", "gc", Comment_vis)
|
||||
|
||||
Map({ "n", "v" }, "zJ", Git_revert_change)
|
||||
Map({ "n", "v" }, "zj", Git_stage_change)
|
||||
-- Map({ "n", "v" }, "zt", Vscode_ctrl_d)
|
||||
-- Map({ "n", "v" }, "zb", Vscode_ctrl_u)
|
||||
|
||||
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
|
||||
)
|
Loading…
Add table
Add a link
Reference in a new issue