Skip to content

Commit

Permalink
remove none-ls and change to conform.nvim
Browse files Browse the repository at this point in the history
  • Loading branch information
BrightXiaoHan committed Jan 19, 2024
1 parent 38e2a27 commit c37350d
Show file tree
Hide file tree
Showing 5 changed files with 105 additions and 138 deletions.
2 changes: 1 addition & 1 deletion general/NvChad
19 changes: 19 additions & 0 deletions general/custom/configs/conform.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
local options = {
lsp_fallback = true,
formatters_by_ft = {
lua = { "stylua" },

javascript = { "prettier" },
css = { "prettier" },
html = { "prettier" },
json = { "prettier" },
jsonc = { "prettier" },
markdown = { "prettier" },

sh = { "shfmt" },

python = { "black", "isort", "autoflake" },
},
}

require("conform").setup(options)
50 changes: 0 additions & 50 deletions general/custom/configs/null-ls.lua

This file was deleted.

19 changes: 12 additions & 7 deletions general/custom/mappings.lua
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ M.general = {
["<C-a>"] = { "gg<S-v>G", "Select All" },
-- toggle wrap or unwrap lines
["<leader>w"] = {
"<cmd>lua ToggleWrap()<cr>",
"<cmd>lua ToggleWrap()<cr>",
"Toggle wrap",
},
-- toggle mouse mode or disable it
["<leader>m"] = {
"<cmd>lua vim.o.mouse = vim.o.mouse == 'a' and 'v' or 'a'<cr>",
"Toggle mouse mode",
},
-- toggle mouse mode or disable it
["<leader>m"] = {
"<cmd>lua vim.o.mouse = vim.o.mouse == 'a' and 'v' or 'a'<cr>",
"Toggle mouse mode",
},
-- Window
["<C-Left>"] = { "<C-w><" },
["<C-Right>"] = { "<C-w>>", "" },
Expand Down Expand Up @@ -77,7 +77,12 @@ M.copilot = {
M.lsp = {
n = {
["gd"] = { "<cmd>lua vim.lsp.buf.definition()<cr>", "Go to definition" },
["<leader>lf"] = { "<cmd>lua vim.lsp.buf.format()<cr>", "Format" },
["<leader>lf"] = {
function()
require("conform").format()
end,
"formatting",
},
["<leader>lr"] = { "<cmd>lua vim.lsp.buf.rename()<cr>", "Rename" },
["<leader>ld"] = { "<cmd>lua vim.diagnostic.open_float(0, {scope='line'})<CR>", "Line diagnostics" },
["<leader>lp"] = { "<cmd>lua vim.lsp.diagnostic.goto_prev()<cr>", "Previous diagnostic" },
Expand Down
153 changes: 73 additions & 80 deletions general/custom/plugins.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,86 +2,79 @@ local overrides = require("custom.configs.overrides")

---@type NvPluginSpec[]
local plugins = { -- Override plugin definition options
{
"neovim/nvim-lspconfig",
dependencies = { -- format & linting
{
"nvimtools/none-ls.nvim",
config = function()
require("custom.configs.null-ls")
end,
},
},
config = function()
require("plugins.configs.lspconfig")
require("custom.configs.lspconfig")
end, -- Override to setup mason-lspconfig
}, -- override plugin configs
{
"williamboman/mason.nvim",
opts = overrides.mason,
},
{
"nvim-treesitter/nvim-treesitter",
opts = overrides.treesitter,
lazy = false,
},
{
"nvim-tree/nvim-tree.lua",
opts = overrides.nvimtree,
}, -- Install a plugin
{
"hrsh7th/nvim-cmp",
opts = overrides.cmp,
},
{
"Nvchad/nvterm",
opts = overrides.nvterm,
},
{
"max397574/better-escape.nvim",
event = "InsertEnter",
config = function()
require("better_escape").setup()
end,
},
{
"iamcco/markdown-preview.nvim",
cmd = { "MarkdownPreviewToggle", "MarkdownPreview", "MarkdownPreviewStop" },
build = "cd app && npm install",
init = function()
vim.g.mkdp_filetypes = { "markdown" }
vim.g.mkdp_echo_preview_url = 1
vim.g.mkdp_open_to_the_world = 1
end,
ft = { "markdown" },
},
{
"github/copilot.vim",
lazy = false,
},
{
"Pocco81/auto-save.nvim",
lazy = false,
},
{
"stevearc/aerial.nvim",
opts = {},
-- Optional dependencies
dependencies = {
"nvim-treesitter/nvim-treesitter",
"nvim-tree/nvim-web-devicons",
},
lazy = false,
config = function()
require("aerial").setup({
layout = {
max_width = { 40, 0.2 },
min_width = 25,
},
})
end,
},
{
"stevearc/conform.nvim",
-- for users those who want auto-save conform + lazyloading!
-- event = "BufWritePre"
config = function()
require "custom.configs.conform"
end,
},
{
"williamboman/mason.nvim",
opts = overrides.mason,
},
{
"nvim-treesitter/nvim-treesitter",
opts = overrides.treesitter,
lazy = false,
},
{
"nvim-tree/nvim-tree.lua",
opts = overrides.nvimtree,
}, -- Install a plugin
{
"hrsh7th/nvim-cmp",
opts = overrides.cmp,
},
{
"Nvchad/nvterm",
opts = overrides.nvterm,
},
{
"max397574/better-escape.nvim",
event = "InsertEnter",
config = function()
require("better_escape").setup()
end,
},
{
"iamcco/markdown-preview.nvim",
cmd = { "MarkdownPreviewToggle", "MarkdownPreview", "MarkdownPreviewStop" },
build = "cd app && npm install",
init = function()
vim.g.mkdp_filetypes = { "markdown" }
vim.g.mkdp_echo_preview_url = 1
vim.g.mkdp_open_to_the_world = 1
end,
ft = { "markdown" },
},
{
"github/copilot.vim",
lazy = false,
},
{
"Pocco81/auto-save.nvim",
lazy = false,
},
{
"stevearc/aerial.nvim",
opts = {},
-- Optional dependencies
dependencies = {
"nvim-treesitter/nvim-treesitter",
"nvim-tree/nvim-web-devicons",
},
lazy = false,
config = function()
require("aerial").setup({
layout = {
max_width = { 40, 0.2 },
min_width = 25,
},
})
end,
},
}

return plugins

0 comments on commit c37350d

Please sign in to comment.