128 lines
4.2 KiB
Lua
128 lines
4.2 KiB
Lua
-- Bootstrap lazy.nvim
|
|
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)
|
|
|
|
-- Make sure to setup `mapleader` and `maplocalleader` before
|
|
-- loading lazy.nvim so that mappings are correct.
|
|
-- This is also a good place to setup other settings (vim.opt)
|
|
vim.g.mapleader = " "
|
|
vim.g.maplocalleader = " "
|
|
|
|
-- Setup lazy.nvim
|
|
|
|
if vim.g.vscode then
|
|
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" },
|
|
},
|
|
-- 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 },
|
|
})
|
|
|
|
local hop = require('hop')
|
|
local directions = require('hop.hint').HintDirection
|
|
vim.keymap.set('n', '<leader>f', function()
|
|
hop.hint_char1({ direction = directions.AFTER_CURSOR, current_line_only = true })
|
|
end, {remap=true})
|
|
vim.keymap.set('n', '<leader>F', function()
|
|
hop.hint_char1({ direction = directions.BEFORE_CURSOR, current_line_only = true })
|
|
end, {remap=true})
|
|
vim.keymap.set('n', '<leader>t', function()
|
|
hop.hint_char1({ direction = directions.AFTER_CURSOR, current_line_only = true, hint_offset = -1 })
|
|
end, {remap=true})
|
|
vim.keymap.set('n', '<leader>T', function()
|
|
hop.hint_char1({ direction = directions.BEFORE_CURSOR, current_line_only = true, hint_offset = 1 })
|
|
end, {remap=true})
|
|
vim.keymap.set('n', '<leader>s', function()
|
|
hop.hint_char1()
|
|
end, {remap=true})
|
|
vim.keymap.set('n', '<leader>S', function()
|
|
hop.hint_char2()
|
|
end, {remap=true})
|
|
vim.keymap.set('n', '<leader>sw', function()
|
|
hop.hint_words()
|
|
end, {remap=true})
|
|
|
|
else
|
|
require("lazy").setup({
|
|
spec = {
|
|
-- import your plugins
|
|
{ import = "plugins" },
|
|
},
|
|
-- 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 },
|
|
})
|
|
|
|
local hop = require('hop')
|
|
local directions = require('hop.hint').HintDirection
|
|
vim.keymap.set('n', '<leader>f', function()
|
|
hop.hint_char1({ direction = directions.AFTER_CURSOR, current_line_only = true })
|
|
end, {remap=true})
|
|
vim.keymap.set('n', '<leader>F', function()
|
|
hop.hint_char1({ direction = directions.BEFORE_CURSOR, current_line_only = true })
|
|
end, {remap=true})
|
|
vim.keymap.set('n', '<leader>t', function()
|
|
hop.hint_char1({ direction = directions.AFTER_CURSOR, current_line_only = true, hint_offset = -1 })
|
|
end, {remap=true})
|
|
vim.keymap.set('n', '<leader>T', function()
|
|
hop.hint_char1({ direction = directions.BEFORE_CURSOR, current_line_only = true, hint_offset = 1 })
|
|
end, {remap=true})
|
|
vim.keymap.set('n', '<leader>s', function()
|
|
hop.hint_char1()
|
|
end, {remap=true})
|
|
vim.keymap.set('n', '<leader>S', function()
|
|
hop.hint_char2()
|
|
end, {remap=true})
|
|
vim.keymap.set('n', '<leader>sw', function()
|
|
hop.hint_words()
|
|
end, {remap=true})
|
|
|
|
end
|