Last active
May 21, 2024 05:33
-
-
Save mandaputtra/11277ecae23975a64ba15c31139d9a89 to your computer and use it in GitHub Desktop.
My lvim configuration
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
-- vim options | |
vim.opt.shiftwidth = 2 | |
vim.opt.tabstop = 2 | |
vim.opt.relativenumber = true | |
-- general | |
lvim.log.level = "info" | |
lvim.format_on_save = { | |
enabled = true, | |
pattern = "*.lua,*.js,*.ts,*.py", | |
timeout = 1000, | |
} | |
-- to disable icons and use a minimalist setup, uncomment the following | |
-- lvim.use_icons = false | |
-- keymappings <https://www.lunarvim.org/docs/configuration/keybindings> | |
lvim.leader = "space" | |
-- add your own keymapping | |
lvim.keys.normal_mode["<C-s>"] = ":w<cr>" | |
lvim.keys.normal_mode["<C-s>"] = ":w<cr>" | |
lvim.keys.normal_mode["<C-s>"] = ":w<cr>" | |
lvim.keys.normal_mode["<C-s>"] = ":w<cr>" | |
lvim.keys.normal_mode["<Tab>"] = ":bn<cr>" | |
lvim.keys.normal_mode["<S-Tab>"] = ":bp<cr>" | |
-- lvim.keys.normal_mode["<S-l>"] = ":BufferLineCycleNext<CR>" | |
-- lvim.keys.normal_mode["<S-h>"] = ":BufferLineCyclePrev<CR>" | |
-- -- Use which-key to add extra bindings with the leader-key prefix | |
-- lvim.builtin.which_key.mappings["W"] = { | |
-- "<cmd>noautocmd w<cr>", "Save without formatting" | |
-- } | |
-- lvim.builtin.which_key.mappings["L"] = { | |
-- "<cmd>" | |
-- } | |
-- lvim.builtin.which_key.mappings["P"] = { "<cmd>Telescope projects<CR>", "Projects" } | |
-- -- Change theme settings | |
lvim.colorscheme = "srcery" | |
lvim.builtin.alpha.active = true | |
lvim.builtin.telescope.extensions.fzf = nil | |
lvim.builtin.alpha.mode = "startify" | |
lvim.builtin.terminal.active = true | |
lvim.builtin.nvimtree.setup.view.side = "right" | |
lvim.builtin.nvimtree.setup.renderer.icons.show.git = false | |
lvim.builtin.nvimtree.setup.renderer.icons.glyphs.folder = {} | |
-- Automatically install missing parsers when entering buffer | |
lvim.builtin.treesitter.auto_install = true | |
lvim.builtin.treesitter.ignore_install = { "haskell" } | |
lvim.builtin.treesitter.highlight.enable = true | |
-- -- always installed on startup, useful for parsers without a strict filetype | |
lvim.builtin.treesitter.ensure_installed = { | |
"comment", | |
"markdown_inline", | |
"regex", | |
"bash", | |
"c", | |
"javascript", | |
"json", | |
"lua", | |
"python", | |
"typescript", | |
"tsx", | |
"css", | |
"rust", | |
"java", | |
"yaml", | |
} | |
-- -- generic LSP settings <https://www.lunarvim.org/docs/languages#lsp-support> | |
-- --- disable automatic installation of servers | |
lvim.lsp.installer.setup.automatic_installation = false | |
-- ---configure a server manually. IMPORTANT: Requires `:LvimCacheReset` to take effect | |
-- ---see the full default list `:lua =lvim.lsp.automatic_configuration.skipped_servers` | |
-- vim.list_extend(lvim.lsp.automatic_configuration.skipped_servers, { "pyright" }) | |
-- local opts = {} -- check the lspconfig documentation for a list of all possible options | |
-- require("lvim.lsp.manager").setup("pyright", opts) | |
-- ---remove a server from the skipped list, e.g. eslint, or emmet_ls. IMPORTANT: Requires `:LvimCacheReset` to take effect | |
-- ---`:LvimInfo` lists which server(s) are skipped for the current filetype | |
-- lvim.lsp.automatic_configuration.skipped_servers = vim.tbl_filter(function(server) | |
-- return server ~= "emmet_ls" | |
-- end, lvim.lsp.automatic_configuration.skipped_servers) | |
-- -- you can set a custom on_attach function that will be used for all the language servers | |
-- -- See <https://github.com/neovim/nvim-lspconfig#keybindings-and-completion> | |
-- lvim.lsp.on_attach_callback = function(client, bufnr) | |
-- local function buf_set_option(...) | |
-- vim.api.nvim_buf_set_option(bufnr, ...) | |
-- end | |
-- --Enable completion triggered by <c-x><c-o> | |
-- buf_set_option("omnifunc", "v:lua.vim.lsp.omnifunc") | |
-- end | |
-- -- linters and formatters <https://www.lunarvim.org/docs/languages#lintingformatting> | |
-- local formatters = require "lvim.lsp.null-ls.formatters" | |
-- formatters.setup { | |
-- { command = "stylua" }, | |
-- { | |
-- command = "prettier", | |
-- extra_args = { "--print-width", "100" }, | |
-- filetypes = { "typescript", "typescriptreact" }, | |
-- }, | |
-- } | |
-- local linters = require "lvim.lsp.null-ls.linters" | |
-- linters.setup { | |
-- { command = "flake8", filetypes = { "python" } }, | |
-- { | |
-- command = "shellcheck", | |
-- args = { "--severity", "warning" }, | |
-- }, | |
-- } | |
-- Prettier configuration | |
local formatters = require "lvim.lsp.null-ls.formatters" | |
formatters.setup { | |
{ | |
command = "prettier", | |
filetypes = { | |
"javascriptreact", | |
"javascript", | |
"typescriptreact", | |
"typescript", | |
"json", | |
"html" | |
}, | |
}, | |
{ | |
command = "black", | |
filetypes = { | |
"python" | |
} | |
} | |
} | |
-- ESLint | |
local linters = require "lvim.lsp.null-ls.linters" | |
linters.setup { | |
{ | |
command = "eslint", | |
filetypes = { | |
"javascriptreact", | |
"javascript", | |
"typescriptreact", | |
"typescript", | |
"vue", | |
}, | |
}, | |
{ | |
command = "pylint", | |
filetypes = { | |
"python" | |
} | |
} | |
} | |
-- Code Actions | |
-- local code_actions = require "lvim.lsp.null-ls.code_actions" | |
-- code_actions.setup { | |
-- { | |
-- command = "eslint", | |
-- filetypes = { | |
-- "javascriptreact", | |
-- "javascript", | |
-- "typescriptreact", | |
-- "typescript", | |
-- "vue", | |
-- }, | |
-- }, | |
-- } | |
-- disable formatting in "tsserver" and "jsonls" | |
lvim.lsp.on_attach_callback = function(client, _) | |
if client.name == "tsserver" or client.name == "jsonls" then | |
client.server_capabilities.document_formatting = false | |
client.server_capabilities.document_range_formatting = false | |
end | |
end | |
-- Additional Plugins <https://www.lunarvim.org/docs/plugins#user-plugins> | |
lvim.plugins = { | |
{ "EdenEast/nightfox.nvim" }, | |
{ "tpope/vim-surround" }, | |
{ 'ellisonleao/glow.nvim', config = function() require("glow").setup() end }, | |
{ "tomlion/vim-solidity" }, | |
{ "psliwka/vim-smoothie" }, | |
{ 'bignimbus/pop-punk.vim' }, | |
{ 'laniusone/kyotonight.vim' }, | |
{ 'dart-lang/dart-vim-plugin' }, | |
{ 'mg979/vim-visual-multi' }, | |
{ 'srcery-colors/srcery-vim' }, | |
{ 'monkoose/nvlime', dependencies = { 'monkoose/parsley' } }, | |
{ | |
"akinsho/flutter-tools.nvim", | |
dependencies = { "nvim-lua/plenary.nvim" }, | |
config = function() | |
require("flutter-tools").setup { | |
lsp = { | |
on_attach = require("lvim.lsp").common_on_attach, | |
}, | |
} | |
end, | |
ft = "dart", | |
}, | |
{ 'Neevash/awesome-flutter-snippets' }, | |
} | |
vim.api.nvim_create_autocmd("BufEnter", { | |
pattern = { "*.njk", "*.hbs", "*.eta" }, | |
command = "setfiletype html", | |
}) | |
-- -- Autocommands (`:help autocmd`) <https://neovim.io/doc/user/autocmd.html> | |
-- vim.api.nvim_create_autocmd("FileType", { | |
-- pattern = "zsh", | |
-- callback = function() | |
-- -- let treesitter use bash highlight for zsh files as well | |
-- require("nvim-treesitter.highlight").attach(0, "bash") | |
-- end, | |
-- }) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment