feat: change to lazyvim
This commit is contained in:
parent
defb419723
commit
3906d422e8
38 changed files with 892 additions and 1541 deletions
3
nvim/lua/config/autocmds.lua
Normal file
3
nvim/lua/config/autocmds.lua
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
-- Autocmds are automatically loaded on the VeryLazy event
|
||||
-- Default autocmds that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/autocmds.lua
|
||||
-- Add any additional autocmds here
|
||||
92
nvim/lua/config/keymaps.lua
Normal file
92
nvim/lua/config/keymaps.lua
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
-- maps are automatically loaded on the VeryLazy event
|
||||
-- Default maps that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/maps.lua
|
||||
-- Add any additional maps here
|
||||
|
||||
local Util = require("lazyvim.util")
|
||||
|
||||
local function map(mode, lhs, rhs, opts)
|
||||
local keys = require("lazy.core.handler").handlers.keys
|
||||
---@cast keys LazyKeysHandler
|
||||
-- do not create the map if a lazy keys handler exists
|
||||
if not keys.active[keys.parse({ lhs, mode = mode }).id] then
|
||||
opts = opts or {}
|
||||
opts.silent = opts.silent ~= false
|
||||
vim.keymap.set(mode, lhs, rhs, opts)
|
||||
end
|
||||
end
|
||||
local opts = { noremap = true, silent = true }
|
||||
local term_opts = { silent = true }
|
||||
|
||||
-- debug
|
||||
map("n", "<F5>", ':lua require("dap").toggle_breakpoint()<CR>', opts)
|
||||
map("n", "<F6>", ':lua require("dap").step_over()<CR>', opts)
|
||||
map("n", "<F7>", ':lua require("dap").step_into()<CR>', opts)
|
||||
map("n", "<F8>", ':lua require("dapui").toggle()<CR> :lua require("dap").continue()<CR> ', opts)
|
||||
map("n", "<F9>", ':lua require("dap").continue()<CR>', opts)
|
||||
map("n", "<F10>", ':lua require("dap").close()<CR> :lua require("dapui").toggle()<CR>', opts)
|
||||
|
||||
-- file tree
|
||||
map("n", "f", ":Neotree action=focus toggle=true<CR>", opts)
|
||||
|
||||
-- toggle terminal
|
||||
map("n", "<C-d>", ":lua require('toggleterm').toggle(1)<CR>", opts)
|
||||
|
||||
-- tab switching
|
||||
map("n", "<F1>", ":BufferPrev<CR>", opts)
|
||||
map("n", "<F2>", ":BufferNext<CR>", opts)
|
||||
|
||||
-- formatting
|
||||
map("n", "<F4>", ":lua vim.lsp.buf.format { async = true }<CR>", opts)
|
||||
map("n", "<leader>a", ":Telescope lsp_definitions<CR>", opts)
|
||||
map("n", "<leader>s", ":Telescope lsp_references<CR>", opts)
|
||||
map("n", "<leader>d", ":Telescope lsp_type_definitions<CR>", opts)
|
||||
map("n", "<leader>f", ":Telescope lsp_implementations<CR>", opts)
|
||||
map("n", "<leader>q", ":lua vim.lsp.buf.code_action()<CR>", opts)
|
||||
map("n", "<leader>w", ":lua vim.lsp.buf.signature_help()<CR>", opts)
|
||||
map("n", "<leader>e", ":lua vim.lsp.buf.hover()<CR>", opts)
|
||||
map("n", "<leader>r", ":lua vim.lsp.buf.rename()<CR>", opts)
|
||||
map("n", "<leader>gq", ":lua require('telescope.builtin').git_commits()<CR>", opts)
|
||||
map("n", "<leader>gw", ":lua require('telescope.builtin').git_bcommits()<CR>", opts)
|
||||
map("n", "<leader>ge", ":lua require('telescope.builtin').git_branches()<CR>", opts)
|
||||
map("n", "<leader>gr", ":lua require('telescope.builtin').git_status()<CR>", opts)
|
||||
map("n", "<leader>ga", ":lua require('telescope.builtin').git_stash()<CR>", opts)
|
||||
|
||||
-- window switching
|
||||
function _G.set_terminal_maps()
|
||||
local opts = { buffer = 0 }
|
||||
vim.keymap.set("t", "<esc>", [[<C-\><C-n>]], opts)
|
||||
vim.keymap.set("t", "jk", [[<C-\><C-n>]], opts)
|
||||
vim.keymap.set("t", "<A-h>", [[<Cmd>wincmd h<CR>]], opts)
|
||||
vim.keymap.set("t", "<A-j>", [[<Cmd>wincmd j<CR>]], opts)
|
||||
vim.keymap.set("t", "<A-k>", [[<Cmd>wincmd k<CR>]], opts)
|
||||
vim.keymap.set("t", "<A-l>", [[<Cmd>wincmd l<CR>]], opts)
|
||||
end
|
||||
|
||||
-- if you only want these mappings for toggle term use term://*toggleterm#* instead
|
||||
vim.cmd("autocmd! TermOpen term://* lua set_terminal_maps()")
|
||||
map("n", "<A-h>", ":wincmd h<CR>", opts)
|
||||
map("n", "<A-j>", ":wincmd j<CR>", opts)
|
||||
map("n", "<A-K>", ":wincmd k<CR>", opts)
|
||||
map("n", "<A-l>", ":wincmd l<CR>", opts)
|
||||
|
||||
-- harpoon man
|
||||
|
||||
map("n", "<C-1>", ":lua require('harpoon.ui').nav_file(1)<CR>", opts)
|
||||
map("n", "<C-2>", ":lua require('harpoon.ui').nav_file(2)<CR>", opts)
|
||||
map("n", "<C-3>", ":lua require('harpoon.ui').nav_file(3)<CR>", opts)
|
||||
map("n", "fma", ":lua require('harpoon.mark').add_file()<CR>", opts)
|
||||
map("n", "fmd", ":lua require('harpoon.mark').remove_file()<CR>", opts)
|
||||
|
||||
-- telescope
|
||||
map("n", "fb", ":Telescope file_browser<CR>", {})
|
||||
map("n", "fc", ":Cheatsheet<CR>", {})
|
||||
map("n", "ff", ":lua require('telescope.builtin').find_files()<CR>", {})
|
||||
map("n", "fg", ":lua require('telescope.builtin').live_grep()<CR>", {})
|
||||
map("n", "fh", ":lua require('telescope.builtin').help_tags()<CR>", {})
|
||||
map("n", "fp", ":lua require'telescope'.extensions.project.project{}<CR>", { noremap = true, silent = true })
|
||||
map("n", "fm", ":Telescope harpoon marks<CR>", { noremap = true, silent = true })
|
||||
|
||||
vim.keymap.set("n", "<leader>z", ":lua require('telescope').extensions.zoxide.list{}<CR>")
|
||||
|
||||
-- trouble
|
||||
map("n", "<C-f>", "<cmd>TroubleToggle<CR>", term_opts)
|
||||
46
nvim/lua/config/lazy.lua
Normal file
46
nvim/lua/config/lazy.lua
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||
if not vim.loop.fs_stat(lazypath) then
|
||||
-- bootstrap lazy.nvim
|
||||
-- stylua: ignore
|
||||
vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", "--branch=stable", lazypath })
|
||||
end
|
||||
vim.opt.rtp:prepend(vim.env.LAZY or lazypath)
|
||||
|
||||
require("lazy").setup({
|
||||
spec = {
|
||||
-- add LazyVim and import its plugins
|
||||
{ "LazyVim/LazyVim", import = "lazyvim.plugins" },
|
||||
-- import any extras modules here
|
||||
-- { import = "lazyvim.plugins.extras.lang.typescript" },
|
||||
-- { import = "lazyvim.plugins.extras.lang.json" },
|
||||
-- { import = "lazyvim.plugins.extras.ui.mini-animate" },
|
||||
-- import/override with your plugins
|
||||
{ import = "plugins" },
|
||||
},
|
||||
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 }, -- automatically check for plugin updates
|
||||
performance = {
|
||||
rtp = {
|
||||
-- disable some rtp plugins
|
||||
disabled_plugins = {
|
||||
"gzip",
|
||||
-- "matchit",
|
||||
-- "matchparen",
|
||||
-- "netrwPlugin",
|
||||
"tarPlugin",
|
||||
"tohtml",
|
||||
"tutor",
|
||||
"zipPlugin",
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
20
nvim/lua/config/options.lua
Normal file
20
nvim/lua/config/options.lua
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
-- Options are automatically loaded before lazy.nvim startup
|
||||
-- Default options that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/options.lua
|
||||
-- Add any additional options here
|
||||
local options = {
|
||||
clipboard = "unnamedplus",
|
||||
mouse = "n",
|
||||
fileencoding = "utf-8",
|
||||
number = true,
|
||||
showmode = true,
|
||||
termguicolors = true,
|
||||
spelllang = "en_us",
|
||||
shell = "/usr/bin/zsh",
|
||||
autochdir = true,
|
||||
}
|
||||
|
||||
vim.g.mkdp_browser = "/usr/bin/firefox"
|
||||
vim.g.mkdp_auto_start = 1
|
||||
for k, v in pairs(options) do
|
||||
vim.opt[k] = v
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue