feat(kauffinger/lazyvim): new config with my own from kauffinger/lazyvim
This commit is contained in:
33
lua/config/autocmds.lua
Normal file
33
lua/config/autocmds.lua
Normal file
@@ -0,0 +1,33 @@
|
||||
-- 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
|
||||
|
||||
-- Define an autocmd group for the blade workaround
|
||||
local augroup = vim.api.nvim_create_augroup("lsp_blade_workaround", { clear = true })
|
||||
|
||||
-- Autocommand to temporarily change 'blade' filetype to 'php' when opening for LSP server activation
|
||||
vim.api.nvim_create_autocmd({ "BufRead", "BufNewFile" }, {
|
||||
group = augroup,
|
||||
pattern = "*.blade.php",
|
||||
callback = function()
|
||||
vim.bo.filetype = "php"
|
||||
end,
|
||||
})
|
||||
|
||||
-- Additional autocommand to switch back to 'blade' after LSP has attached
|
||||
vim.api.nvim_create_autocmd("LspAttach", {
|
||||
pattern = "*.blade.php",
|
||||
callback = function(args)
|
||||
vim.schedule(function()
|
||||
-- Check if the attached client is 'intelephense'
|
||||
for _, client in ipairs(vim.lsp.get_active_clients()) do
|
||||
if client.name == "intelephense" and client.attached_buffers[args.buf] then
|
||||
vim.api.nvim_buf_set_option(args.buf, "filetype", "blade")
|
||||
-- update treesitter parser to blade
|
||||
vim.api.nvim_buf_set_option(args.buf, "syntax", "blade")
|
||||
break
|
||||
end
|
||||
end
|
||||
end)
|
||||
end,
|
||||
})
|
||||
51
lua/config/keymaps.lua
Normal file
51
lua/config/keymaps.lua
Normal file
@@ -0,0 +1,51 @@
|
||||
-- Keymaps are automatically loaded on the VeryLazy event
|
||||
-- Default keymaps that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/keymaps.lua
|
||||
-- Add any additional keymaps 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 keymap 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
|
||||
|
||||
map("n", "<leader>gd", function()
|
||||
Util.float_term(
|
||||
{ "lazydocker", "-f", Util.get_root() .. "docker-compose.yml" },
|
||||
{ cwd = Util.get_root(), esc_esc = false }
|
||||
)
|
||||
end, { desc = "LazyDocker (root dir)" })
|
||||
|
||||
local bind = vim.keymap.set
|
||||
local opts = { silent = true, noremap = true }
|
||||
|
||||
-- for russian layout
|
||||
bind("i", "<c-х>", "<C-[>", opts)
|
||||
bind("n", "л", "gk", opts)
|
||||
bind("n", "о", "gj", opts)
|
||||
bind("i", "<C-г>", "<C-G>u<C-U>", opts)
|
||||
bind("i", "<C-ц>", "<C-G>u<C-W>", opts)
|
||||
|
||||
bind("n", "[c", function()
|
||||
require("treesitter-context").go_to_context()
|
||||
end)
|
||||
|
||||
--personal
|
||||
--normal mode
|
||||
bind("i", "jk", "<Esc>")
|
||||
--save
|
||||
bind("n", "zz", "<Cmd>:update<CR>")
|
||||
|
||||
bind("n", ",<space>", "<Cmd>:nohlsearch<CR>")
|
||||
|
||||
-- namespace php
|
||||
vim.keymap.set("n", "<leader>u", "<cmd>GetClass<cr>")
|
||||
vim.keymap.set("n", "<leader>un", "<cmd>Namespace<cr>")
|
||||
|
||||
vim.keymap.set("n", "<leader>[", "<Cmd>call append(line('.') - 1, repeat([''], v:count1))<CR>")
|
||||
vim.keymap.set("n", "<leader>]", "<Cmd>call append(line('.'), repeat([''], v:count1))<CR>")
|
||||
55
lua/config/lazy.lua
Normal file
55
lua/config/lazy.lua
Normal file
@@ -0,0 +1,55 @@
|
||||
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.lang.yaml" },
|
||||
{ import = "lazyvim.plugins.extras.lang.docker" },
|
||||
{ import = "lazyvim.plugins.extras.lang.tex" },
|
||||
-- { import = "lazyvim.plugins.extras.lang.python" },
|
||||
{ import = "lazyvim.plugins.extras.coding.copilot" },
|
||||
{ import = "lazyvim.plugins.extras.dap.core" },
|
||||
{ import = "lazyvim.plugins.extras.lsp.none-ls" },
|
||||
-- { import = "lazyvim.plugins.extras.lang.go" },
|
||||
{ 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 = { "everforest" } },
|
||||
checker = { enabled = true, notify = false }, -- automatically check for plugin updates
|
||||
performance = {
|
||||
rtp = {
|
||||
-- disable some rtp plugins
|
||||
disabled_plugins = {
|
||||
"gzip",
|
||||
-- "matchit",
|
||||
-- "matchparen",
|
||||
-- "netrwPlugin",
|
||||
"tarPlugin",
|
||||
"tohtml",
|
||||
"tutor",
|
||||
"zipPlugin",
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
7
lua/config/options.lua
Normal file
7
lua/config/options.lua
Normal file
@@ -0,0 +1,7 @@
|
||||
-- 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
|
||||
vim.o.relativenumber = false
|
||||
|
||||
-- vim.api.nvim_set_keymap("n", "<Tab>", ":bnext<CR>", { noremap = true })
|
||||
-- vim.api.nvim_set_keymap("n", "<S-Tab>", ":bprev<CR>", { noremap = true })
|
||||
Reference in New Issue
Block a user