Created
January 25, 2023 12:13
-
-
Save jsun969/dd88d0629106da4f792d37b7b05c8b8c to your computer and use it in GitHub Desktop.
Lunar Vim Config
This file contains hidden or 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.opt.relativenumber = true | |
lvim.log.level = "warn" | |
lvim.format_on_save = { | |
enabled = true, | |
timeout = 60000, | |
} | |
lvim.colorscheme = "lunar" | |
lvim.leader = "space" | |
lvim.keys.normal_mode["<C-s>"] = ":w<cr>" | |
lvim.keys.insert_mode["jj"] = "<Esc>" | |
lvim.builtin.alpha.active = true | |
lvim.builtin.alpha.mode = "dashboard" | |
lvim.builtin.terminal.active = true | |
lvim.builtin.nvimtree.setup.view.side = "right" | |
lvim.builtin.nvimtree.setup.renderer.icons.show.git = false | |
lvim.builtin.lualine.sections.lualine_a = { "mode" } | |
lvim.builtin.treesitter.ensure_installed = { | |
"bash", | |
"c", | |
"javascript", | |
"json", | |
"lua", | |
"python", | |
"typescript", | |
"tsx", | |
"css", | |
"rust", | |
"java", | |
"yaml", | |
"prisma", | |
} | |
lvim.builtin.treesitter.highlight.enable = true | |
local formatters = require "lvim.lsp.null-ls.formatters" | |
formatters.setup { | |
{ | |
command = "prettierd", | |
filetypes = { | |
"javascript", | |
"javascriptreact", | |
"html", | |
"css", | |
"typescript", | |
"typescriptreact", | |
"markdown", | |
}, | |
}, | |
} | |
lvim.builtin.which_key.mappings["l"]["f"] = { | |
function() | |
require("lvim.lsp.utils").format { timeout_ms = 60000 } | |
end, | |
"Format", | |
} | |
local linters = require "lvim.lsp.null-ls.linters" | |
linters.setup { | |
{ | |
command = "eslint_d", | |
filetypes = { "javascript", "javascriptreact", "typescript", "typescriptreact" }, | |
}, | |
{ | |
command = "markdownlint", | |
filetypes = { "markdown" } | |
} | |
} | |
local null_ls = require("null-ls") | |
null_ls.register({ | |
null_ls.builtins.diagnostics.cspell.with({ | |
diagnostics_postprocess = function(diagnostic) | |
diagnostic.severity = vim.diagnostic.severity.INFO | |
end, | |
disabled_filetypes = { "NvimTree" } | |
}), | |
}) | |
local code_actions = require "lvim.lsp.null-ls.code_actions" | |
code_actions.setup { | |
{ | |
command = "eslint_d", | |
filetypes = { "typescript", "typescriptreact", "javascript", "javascriptreact" }, | |
}, | |
} | |
lvim.plugins = { | |
{ | |
"folke/trouble.nvim", | |
cmd = "TroubleToggle", | |
}, | |
{ | |
"ggandor/leap.nvim", | |
config = function() | |
require('leap').add_default_mappings() | |
end, | |
}, | |
{ | |
"folke/todo-comments.nvim", | |
event = "BufRead", | |
config = function() | |
require("todo-comments").setup() | |
end, | |
}, | |
{ | |
"windwp/nvim-ts-autotag", | |
config = function() | |
require("nvim-ts-autotag").setup() | |
end, | |
}, | |
{ | |
"f-person/git-blame.nvim", | |
event = "BufRead", | |
config = function() | |
vim.cmd "highlight default link gitblame SpecialComment" | |
vim.g.gitblame_enabled = 0 | |
vim.g.gitblame_set_extmark_options = { | |
hl_mode = "combine", | |
} | |
end, | |
}, | |
{ | |
"folke/persistence.nvim", | |
event = "BufReadPre", | |
module = "persistence", | |
config = function() | |
require("persistence").setup() | |
end, | |
}, | |
{ | |
"tpope/vim-surround" | |
}, | |
{ | |
"wakatime/vim-wakatime" | |
}, | |
{ | |
"karb94/neoscroll.nvim", | |
event = "WinScrolled", | |
config = function() | |
vim.diagnostic.config({ virtual_lines = false }) | |
require('neoscroll').setup() | |
end | |
}, | |
{ | |
"samodostal/image.nvim", | |
config = function() | |
require("image").setup({ | |
render = { | |
foreground_color = true, | |
background_color = true, | |
}, | |
}) | |
end | |
}, | |
} | |
lvim.builtin.which_key.mappings["t"] = { | |
name = "Diagnostics", | |
t = { "<cmd>TroubleToggle<cr>", "trouble" }, | |
w = { "<cmd>TroubleToggle workspace_diagnostics<cr>", "workspace" }, | |
d = { "<cmd>TroubleToggle document_diagnostics<cr>", "document" }, | |
q = { "<cmd>TroubleToggle quickfix<cr>", "quickfix" }, | |
l = { "<cmd>TroubleToggle loclist<cr>", "loclist" }, | |
r = { "<cmd>TroubleToggle lsp_references<cr>", "references" }, | |
} | |
lvim.builtin.which_key.mappings["S"] = { | |
name = "Session", | |
c = { "<cmd>lua require{ 'persistence' }.load()<cr>", "Restore last session for current dir" }, | |
l = { "<cmd>lua require('persistence').load({ last = true })<cr>", "Restore last session" }, | |
Q = { "<cmd>lua require('persistence').stop()<cr>", "Quit without saving session" }, | |
} | |
-- NOTE: The log is in ~/.cache/nvim/null-ls.log, not ~/.cache/lvim like :NullLsLog opens | |
-- lvim.lsp.null_ls.setup.debug = true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment