add some keymaps for vscode scenario
This commit is contained in:
5
init.lua
5
init.lua
@@ -1,2 +1,7 @@
|
||||
-- bootstrap lazy.nvim, LazyVim and your plugins
|
||||
|
||||
if vim.g.vscode then
|
||||
require('config.lazyvscode')
|
||||
else
|
||||
require("config.lazy")
|
||||
end
|
||||
|
17
lua/baremetal/flash.lua
Normal file
17
lua/baremetal/flash.lua
Normal file
@@ -0,0 +1,17 @@
|
||||
return{
|
||||
{
|
||||
"folke/flash.nvim",
|
||||
event = "VeryLazy",
|
||||
---@type Flash.Config
|
||||
opts = {},
|
||||
modes = {search = {enabled = true}},
|
||||
-- stylua: ignore
|
||||
keys = {
|
||||
{ "<leader>s", mode = { "n", "x", "o" }, function() require("flash").jump() end, desc = "Flash" },
|
||||
{ "<leader>S", mode = { "n", "x", "o" }, function() require("flash").treesitter() end, desc = "Flash Treesitter" },
|
||||
-- { "<leader>r", mode = "o", function() require("flash").remote() end, desc = "Remote Flash" },
|
||||
-- { "<leader>R", mode = { "o", "x" }, function() require("flash").treesitter_search() end, desc = "Treesitter Search" },
|
||||
-- { "<c-s>", mode = { "c" }, function() require("flash").toggle() end, desc = "Toggle Flash Search" },
|
||||
},
|
||||
}
|
||||
}
|
59
lua/baremetal/gitsigns.lua
Normal file
59
lua/baremetal/gitsigns.lua
Normal file
@@ -0,0 +1,59 @@
|
||||
return {
|
||||
{
|
||||
"lewis6991/gitsigns.nvim",
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
opts = {
|
||||
signs = {
|
||||
add = { text = '┃' },
|
||||
change = { text = '┃' },
|
||||
delete = { text = '_' },
|
||||
topdelete = { text = '‾' },
|
||||
changedelete = { text = '~' },
|
||||
untracked = { text = '┆' },
|
||||
},
|
||||
signs_staged = {
|
||||
add = { text = '┃' },
|
||||
change = { text = '┃' },
|
||||
delete = { text = '_' },
|
||||
topdelete = { text = '‾' },
|
||||
changedelete = { text = '~' },
|
||||
untracked = { text = '┆' },
|
||||
},
|
||||
signs_staged_enable = true,
|
||||
signcolumn = true, -- Toggle with `:Gitsigns toggle_signs`
|
||||
numhl = false, -- Toggle with `:Gitsigns toggle_numhl`
|
||||
linehl = false, -- Toggle with `:Gitsigns toggle_linehl`
|
||||
word_diff = false, -- Toggle with `:Gitsigns toggle_word_diff`
|
||||
watch_gitdir = {
|
||||
follow_files = true
|
||||
},
|
||||
auto_attach = true,
|
||||
attach_to_untracked = false,
|
||||
current_line_blame = true, -- Toggle with `:Gitsigns toggle_current_line_blame`
|
||||
current_line_blame_opts = {
|
||||
virt_text = true,
|
||||
virt_text_pos = 'eol', -- 'eol' | 'overlay' | 'right_align'
|
||||
delay = 1000,
|
||||
ignore_whitespace = false,
|
||||
virt_text_priority = 100,
|
||||
use_focus = true,
|
||||
},
|
||||
current_line_blame_formatter = '<author>, <author_time:%R> - <summary>',
|
||||
sign_priority = 6,
|
||||
update_debounce = 100,
|
||||
status_formatter = nil, -- Use default
|
||||
max_file_length = 40000, -- Disable if file is longer than this (in lines)
|
||||
preview_config = {
|
||||
-- Options passed to nvim_open_win
|
||||
border = 'single',
|
||||
style = 'minimal',
|
||||
relative = 'cursor',
|
||||
row = 0,
|
||||
col = 1
|
||||
},
|
||||
},
|
||||
config = function(_, opts)
|
||||
require('gitsigns').setup(opts)
|
||||
end
|
||||
}
|
||||
}
|
83
lua/baremetal/lualine.lua
Normal file
83
lua/baremetal/lualine.lua
Normal file
@@ -0,0 +1,83 @@
|
||||
return {
|
||||
{
|
||||
'nvim-lualine/lualine.nvim',
|
||||
dependencies = { 'nvim-tree/nvim-web-devicons' },
|
||||
opts = {
|
||||
options = {
|
||||
theme = "auto",
|
||||
},
|
||||
-- sections = {
|
||||
-- lualine_c = {
|
||||
-- -- 显示当前窗口编号(格式:[窗口号] 文件名)
|
||||
-- function()
|
||||
-- return "[" .. tostring(vim.api.nvim_win_get_number(0)) .. "] " .. vim.fn.expand("%:t")
|
||||
-- end,
|
||||
-- },
|
||||
-- },
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
-- local colors = {
|
||||
-- blue = '#80a0ff',
|
||||
-- cyan = '#79dac8',
|
||||
-- black = '#080808',
|
||||
-- white = '#c6c6c6',
|
||||
-- red = '#ff5189',
|
||||
-- violet = '#d183e8',
|
||||
-- grey = '#303030',
|
||||
-- }
|
||||
|
||||
-- local bubbles_theme = {
|
||||
-- normal = {
|
||||
-- a = { fg = colors.black, bg = colors.violet },
|
||||
-- b = { fg = colors.white, bg = colors.grey },
|
||||
-- c = { fg = colors.white },
|
||||
-- },
|
||||
|
||||
-- insert = { a = { fg = colors.black, bg = colors.blue } },
|
||||
-- visual = { a = { fg = colors.black, bg = colors.cyan } },
|
||||
-- replace = { a = { fg = colors.black, bg = colors.red } },
|
||||
|
||||
-- inactive = {
|
||||
-- a = { fg = colors.white, bg = colors.black },
|
||||
-- b = { fg = colors.white, bg = colors.black },
|
||||
-- c = { fg = colors.white },
|
||||
-- },
|
||||
-- }
|
||||
|
||||
-- return {
|
||||
-- {
|
||||
-- 'nvim-lualine/lualine.nvim',
|
||||
-- dependencies = { 'nvim-tree/nvim-web-devicons' },
|
||||
-- opts = {
|
||||
-- options = {
|
||||
-- theme = bubbles_theme,
|
||||
-- component_separators = '',
|
||||
-- section_separators = { left = '', right = '' },
|
||||
-- },
|
||||
-- },
|
||||
-- sections = {
|
||||
-- lualine_a = { { 'mode', separator = { left = '' }, right_padding = 2 } },
|
||||
-- lualine_b = { 'filename', 'branch' },
|
||||
-- lualine_c = {
|
||||
-- '%=', --[[ add your center components here in place of this comment ]]
|
||||
-- },
|
||||
-- lualine_x = {},
|
||||
-- lualine_y = { 'filetype', 'progress' },
|
||||
-- lualine_z = {
|
||||
-- { 'location', separator = { right = '' }, left_padding = 2 },
|
||||
-- },
|
||||
-- },
|
||||
-- inactive_sections = {
|
||||
-- lualine_a = { 'filename' },
|
||||
-- lualine_b = {},
|
||||
-- lualine_c = {},
|
||||
-- lualine_x = {},
|
||||
-- lualine_y = {},
|
||||
-- lualine_z = { 'location' },
|
||||
-- },
|
||||
-- tabline = {},
|
||||
-- extensions = {},
|
||||
-- }
|
||||
-- }
|
12
lua/baremetal/nvim-surround.lua
Normal file
12
lua/baremetal/nvim-surround.lua
Normal file
@@ -0,0 +1,12 @@
|
||||
return{
|
||||
{
|
||||
"kylechui/nvim-surround",
|
||||
version = "^3.0.0", -- Use for stability; omit to use `main` branch for the latest features
|
||||
event = "VeryLazy",
|
||||
config = function()
|
||||
require("nvim-surround").setup({
|
||||
-- Configuration here, or leave empty to use defaults
|
||||
})
|
||||
end
|
||||
}
|
||||
}
|
11
lua/baremetal/nvim-tree.lua
Normal file
11
lua/baremetal/nvim-tree.lua
Normal file
@@ -0,0 +1,11 @@
|
||||
return {
|
||||
"nvim-tree/nvim-tree.lua",
|
||||
version = "*",
|
||||
lazy = false,
|
||||
dependencies = {
|
||||
"nvim-tree/nvim-web-devicons",
|
||||
},
|
||||
config = function()
|
||||
require("nvim-tree").setup {}
|
||||
end,
|
||||
}
|
9
lua/baremetal/nvim-window.lua
Normal file
9
lua/baremetal/nvim-window.lua
Normal file
@@ -0,0 +1,9 @@
|
||||
return {
|
||||
{
|
||||
"yorickpeterse/nvim-window",
|
||||
keys = {
|
||||
{ "<leader>w", "<cmd>lua require('nvim-window').pick()<cr>", desc = "nvim-window: Jump to window" },
|
||||
},
|
||||
config = true,
|
||||
}
|
||||
}
|
115
lua/baremetal/treesitter.lua
Normal file
115
lua/baremetal/treesitter.lua
Normal file
@@ -0,0 +1,115 @@
|
||||
return {
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
version = false, -- last release is way too old and doesn't work on Windows
|
||||
build = ":TSUpdate",
|
||||
event = { "VeryLazy" },
|
||||
lazy = vim.fn.argc(-1) == 0, -- load treesitter early when opening a file from the cmdline
|
||||
init = function(plugin)
|
||||
-- PERF: add nvim-treesitter queries to the rtp and it's custom query predicates early
|
||||
-- This is needed because a bunch of plugins no longer `require("nvim-treesitter")`, which
|
||||
-- no longer trigger the **nvim-treesitter** module to be loaded in time.
|
||||
-- Luckily, the only things that those plugins need are the custom queries, which we make available
|
||||
-- during startup.
|
||||
require("lazy.core.loader").add_to_rtp(plugin)
|
||||
require("nvim-treesitter.query_predicates")
|
||||
end,
|
||||
cmd = { "TSUpdateSync", "TSUpdate", "TSInstall" },
|
||||
keys = {
|
||||
{ "<c-space>", desc = "Increment Selection" },
|
||||
{ "<bs>", desc = "Decrement Selection", mode = "x" },
|
||||
},
|
||||
opts_extend = { "ensure_installed" },
|
||||
---@type TSConfig
|
||||
---@diagnostic disable-next-line: missing-fields
|
||||
opts = {
|
||||
highlight = { enable = true },
|
||||
indent = { enable = true },
|
||||
ensure_installed = {
|
||||
"bash",
|
||||
"c",
|
||||
"diff",
|
||||
"html",
|
||||
"javascript",
|
||||
"jsdoc",
|
||||
"json",
|
||||
"jsonc",
|
||||
"lua",
|
||||
"luadoc",
|
||||
"luap",
|
||||
"markdown",
|
||||
"markdown_inline",
|
||||
"printf",
|
||||
"python",
|
||||
"query",
|
||||
"regex",
|
||||
"toml",
|
||||
"tsx",
|
||||
"typescript",
|
||||
"vim",
|
||||
"vimdoc",
|
||||
"xml",
|
||||
"yaml",
|
||||
},
|
||||
incremental_selection = {
|
||||
enable = true,
|
||||
keymaps = {
|
||||
init_selection = "<C-space>",
|
||||
node_incremental = "<C-space>",
|
||||
scope_incremental = false,
|
||||
node_decremental = "<bs>",
|
||||
},
|
||||
},
|
||||
textobjects = {
|
||||
move = {
|
||||
enable = true,
|
||||
goto_next_start = { ["]f"] = "@function.outer", ["]c"] = "@class.outer", ["]a"] = "@parameter.inner" },
|
||||
goto_next_end = { ["]F"] = "@function.outer", ["]C"] = "@class.outer", ["]A"] = "@parameter.inner" },
|
||||
goto_previous_start = { ["[f"] = "@function.outer", ["[c"] = "@class.outer", ["[a"] = "@parameter.inner" },
|
||||
goto_previous_end = { ["[F"] = "@function.outer", ["[C"] = "@class.outer", ["[A"] = "@parameter.inner" },
|
||||
},
|
||||
},
|
||||
},
|
||||
-- ---@param opts TSConfig
|
||||
-- config = function(_, opts)
|
||||
-- if type(opts.ensure_installed) == "table" then
|
||||
-- opts.ensure_installed = LazyVim.dedup(opts.ensure_installed)
|
||||
-- end
|
||||
-- require("nvim-treesitter.configs").setup(opts)
|
||||
-- end,
|
||||
},
|
||||
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter-textobjects",
|
||||
event = "VeryLazy",
|
||||
enabled = true,
|
||||
config = function()
|
||||
-- If treesitter is already loaded, we need to run config again for textobjects
|
||||
-- if LazyVim.is_loaded("nvim-treesitter") then
|
||||
-- local opts = leLazyVim.opts("nvim-treesitter")
|
||||
-- require("nvim-treesitter.configs").setup({ textobjects = opts.textobjects })
|
||||
-- end
|
||||
|
||||
-- When in diff mode, we want to use the default
|
||||
-- vim text objects c & C instead of the treesitter ones.
|
||||
local move = require("nvim-treesitter.textobjects.move") ---@type table<string,fun(...)>
|
||||
local configs = require("nvim-treesitter.configs")
|
||||
for name, fn in pairs(move) do
|
||||
if name:find("goto") == 1 then
|
||||
move[name] = function(q, ...)
|
||||
if vim.wo.diff then
|
||||
local config = configs.get_module("textobjects.move")[name] ---@type table<string,string>
|
||||
for key, query in pairs(config or {}) do
|
||||
if q == query and key:find("[%]%[][cC]") then
|
||||
vim.cmd("normal! " .. key)
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
return fn(q, ...)
|
||||
end
|
||||
end
|
||||
end
|
||||
end,
|
||||
},
|
||||
}
|
91
lua/baremetal/wichkey.lua
Normal file
91
lua/baremetal/wichkey.lua
Normal file
@@ -0,0 +1,91 @@
|
||||
return {
|
||||
-- {
|
||||
-- "folke/which-key.nvim",
|
||||
-- event = "VeryLazy",
|
||||
-- opts = {
|
||||
-- -- your configuration comes here
|
||||
-- -- or leave it empty to use the default settings
|
||||
-- -- refer to the configuration section below
|
||||
-- },
|
||||
-- keys = {
|
||||
-- {
|
||||
-- "<leader>?",
|
||||
-- function()
|
||||
-- require("which-key").show({ global = false })
|
||||
-- end,
|
||||
-- desc = "Buffer Local Keymaps (which-key)",
|
||||
-- },
|
||||
-- },
|
||||
-- },
|
||||
{
|
||||
"folke/which-key.nvim",
|
||||
event = "VeryLazy",
|
||||
opts_extend = { "spec" },
|
||||
opts = {
|
||||
preset = "helix",
|
||||
defaults = {},
|
||||
spec = {
|
||||
{
|
||||
mode = { "n", "v" },
|
||||
-- { "<leader><tab>", group = "tabs" },
|
||||
{ "<leader>c", group = "code" },
|
||||
-- { "<leader>d", group = "debug" },
|
||||
-- { "<leader>dp", group = "profiler" },
|
||||
{ "<leader>f", group = "file/find" },
|
||||
{ "<leader>g", group = "git" },
|
||||
-- { "<leader>gh", group = "hunks" },
|
||||
{ "<leader>q", group = "quit/session" },
|
||||
{ "<leader>s", group = "search" },
|
||||
{ "<leader>u", group = "ui", icon = { icon = " ", color = "cyan" } },
|
||||
{ "<leader>x", group = "diagnostics/quickfix", icon = { icon = " ", color = "green" } },
|
||||
{ "[", group = "prev" },
|
||||
{ "]", group = "next" },
|
||||
{ "g", group = "goto" },
|
||||
{ "gs", group = "surround" },
|
||||
{ "z", group = "fold" },
|
||||
{
|
||||
"<leader>b",
|
||||
group = "buffer",
|
||||
expand = function()
|
||||
return require("which-key.extras").expand.buf()
|
||||
end,
|
||||
},
|
||||
-- {
|
||||
-- "<leader>w",
|
||||
-- group = "windows",
|
||||
-- proxy = "<c-w>",
|
||||
-- expand = function()
|
||||
-- return require("which-key.extras").expand.win()
|
||||
-- end,
|
||||
-- },
|
||||
-- better descriptions
|
||||
{ "gx", desc = "Open with system app" },
|
||||
},
|
||||
},
|
||||
},
|
||||
keys = {
|
||||
{
|
||||
"<leader>?",
|
||||
function()
|
||||
require("which-key").show({ global = false })
|
||||
end,
|
||||
desc = "Buffer Keymaps (which-key)",
|
||||
},
|
||||
{
|
||||
"<c-w><space>",
|
||||
function()
|
||||
require("which-key").show({ keys = "<c-w>", loop = true })
|
||||
end,
|
||||
desc = "Window Hydra Mode (which-key)",
|
||||
},
|
||||
},
|
||||
config = function(_, opts)
|
||||
local wk = require("which-key")
|
||||
wk.setup(opts)
|
||||
if not vim.tbl_isempty(opts.defaults) then
|
||||
-- LazyVim.warn("which-key: opts.defaults is deprecated. Please use opts.spec instead.")
|
||||
wk.register(opts.defaults)
|
||||
end
|
||||
end,
|
||||
},
|
||||
}
|
@@ -14,13 +14,13 @@ if not (vim.uv or vim.loop).fs_stat(lazypath) then
|
||||
end
|
||||
vim.opt.rtp:prepend(lazypath)
|
||||
|
||||
if not vim.g.vscode then
|
||||
if true then
|
||||
require("lazy").setup({
|
||||
spec = {
|
||||
-- add LazyVim and import its plugins
|
||||
{ "LazyVim/LazyVim", import = "lazyvim.plugins" },
|
||||
-- import/override with your plugins
|
||||
{ import = "plugins" },
|
||||
{ import = "lazyvim" },
|
||||
},
|
||||
defaults = {
|
||||
-- By default, only LazyVim plugins will be lazy-loaded. Your custom plugins will load during startup.
|
||||
@@ -66,31 +66,31 @@ else
|
||||
vim.opt.smartcase = true -- but make it case sensitive if an uppercase is entered
|
||||
|
||||
-- Tab
|
||||
-- vim.opt.tabstop = 4 -- number of visual spaces per TAB
|
||||
-- vim.opt.softtabstop = 4 -- number of spacesin tab when editing
|
||||
-- vim.opt.shiftwidth = 4 -- insert 4 spaces on a tab
|
||||
-- vim.opt.expandtab = true -- tabs are spaces, mainly because of python
|
||||
vim.opt.tabstop = 4 -- number of visual spaces per TAB
|
||||
vim.opt.softtabstop = 4 -- number of spacesin tab when editing
|
||||
vim.opt.shiftwidth = 4 -- insert 4 spaces on a tab
|
||||
vim.opt.expandtab = true -- tabs are spaces, mainly because of python
|
||||
|
||||
-- UI config
|
||||
-- vim.opt.number = true -- show absolute number
|
||||
-- vim.opt.relativenumber = true -- add numbers to each line on the left side
|
||||
-- vim.opt.cursorline = true -- highlight cursor line underneath the cursor horizontally
|
||||
-- vim.opt.splitbelow = true -- open new vertical split bottom
|
||||
-- vim.opt.splitright = true -- open new horizontal splits right
|
||||
-- vim.opt.termguicolors = true -- enabl 24-bit RGB color in the TUI
|
||||
-- vim.opt.showmode = false -- we are experienced, wo don't need the "-- INSERT --" mode hint
|
||||
vim.opt.number = true -- show absolute number
|
||||
vim.opt.relativenumber = true -- add numbers to each line on the left side
|
||||
vim.opt.cursorline = true -- highlight cursor line underneath the cursor horizontally
|
||||
vim.opt.splitbelow = true -- open new vertical split bottom
|
||||
vim.opt.splitright = true -- open new horizontal splits right
|
||||
vim.opt.termguicolors = true -- enabl 24-bit RGB color in the TUI
|
||||
vim.opt.showmode = false -- we are experienced, wo don't need the "-- INSERT --" mode hint
|
||||
|
||||
-- vim.opt.wrap = false -- Wrapping sucks (except on markdown)
|
||||
-- vim.opt.swapfile = false -- Do not leave any backup files
|
||||
-- vim.opt.showmatch = true -- Highlights the matching parenthesis
|
||||
-- vim.opt.signcolumn = "yes" -- Always show the signcolumn, otherwise it would shift the text
|
||||
-- vim.opt.hidden = true -- Allow multple buffers
|
||||
-- vim.opt.shortmess:append("c") -- Don't pass messages to |ins-completion-menu|.
|
||||
-- vim.opt.encoding = "utf-8" -- Just in case
|
||||
-- vim.opt.cmdheight = 2 -- Shows better messages
|
||||
vim.opt.wrap = false -- Wrapping sucks (except on markdown)
|
||||
vim.opt.swapfile = false -- Do not leave any backup files
|
||||
vim.opt.showmatch = true -- Highlights the matching parenthesis
|
||||
vim.opt.signcolumn = "yes" -- Always show the signcolumn, otherwise it would shift the text
|
||||
vim.opt.hidden = true -- Allow multple buffers
|
||||
vim.opt.shortmess:append("c") -- Don't pass messages to |ins-completion-menu|.
|
||||
vim.opt.encoding = "utf-8" -- Just in case
|
||||
vim.opt.cmdheight = 2 -- Shows better messages
|
||||
|
||||
-- vim.opt.foldmethod = "indent"
|
||||
-- vim.opt.foldlevel = 99
|
||||
vim.opt.foldmethod = "indent"
|
||||
vim.opt.foldlevel = 99
|
||||
|
||||
-- vim.opt.swapfile = false
|
||||
-- vim.opt.backup = false
|
||||
@@ -100,37 +100,10 @@ else
|
||||
vim.g.mapleader = " " -- set leader key to space
|
||||
vim.g.maplocalleader = "\\" -- set local leader key to space
|
||||
|
||||
local fold = {
|
||||
unfoldAll = function()
|
||||
vim.fn.VSCodeNotify("editor.unfoldAll")
|
||||
end,
|
||||
foldAll = function()
|
||||
vim.fn.VSCodeNotify("editor.foldAll")
|
||||
end,
|
||||
fold = function()
|
||||
vim.fn.VSCodeNotify("editor.fold")
|
||||
end,
|
||||
unfold = function()
|
||||
vim.fn.VSCodeNotify("editor.unfold")
|
||||
end,
|
||||
}
|
||||
vim.keymap.set("n", "zR", fold.unfoldAll)
|
||||
vim.keymap.set("n", "zM", fold.foldAll)
|
||||
vim.keymap.set("n", "zo", fold.unfold)
|
||||
vim.keymap.set("n", "zc", fold.fold)
|
||||
|
||||
local codeReader = {
|
||||
quickInfo = function()
|
||||
vim.fn.VSCodeNotify("editor.action.showHover")
|
||||
end,
|
||||
}
|
||||
|
||||
vim.keymap.set("n", "<c-h>", codeReader.quickInfo)
|
||||
|
||||
require("lazy").setup({
|
||||
spec = {
|
||||
-- import your plugins
|
||||
{ import = "vscodeplugins" },
|
||||
{ import = "baremetal" },
|
||||
},
|
||||
-- Configure any other settings here. See the documentation for more details.
|
||||
-- colorscheme that will be used when installing plugins.
|
||||
|
108
lua/config/lazyvscode.lua
Normal file
108
lua/config/lazyvscode.lua
Normal file
@@ -0,0 +1,108 @@
|
||||
-- Use Lazy.nvim as the plugin manager
|
||||
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||
if not (vim.uv or vim.loop).fs_stat(lazypath) then
|
||||
local lazyrepo = "https://github.com/folke/lazy.nvim.git"
|
||||
local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
|
||||
if vim.v.shell_error ~= 0 then
|
||||
vim.api.nvim_echo({
|
||||
{ "Failed to clone lazy.nvim:\n", "ErrorMsg" },
|
||||
{ out, "WarningMsg" },
|
||||
{ "\nPress any key to exit..." },
|
||||
}, true, {})
|
||||
vim.fn.getchar()
|
||||
os.exit(1)
|
||||
end
|
||||
end
|
||||
vim.opt.rtp:prepend(lazypath)
|
||||
|
||||
-- Clipboard
|
||||
vim.opt.clipboard = "unnamedplus" -- use system clipboard
|
||||
|
||||
-- Searching
|
||||
vim.opt.incsearch = true -- search as characters are entered
|
||||
vim.opt.hlsearch = true -- do not highlight matches
|
||||
vim.opt.ignorecase = true -- ignore case in searches by default
|
||||
vim.opt.smartcase = true -- but make it case sensitive if an uppercase is entered
|
||||
|
||||
-- Tab width
|
||||
vim.opt.tabstop = 4 -- number of visual spaces per TAB
|
||||
vim.opt.softtabstop = 4 -- number of spacesin tab when editing
|
||||
vim.opt.shiftwidth = 4 -- insert 4 spaces on a tab
|
||||
vim.opt.expandtab = true -- tabs are spaces, mainly because of python
|
||||
|
||||
-- Leader and Local Leader
|
||||
vim.g.mapleader = " " -- set leader key to space
|
||||
vim.g.maplocalleader = "\\" -- set local leader key to space
|
||||
|
||||
local vscode = require("vscode")
|
||||
vim.notify = vscode.notify
|
||||
|
||||
-- Code Folding
|
||||
local fold = {
|
||||
unfoldAll = function()
|
||||
vscode.action("editor.unfoldAll")
|
||||
end,
|
||||
foldAll = function()
|
||||
vscode.action("editor.foldAll")
|
||||
end,
|
||||
toggleFold = function()
|
||||
vscode.action("editor.toggleFold")
|
||||
end,
|
||||
}
|
||||
vim.keymap.set("n", "zR", fold.unfoldAll, { desc = "Fold All" })
|
||||
vim.keymap.set("n", "zM", fold.foldAll, { desc = "Unfold All" })
|
||||
vim.keymap.set("n", "za", fold.toggleFold, { desc = "Toggle Fold" })
|
||||
|
||||
-- Toggle VSCode Zen Mode
|
||||
local zenMode = {
|
||||
toggle = function()
|
||||
vscode.action("workbench.action.toggleZenMode")
|
||||
end,
|
||||
}
|
||||
vim.keymap.set("n", "<leader><leader>z", zenMode.toggle, { desc = "Toggle Zen Mode" })
|
||||
|
||||
-- Toggle VSCode Sidebar
|
||||
local sidebar = {
|
||||
toggleVisibility = function()
|
||||
vscode.action("workbench.action.toggleSidebarVisibility")
|
||||
end,
|
||||
togglePosition = function()
|
||||
vscode.action("workbench.action.toggleSidebarPosition")
|
||||
end,
|
||||
open = function ()
|
||||
-- vscode.action("workbench.action.quickOpen")
|
||||
-- vscode.action("workbench.action.quickOpenNavigateNextInFilePicker")
|
||||
-- vscode.action("workbench.action.quickOpenSelectNext")
|
||||
-- vscode.action("workbench.action.quickOpenPreviousRecentlyUsedEditor")
|
||||
vscode.action("workbench.view.explorer")
|
||||
end
|
||||
}
|
||||
vim.keymap.set("n", "<leader><leader>b", sidebar.toggleVisibility, { desc = "Toggle Sidebar Vidibility" })
|
||||
vim.keymap.set("n", "<leader><leader>B", sidebar.togglePosition, { desc = "Toggle Sidebar Position" })
|
||||
vim.keymap.set("n", "<leader>e", sidebar.open, { desc = "Open Explorer" })
|
||||
|
||||
-- Toggle Line-Number Mode
|
||||
vim.keymap.set("n", "<leader><leader>l", function()
|
||||
local lineNumbMode = vscode.get_config("editor.lineNumbers")
|
||||
if lineNumbMode == "on" then
|
||||
vscode.update_config("editor.lineNumbers", "relative")
|
||||
elseif lineNumbMode == "relative" then
|
||||
vscode.update_config("editor.lineNumbers", "on")
|
||||
else
|
||||
vscode.update_config("editor.lineNumbers", "relative")
|
||||
end
|
||||
end, { desc = "Toggle Line-Number Mode" })
|
||||
|
||||
--
|
||||
-- Use Lazy.nvim as the plugin manager
|
||||
require("lazy").setup({
|
||||
spec = {
|
||||
-- import your plugins
|
||||
{ import = "vscodeplugins" },
|
||||
},
|
||||
-- Configure any other settings here. See the documentation for more details.
|
||||
-- colorscheme that will be used when installing plugins.
|
||||
install = { colorscheme = { "habamax" } },
|
||||
-- automatically check for plugin updates
|
||||
checker = { enabled = true },
|
||||
})
|
@@ -10,9 +10,3 @@ if vim.loop.os_uname().sysname == "Windows_NT" then -- set default shell to powe
|
||||
vim.opt.shellredir = "2>&1 | Out-File -Encoding ASCII %s; exit $LastExitCode"
|
||||
vim.opt.shellpipe = "2>&1 | Out-File -Encoding ASCII %s; exit $LastExitCode"
|
||||
end
|
||||
|
||||
-- Tab
|
||||
vim.opt.tabstop = 4 -- number of visual spaces per TAB
|
||||
vim.opt.softtabstop = 4 -- number of spacesin tab when editing
|
||||
vim.opt.shiftwidth = 4 -- insert 4 spaces on a tab
|
||||
vim.opt.expandtab = true -- tabs are spaces, mainly because of python
|
||||
|
Reference in New Issue
Block a user