Skip to content

Instantly share code, notes, and snippets.

@Syakhisk
Created June 14, 2022 00:51
Show Gist options
  • Save Syakhisk/768a7bf825dcd4d95db940e7bd887572 to your computer and use it in GitHub Desktop.
Save Syakhisk/768a7bf825dcd4d95db940e7bd887572 to your computer and use it in GitHub Desktop.
eternal-sin (vscode-neovim) configuration
" $HOME/.config/nvim/vim/generals.vim
function! VSCodeNotifyVisual(cmd, leaveSelection, ...)
let mode = mode()
if mode ==# 'V'
let startLine = line('v')
let endLine = line('.')
call VSCodeNotifyRange(a:cmd, startLine, endLine, a:leaveSelection, a:000)
elseif mode ==# 'v' || mode ==# "\<C-v>"
let startPos = getpos('v')
let endPos = getpos('.')
call VSCodeNotifyRangePos(a:cmd, startPos[1], endPos[1], startPos[2], endPos[2] + 1, a:leaveSelection, a:000)
else
call VSCodeNotify(a:cmd, a:000)
endif
endfunction
-- $HOME/.config/nvim/init.lua
require("packer").startup(function()
use("wbthomason/packer.nvim")
use("tpope/vim-abolish")
use("tpope/vim-repeat")
use("tpope/vim-surround")
use("ggandor/lightspeed.nvim")
end)
vim.g.mapleader = " "
vim.o.clipboard = "unnamedplus"
vim.cmd('source /home/m42nk/.config/nvim/vim/generals.vim')
function map(mode, lhs, rhs, opts)
local options = { noremap = true }
if opts then
options = vim.tbl_extend("force", options, opts)
end
vim.api.nvim_set_keymap(mode, lhs, rhs, options)
end
-- control + dot
map("n", "<Leader>h", ":nohlsearch<CR>", { silent = true })
map("n", "<Leader><Space>", "<Cmd>call VSCodeNotify('workbench.action.files.save')<CR>")
map("n", "<Leader>f", "<Cmd>call VSCodeNotify('workbench.action.quickOpen')<CR>")
map("n", "<Leader>F", "<Cmd>call VSCodeNotify('workbench.action.showCommands')<CR>")
map("x", "<C-S-P>", "<Cmd>call VSCodeNotifyVisual('workbench.action.showCommands', 1)<CR>")
map("n", "gl", "<Cmd>call VSCodeNotify('editor.action.quickFix')<CR>")
map("n", "<Leader>c", "<Cmd>call VSCodeNotify('workbench.action.closeActiveEditor')<CR>")
map("n", "<C-w>", "<Cmd>call VSCodeNotify('workbench.action.closeActiveEditor')<CR>")
map("n", "<Leader>e", "<Cmd>call VSCodeNotify('workbench.files.action.focusOpenEditorsView')<CR>")
map("x", "<Leader>/", "<Plug>VSCodeCommentary")
map("n", "<Leader>/", "<Plug>VSCodeCommentaryLine")
map("x", "gc", "<Plug>VSCodeCommentary")
map("n", "gc", "<Plug>VSCodeCommentary")
map("o", "gc", "<Plug>VSCodeCommentary")
map("n", "gcc", "<Plug>VSCodeCommentaryLine")
vim.cmd([[
au TextYankPost * silent! lua vim.highlight.on_yank()
]])
[
{
"key": "shift+alt+f",
"command": "editor.action.formatDocument",
"when": "editorHasDocumentFormattingProvider && editorTextFocus && !editorReadonly && !inCompositeEditor"
},
{
"key": "ctrl+shift+i",
"command": "-editor.action.formatDocument",
"when": "editorHasDocumentFormattingProvider && editorTextFocus && !editorReadonly && !inCompositeEditor"
},
{
"command": "vscode-neovim.compositeEscape1",
"key": "j",
"when": "neovim.mode == insert && editorTextFocus",
"args": "j"
},
{
"command": "vscode-neovim.compositeEscape2",
"key": "k",
"when": "neovim.mode == insert && editorTextFocus",
"args": "k"
},
{
"command": "workbench.files.action.focusOpenEditorsView",
"key": "ctrl+b",
"when": "editorTextFocus && neovim.mode != insert"
}
]
{
"activitusbar.inactiveColour": "#fff",
"activitusbar.showSourceControlCounter": true,
"editor.detectIndentation": false,
"editor.fontFamily": "'FiraCode Nerd Font', 'Droid Sans Mono', 'monospace', monospace",
"editor.lineNumbers": "relative",
"editor.minimap.maxColumn": 50,
"editor.minimap.renderCharacters": false,
"editor.minimap.size": "fit",
"editor.tabSize": 2,
"security.workspace.trust.enabled": false,
"terminal.external.linuxExec": "alacritty",
"terminal.integrated.defaultLocation": "editor",
"terminal.integrated.tabs.title": "${process} - Terminal",
// "vscode-neovim.neovimExecutablePaths.linux": "/home/m42nk/.local/bin/lvim",
"vscode-neovim.neovimExecutablePaths.linux": "/usr/bin/nvim",
"workbench.activityBar.visible": false,
"workbench.colorTheme": "Tokyo Night Storm",
"workbench.iconTheme": "material-icon-theme",
"workbench.sideBar.location": "right",
"workbench.startupEditor": "none",
"workbench.list.automaticKeyboardNavigation": false,
// "terminal.integrated.automationProfile.linux": {
// "path": "tmux",
// "args": ["new", "-As", "CODE"],
// "icon": "terminal-tmux"
// },
"terminal.integrated.profiles.linux": {
"zsh": {
"path": "zsh"
},
"tmux": {
"path": "tmux",
"args": ["new", "-As", "CODE"],
"icon": "terminal-tmux"
}
},
"terminal.integrated.defaultProfile.linux": "tmux",
"[jsonc]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"window.dialogStyle": "custom",
"window.menuBarVisibility": "toggle",
"window.restoreWindows": "none",
"window.titleBarStyle": "custom"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment