Last active
June 14, 2024 01:42
-
-
Save famasya/852a31de76d62e83b3d2b6766193a42a to your computer and use it in GitHub Desktop.
lvim config
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lvim.plugins = { | |
{ | |
"ggandor/leap.nvim", | |
name = "leap", | |
config = function() | |
require("leap").add_default_mappings() | |
end, | |
}, | |
{ | |
"ray-x/lsp_signature.nvim", | |
event = "VeryLazy", | |
opts = {}, | |
config = function(_, opts) | |
require 'lsp_signature'.setup(opts) | |
end | |
}, | |
{ | |
"dmmulroy/ts-error-translator.nvim", | |
config = function() | |
require("ts-error-translator").setup() | |
end | |
}, | |
{ | |
"folke/trouble.nvim", | |
dependencies = { "nvim-tree/nvim-web-devicons" }, | |
config = function() | |
require("trouble").setup({ | |
position = "right" | |
}) | |
lvim.builtin.which_key.mappings["t"] = { | |
name = "Trouble", | |
r = { "<cmd>TroubleToggle lsp_references<cr>", "References" }, | |
f = { "<cmd>TroubleToggle lsp_definitions<cr>", "Definitions" }, | |
d = { "<cmd>TroubleToggle document_diagnostics<cr>", "Diagnostics" }, | |
q = { "<cmd>TroubleToggle quickfix<cr>", "QuickFix" }, | |
l = { "<cmd>TroubleToggle loclist<cr>", "LocationList" }, | |
w = { "<cmd>TroubleToggle workspace_diagnostics<cr>", "Diagnostics" }, | |
} | |
end | |
}, | |
{ | |
"kevinhwang91/nvim-ufo", -- fold handling | |
dependencies = { | |
"neovim/nvim-lspconfig", | |
"nvim-treesitter/nvim-treesitter", | |
"kevinhwang91/promise-async", | |
}, | |
config = function() | |
vim.o.foldlevel = 99 -- Using ufo provider need a large value, feel free to decrease the value | |
vim.o.foldlevelstart = 99 | |
vim.keymap.set("n", "zR", require("ufo").openAllFolds) | |
vim.keymap.set("n", "zM", require("ufo").closeAllFolds) | |
require("ufo").setup({ | |
provider_selector = function(_, filetype, _) | |
if (filetype == "norg") then | |
return { "treesitter" } | |
end | |
end | |
}) | |
end | |
}, | |
{ | |
"kevinhwang91/nvim-hlslens", | |
config = function() | |
require('hlslens').setup() | |
local kopts = { noremap = true, silent = true } | |
vim.api.nvim_set_keymap('n', 'n', | |
[[<Cmd>execute('normal! ' . v:count1 . 'n')<CR><Cmd>lua require('hlslens').start()<CR>]], | |
kopts) | |
vim.api.nvim_set_keymap('n', 'N', | |
[[<Cmd>execute('normal! ' . v:count1 . 'N')<CR><Cmd>lua require('hlslens').start()<CR>]], | |
kopts) | |
vim.api.nvim_set_keymap('n', '*', [[*<Cmd>lua require('hlslens').start()<CR>]], kopts) | |
vim.api.nvim_set_keymap('n', '#', [[#<Cmd>lua require('hlslens').start()<CR>]], kopts) | |
vim.api.nvim_set_keymap('n', 'g*', [[g*<Cmd>lua require('hlslens').start()<CR>]], kopts) | |
vim.api.nvim_set_keymap('n', 'g#', [[g#<Cmd>lua require('hlslens').start()<CR>]], kopts) | |
vim.api.nvim_set_keymap('n', '<Leader>l', '<Cmd>noh<CR>', kopts) | |
end | |
}, | |
{ | |
"EdenEast/nightfox.nvim", | |
config = function() | |
require("nightfox").setup({ | |
options = { | |
styles = { | |
comments = "italic" | |
} | |
} | |
}) | |
end | |
}, | |
{ | |
"petertriho/nvim-scrollbar", | |
config = function() | |
require("scrollbar").setup() | |
end | |
}, | |
{ | |
"andersevenrud/nvim_context_vt" | |
}, | |
{ | |
"nvim-lua/plenary.nvim" | |
}, | |
{ | |
"nvim-pack/nvim-spectre", | |
dependencies = { "nvim-tree/nvim-web-devicons" }, | |
config = function() | |
require("spectre").setup() | |
lvim.builtin.which_key.mappings["S"] = { | |
name = "Spectre", | |
t = { '<cmd>lua require("spectre").toggle()<CR>', "Toggle Spectre" }, | |
w = { '<cmd>lua require("spectre").open_visual({select_word=true})<CR>', "Search current word" }, | |
e = { '<esc><cmd>lua require("spectre").open_visual()<CR>', "Search current word" }, | |
p = { '<cmd>lua require("spectre").open_file_search({select_word=true})<CR>', "Search current file" }, | |
} | |
end | |
}, | |
{ "lukas-reineke/virt-column.nvim", opts = {} }, | |
} | |
lvim.format_on_save.enabled = true | |
lvim.colorscheme = "nightfox" | |
vim.opt.relativenumber = true | |
-- move line | |
vim.cmd('nnoremap <S-Up> :m-2<CR>') | |
vim.cmd('nnoremap <S-Down> :m+<CR>') | |
vim.cmd('inoremap <S-Up> <Esc>:m-2<CR>') | |
vim.cmd('inoremap <S-Down> <Esc>:m+<CR>') | |
vim.opt.wrap = true | |
vim.opt.cmdheight = 2 | |
lvim.builtin.treesitter.rainbow.enable = true | |
lvim.autocommands = { | |
{ | |
"BufEnter", | |
{ | |
pattern = { "*.ts", "*.tsx", "*.js", "*.jsx" }, | |
command = "set expandtab! shiftwidth=0 tabstop=2" | |
} | |
} | |
} | |
-- silence yml format error | |
local cap = vim.lsp.protocol.make_client_capabilities() | |
cap.textDocument.foldingRange = { | |
dynamicRegistration = false, | |
lineFoldingOnly = true | |
} | |
require("mason-lspconfig").setup_handlers { | |
-- The first entry (without a key) will be the default handler | |
-- and will be called for each installed server that doesn't have | |
-- a dedicated handler. | |
function(server_name) -- default handler (optional) | |
require("lspconfig")[server_name].setup { | |
capabilities = cap, | |
} | |
end, | |
["yamlls"] = function() | |
require("lspconfig").yamlls.setup { | |
capabilities = cap, | |
settings = { | |
yaml = { | |
schemas = { | |
-- Add the schema for gitlab piplines | |
["https://gitlab.com/gitlab-org/gitlab/-/raw/master/app/assets/javascripts/editor/schema/ci.json"] = "*.gitlab-ci.yml", | |
}, | |
}, | |
}, | |
} | |
end, | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment