Skip to content

Commit

Permalink
wip(vscode)
Browse files Browse the repository at this point in the history
  • Loading branch information
megalithic committed Nov 14, 2022
1 parent babb7aa commit 6051650
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 19 deletions.
26 changes: 16 additions & 10 deletions config/nvim/after/plugin/vscode.lua
Original file line number Diff line number Diff line change
@@ -1,26 +1,32 @@
if not mega then return end
if not vim.g.enabled_plugin["vscode"] and not vim.g.vscode and vim.g.vscode ~= 1 then return end
if not vim.g.enabled_plugin["vscode"] and (not vim.g.vscode or vim.g.vscode ~= 1) then return end
if vim.g.started_by_firenvim or vim.g.started_by_firenvim == 1 then return end

print("test from vscode plugin")
-- REF:
-- https://github.com/ShiChenCong/.dotfiles/blob/main/nvim/lua/vscode/keymaps.lua
-- https://github.com/springload/dotfiles/blob/master/config/visual-studio-code/install.sh
-- https://github.com/antfu/vscode-settings/blob/main/.vscode/settings.json
-- https://github.com/wesbos/dotfiles/blob/master/vscode.js
--

print("nvim-vscode init..")
-- Map("n", "z=", "vim.fn.VSCodeNotify('keyboard-quickfix.openQuickFix')<cr>", Opts)
--
local default_opts = { remap = false }
local function call_vs_code(command)
return function ()
vim.fn.VSCodeNotify(command)
end
return function() vim.fn.VSCodeNotify(command) end
end

local function only_command()
vim.fn.VSCodeNotify('workbench.action.closeEditorsInOtherGroups')
vim.fn.VSCodeNotify('workbench.action.maximizeEditor')
vim.fn.VSCodeNotify('workbench.action.closePanel')
vim.fn.VSCodeNotify("workbench.action.closeEditorsInOtherGroups")
vim.fn.VSCodeNotify("workbench.action.maximizeEditor")
vim.fn.VSCodeNotify("workbench.action.closePanel")
end

-- vim.keymap.set('n', '-', call_vs_code('breadcrumbs.focusAndSelect'), default_opts)
vim.keymap.set('n', '<C-w>o', only_command, default_opts)
vim.keymap.set("n", "<C-w>o", only_command, default_opts)
-- vim.keymap.set('n', '<leader>d', call_vs_code('gitlens.diffWithRevision'), default_opts)
vim.keymap.set('n', '<leader>g', call_vs_code('git.openFile'), default_opts)
vim.keymap.set("n", "<leader>g", call_vs_code("git.openFile"), default_opts)
-- vim.keymap.set('n', '<leader>t', call_vs_code('workbench.action.tasks.runTask'), default_opts)
-- vim.keymap.set('n', '<leader>v', call_vs_code('open-in-vim.open'), default_opts)
-- vim.keymap.set('n', '[d', call_vs_code('editor.action.marker.prev'), default_opts)
Expand Down
2 changes: 1 addition & 1 deletion config/nvim/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ vim.g.enabled_plugin = {
quickfix = true,
folds = true,
env = true,
vscode = true,
vscode = false,
tmux = false,
winbar = false, -- FIXME: add more!
}
Expand Down
2 changes: 1 addition & 1 deletion config/nvim/lua/mega/globals.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1138,7 +1138,7 @@ function mega.hl_search_blink(delay)
end

-- NOTE: This fn defers sourcing of most time consuming commands (mostly plugins). This is done by using `vim.schedule(f)` which defers execution of `f` until Vim is loaded. This doesn't affect general usability; it decreases time before showing fully functional start screen (or asked file).
function mega.packer_deferred() if vim.g.vscode ~= 1 then vim.cmd([[do User PackerDeferred]]) end end
function mega.packer_deferred() vim.cmd([[do User PackerDeferred]]) end

function mega.get_cursor_position()
local rowcol = vim.api.nvim_win_get_cursor(0)
Expand Down
2 changes: 1 addition & 1 deletion config/nvim/lua/mega/lsp/servers.lua
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ return function()
settings = {
elixirLS = {
mixEnv = "test",
fetchDeps = false,
fetchDeps = true,
dialyzerEnabled = true,
dialyzerFormat = "dialyxir_short",
enableTestLenses = false,
Expand Down
11 changes: 6 additions & 5 deletions config/nvim/lua/mega/plugins/init.lua
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
local packer = require("mega.plugins.utils")
local packer_notify = packer.notify

if vim.g.vscode == 1 then return end
-- if vim.g.vscode == 1 then return end

local config = {
-- opt_default = true,
Expand Down Expand Up @@ -198,6 +198,7 @@ local function plugins(use)
})
use({
"nvim-telescope/telescope-live-grep-args.nvim",
cond = vim.g.vscode ~= 1,
after = "telescope.nvim",
config = function() require("telescope").load_extension("live_grep_args") end,
})
Expand Down Expand Up @@ -575,10 +576,10 @@ local function plugins(use)
use({ "rcarriga/nvim-dap-ui", ext = "dapui", after = "nvim-dap" })
use({ "jbyuki/one-small-step-for-vimkind", after = "nvim-dap" })
use({ "suketa/nvim-dap-ruby", after = "nvim-dap", config = function() require("dap-ruby").setup() end })
use({
"microsoft/vscode-js-debug",
run = "npm install --legacy-peer-deps && npm run compile",
})
-- use({
-- "microsoft/vscode-js-debug",
-- run = "npm install --legacy-peer-deps && npm run compile",
-- })
use({
"mxsdev/nvim-dap-vscode-js",
after = "nvim-dap",
Expand Down
2 changes: 1 addition & 1 deletion config/nvim/plugin/lsp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ local max_height = math.min(math.floor(vim.o.lines * 0.3), 30)
vim.opt.completeopt = { "menu", "menuone", "noselect", "noinsert" }
vim.opt.shortmess:append("c") -- Don't pass messages to |ins-completion-menu|

require("vim.lsp.log").set_level(vim.log.levels.ERROR) -- opts: OFF
require("vim.lsp.log").set_level("ERROR") -- opts: OFF
require("vim.lsp.log").set_format_func(vim.inspect)

-- NOTE:
Expand Down

0 comments on commit 6051650

Please sign in to comment.