add/adjust vscode
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,2 +1,3 @@
|
||||
*.json
|
||||
*.toml
|
||||
baremetal
|
18
README.md
18
README.md
@@ -1,3 +1,17 @@
|
||||
# nvimconfig
|
||||
# NvimConfig
|
||||
|
||||
Configuration of Neovim
|
||||
## Configuration for VSCode-Neovim
|
||||
### `<leader>` +
|
||||
|L1 |L2 |L3 |Function |
|
||||
|--- |--- |--- |--- |
|
||||
|`<leader>` |b |- | Toggle Side Bar Visibility|
|
||||
|`<leader>` |B |- | Toggle Side Bar Position |
|
||||
|`<leader>` |l |- | Toggle Line Number Mode |
|
||||
|`<leader>` |z |- | Toggle Zen Mode |
|
||||
|`<leader>` |/ |- | Toggle Flash.nvim Search |
|
||||
|c (code) |f |- | Format Code |
|
||||
|c |t |- | Flash.nvim Treesitter |
|
||||
|b (side bar) |e |- | Open Explorer |
|
||||
|s (search) |
|
||||
|t (tab) |n |- | Next Tab |
|
||||
|w (window) | |
|
18
init.lua
18
init.lua
@@ -3,5 +3,21 @@
|
||||
if vim.g.vscode then
|
||||
require('config.lazyvscode')
|
||||
else
|
||||
require("config.lazy")
|
||||
local info = debug.getinfo(1, "S")
|
||||
local path_info = info.source:sub(2)
|
||||
local path
|
||||
if vim.loop.os_uname().sysname == "Windows_NT" then
|
||||
-- Windows platform (backslashes or forward slashes)
|
||||
path = path_info:match("(.*[/\\])")
|
||||
else
|
||||
-- Linux/macOS platform (forward slashes only)
|
||||
path = path_info:match("(.*/)")
|
||||
end
|
||||
local file, err = io.open(string.format("%s%s", path, "/baremetal"), "r")
|
||||
if file then
|
||||
file:close()
|
||||
require("config.lazybaremetal")
|
||||
else
|
||||
require("config.lazynvimide")
|
||||
end
|
||||
end
|
||||
|
@@ -1,114 +0,0 @@
|
||||
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)
|
||||
|
||||
if true then
|
||||
require("lazy").setup({
|
||||
spec = {
|
||||
-- add LazyVim and import its plugins
|
||||
{ "LazyVim/LazyVim", import = "lazyvim.plugins" },
|
||||
-- import/override with your plugins
|
||||
{ import = "lazyvim" },
|
||||
},
|
||||
defaults = {
|
||||
-- By default, only LazyVim plugins will be lazy-loaded. Your custom plugins will load during startup.
|
||||
-- If you know what you're doing, you can set this to `true` to have all your custom plugins lazy-loaded by default.
|
||||
lazy = false,
|
||||
-- It's recommended to leave version=false for now, since a lot the plugin that support versioning,
|
||||
-- have outdated releases, which may break your Neovim install.
|
||||
version = false, -- always use the latest git commit
|
||||
-- version = "*", -- try installing the latest stable version for plugins that support semver
|
||||
},
|
||||
install = { colorscheme = { "tokyonight", "habamax" } },
|
||||
checker = {
|
||||
enabled = true, -- check for plugin updates periodically
|
||||
notify = false, -- notify on update
|
||||
}, -- automatically check for plugin updates
|
||||
performance = {
|
||||
rtp = {
|
||||
-- disable some rtp plugins
|
||||
disabled_plugins = {
|
||||
"gzip",
|
||||
-- "matchit",
|
||||
-- "matchparen",
|
||||
-- "netrwPlugin",
|
||||
"tarPlugin",
|
||||
"tohtml",
|
||||
"tutor",
|
||||
"zipPlugin",
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
else
|
||||
-- 1.options
|
||||
-- Hint: use `:h <option>` to figure out the meaning if needed
|
||||
vim.opt.clipboard = "unnamedplus" -- use system clipboard
|
||||
vim.opt.completeopt = { "menu", "menuone", "noselect" }
|
||||
vim.opt.mouse = "a" -- allow the mouse to be used in Nvim
|
||||
|
||||
-- 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
|
||||
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.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.swapfile = false
|
||||
-- vim.opt.backup = false
|
||||
-- vim.opt.undofile = false
|
||||
-- vim.opt.writebackup = false
|
||||
|
||||
vim.g.mapleader = " " -- set leader key to space
|
||||
vim.g.maplocalleader = "\\" -- set local leader key to space
|
||||
|
||||
require("lazy").setup({
|
||||
spec = {
|
||||
-- import your plugins
|
||||
{ import = "baremetal" },
|
||||
},
|
||||
-- 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 },
|
||||
})
|
||||
end
|
74
lua/config/lazybaremetal.lua
Normal file
74
lua/config/lazybaremetal.lua
Normal file
@@ -0,0 +1,74 @@
|
||||
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)
|
||||
|
||||
-- 1.options
|
||||
-- Hint: use `:h <option>` to figure out the meaning if needed
|
||||
vim.opt.clipboard = "unnamedplus" -- use system clipboard
|
||||
vim.opt.completeopt = { "menu", "menuone", "noselect" }
|
||||
vim.opt.mouse = "a" -- allow the mouse to be used in Nvim
|
||||
|
||||
-- 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
|
||||
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.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.swapfile = false
|
||||
-- vim.opt.backup = false
|
||||
-- vim.opt.undofile = false
|
||||
-- vim.opt.writebackup = false
|
||||
|
||||
vim.g.mapleader = " " -- set leader key to space
|
||||
vim.g.maplocalleader = "\\" -- set local leader key to space
|
||||
|
||||
require("lazy").setup({
|
||||
spec = {
|
||||
-- import your plugins
|
||||
{ import = "baremetal" },
|
||||
},
|
||||
-- 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 },
|
||||
})
|
53
lua/config/lazynvimide.lua
Normal file
53
lua/config/lazynvimide.lua
Normal file
@@ -0,0 +1,53 @@
|
||||
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)
|
||||
|
||||
require("lazy").setup({
|
||||
spec = {
|
||||
-- add LazyVim and import its plugins
|
||||
{ "LazyVim/LazyVim", import = "lazyvim.plugins" },
|
||||
-- import/override with your plugins
|
||||
{ import = "lazyvim" },
|
||||
},
|
||||
defaults = {
|
||||
-- By default, only LazyVim plugins will be lazy-loaded. Your custom plugins will load during startup.
|
||||
-- If you know what you're doing, you can set this to `true` to have all your custom plugins lazy-loaded by default.
|
||||
lazy = false,
|
||||
-- It's recommended to leave version=false for now, since a lot the plugin that support versioning,
|
||||
-- have outdated releases, which may break your Neovim install.
|
||||
version = false, -- always use the latest git commit
|
||||
-- version = "*", -- try installing the latest stable version for plugins that support semver
|
||||
},
|
||||
install = { colorscheme = { "tokyonight", "habamax" } },
|
||||
checker = {
|
||||
enabled = true, -- check for plugin updates periodically
|
||||
notify = false, -- notify on update
|
||||
}, -- automatically check for plugin updates
|
||||
performance = {
|
||||
rtp = {
|
||||
-- disable some rtp plugins
|
||||
disabled_plugins = {
|
||||
"gzip",
|
||||
-- "matchit",
|
||||
-- "matchparen",
|
||||
-- "netrwPlugin",
|
||||
"tarPlugin",
|
||||
"tohtml",
|
||||
"tutor",
|
||||
"zipPlugin",
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
@@ -69,17 +69,13 @@ local sidebar = {
|
||||
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")
|
||||
open = function()
|
||||
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" })
|
||||
vim.keymap.set("n", "<leader>be", sidebar.open, { desc = "Open Side bar Explorer" })
|
||||
|
||||
-- Toggle Line-Number Mode
|
||||
vim.keymap.set("n", "<leader><leader>l", function()
|
||||
@@ -93,7 +89,28 @@ vim.keymap.set("n", "<leader><leader>l", function()
|
||||
end
|
||||
end, { desc = "Toggle Line-Number Mode" })
|
||||
|
||||
--
|
||||
-- Format Code
|
||||
vim.keymap.set("n", "<leader>cf", function()
|
||||
vscode.action("editor.action.formatDocument")
|
||||
end, { desc = "Format Code" })
|
||||
|
||||
-- Window
|
||||
|
||||
|
||||
|
||||
-- Tab
|
||||
local tabs = {
|
||||
next = function()
|
||||
-- vscode.action("workbench.action.quickOpen")
|
||||
-- vscode.action("workbench.action.quickOpenNavigateNextInFilePicker")
|
||||
-- vscode.action("workbench.action.quickOpenSelectNext")
|
||||
-- vscode.action("workbench.action.quickOpenPreviousRecentlyUsedEditor")
|
||||
vscode.action("workbench.action.quickOpenPreviousRecentlyUsedEditorInGroup")
|
||||
end
|
||||
}
|
||||
vim.keymap.set("n", "<leader>tp", tabs.next, { desc = "Previous Tab" })
|
||||
|
||||
|
||||
-- Use Lazy.nvim as the plugin manager
|
||||
require("lazy").setup({
|
||||
spec = {
|
||||
|
@@ -13,7 +13,7 @@ return {
|
||||
},
|
||||
-- stylua: ignore
|
||||
keys = {
|
||||
{ "<leader>/", mode = { "n", "x", "o" }, function() require("flash").toggle() end, desc = "Toggle Flash Search" },
|
||||
{ "<leader><leader>/", mode = { "n", "x", "o" }, function() require("flash").toggle() end, desc = "Toggle Flash Search" },
|
||||
-- { "<leader>j", mode = { "n", "x", "o" }, function() require("flash").jump() end, desc = "Flash" },
|
||||
{ "<leader>ct", mode = { "n", "x", "o" }, function() require("flash").treesitter() end, desc = "Flash Treesitter" },
|
||||
-- { "<leader>r", mode = "o", function() require("flash").remote() end, desc = "Remote Flash" },
|
||||
|
Reference in New Issue
Block a user