format lua code
This commit is contained in:
parent
4e394d4138
commit
622889647d
|
@ -33,3 +33,5 @@ map('n', '<leader>2', ':BufferLineGoToBuffer 2<CR>', opt)
|
|||
map('n', '<leader>3', ':BufferLineGoToBuffer 3<CR>', opt)
|
||||
map('n', '<leader>4', ':BufferLineGoToBuffer 4<CR>', opt)
|
||||
map('n', '<leader>5', ':BufferLineGoToBuffer 5<CR>', opt)
|
||||
map("n", "<leader>bp", ":BufferLineCyclePrev<CR>", opt)
|
||||
map("n", "<leader>bn", ":BufferLineCycleNext<CR>", opt)
|
||||
|
|
|
@ -11,3 +11,28 @@ require("nvim-dap-virtual-text").setup()
|
|||
|
||||
vim.o.background = "dark" -- or "light" for light mode
|
||||
vim.cmd([[colorscheme gruvbox]])
|
||||
|
||||
local null_ls = require("null-ls")
|
||||
local augroup = vim.api.nvim_create_augroup("LspFormatting", {})
|
||||
null_ls.setup({
|
||||
debug = false,
|
||||
sources = {
|
||||
null_ls.builtins.formatting.stylua,
|
||||
null_ls.builtins.diagnostics.eslint,
|
||||
null_ls.builtins.completion.spell,
|
||||
},
|
||||
-- 保存自动格式化
|
||||
on_attach = function(client, bufnr)
|
||||
if client.supports_method("textDocument/formatting") then
|
||||
vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr })
|
||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
group = augroup,
|
||||
buffer = bufnr,
|
||||
callback = function()
|
||||
-- on 0.8, you should use vim.lsp.buf.format({ bufnr = bufnr }) instead
|
||||
vim.lsp.buf.format({bufnr = bufnr })
|
||||
end,
|
||||
})
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
|
117
lua/plugins.lua
117
lua/plugins.lua
|
@ -1,22 +1,22 @@
|
|||
return require('packer').startup(function()
|
||||
-- Packer can manage itself
|
||||
use 'wbthomason/packer.nvim'
|
||||
-- 文件树
|
||||
use {
|
||||
'nvim-tree/nvim-tree.lua',
|
||||
requires = {
|
||||
'nvim-tree/nvim-web-devicons', -- optional, for file icons
|
||||
},
|
||||
tag = 'nightly' -- optional, updated every week. (see issue #1193)
|
||||
}
|
||||
-- Packer can manage itself
|
||||
use 'wbthomason/packer.nvim'
|
||||
-- 文件树
|
||||
use {
|
||||
'nvim-tree/nvim-tree.lua',
|
||||
requires = {
|
||||
'nvim-tree/nvim-web-devicons', -- optional, for file icons
|
||||
},
|
||||
tag = 'nightly' -- optional, updated every week. (see issue #1193)
|
||||
}
|
||||
-- 欢迎页
|
||||
use {
|
||||
'goolord/alpha-nvim',
|
||||
requires = { 'nvim-tree/nvim-web-devicons' },
|
||||
config = function ()
|
||||
require'alpha'.setup(require'alpha.themes.startify'.config)
|
||||
end
|
||||
}
|
||||
'goolord/alpha-nvim',
|
||||
requires = { 'nvim-tree/nvim-web-devicons' },
|
||||
config = function ()
|
||||
require'alpha'.setup(require'alpha.themes.startify'.config)
|
||||
end
|
||||
}
|
||||
-- 主题
|
||||
use { "ellisonleao/gruvbox.nvim" }
|
||||
-- 代码缩略图
|
||||
|
@ -35,51 +35,46 @@ return require('packer').startup(function()
|
|||
use { "rcarriga/nvim-dap-ui", requires = {"mfussenegger/nvim-dap"} }
|
||||
-- 当前工作目录
|
||||
use {
|
||||
"ahmedkhalf/project.nvim",
|
||||
config = function()
|
||||
require("project_nvim").setup {
|
||||
-- your configuration comes here
|
||||
-- or leave it empty to use the default settings
|
||||
-- refer to the configuration section below
|
||||
"ahmedkhalf/project.nvim",
|
||||
config = function()
|
||||
require("project_nvim").setup{}
|
||||
end
|
||||
}
|
||||
end
|
||||
}
|
||||
-- 空白缩进
|
||||
use "lukas-reineke/indent-blankline.nvim"
|
||||
-- 改善启动时间
|
||||
use 'lewis6991/impatient.nvim'
|
||||
-- 终端管理
|
||||
use {"akinsho/toggleterm.nvim", tag = '*', config = function()
|
||||
require("toggleterm").setup()
|
||||
end}
|
||||
-- TODO管理
|
||||
use {
|
||||
"folke/todo-comments.nvim",
|
||||
requires = "nvim-lua/plenary.nvim",
|
||||
config = function()
|
||||
require("todo-comments").setup {
|
||||
-- your configuration comes here
|
||||
-- or leave it empty to use the default settings
|
||||
-- refer to the configuration section below
|
||||
-- 空白缩进
|
||||
use "lukas-reineke/indent-blankline.nvim"
|
||||
-- 改善启动时间
|
||||
use 'lewis6991/impatient.nvim'
|
||||
-- 终端管理
|
||||
use {"akinsho/toggleterm.nvim", tag = '*', config = function()
|
||||
require("toggleterm").setup()
|
||||
end
|
||||
}
|
||||
end
|
||||
}
|
||||
-- git 管理
|
||||
use {
|
||||
'lewis6991/gitsigns.nvim',
|
||||
}
|
||||
-- 注释管理
|
||||
use {
|
||||
'numToStr/Comment.nvim',
|
||||
config = function()
|
||||
require('Comment').setup()
|
||||
end
|
||||
}
|
||||
-- coc 代码提示
|
||||
use {'neoclide/coc.nvim', branch = 'release'}
|
||||
-- 搜索
|
||||
use {
|
||||
'nvim-telescope/telescope.nvim', tag = '0.1.1',
|
||||
requires = { {'nvim-lua/plenary.nvim'} }
|
||||
}
|
||||
-- TODO管理
|
||||
use {
|
||||
"folke/todo-comments.nvim",
|
||||
requires = "nvim-lua/plenary.nvim",
|
||||
config = function()
|
||||
require("todo-comments").setup{}
|
||||
end
|
||||
}
|
||||
-- git 管理
|
||||
use {
|
||||
'lewis6991/gitsigns.nvim',
|
||||
}
|
||||
-- 注释管理
|
||||
use {
|
||||
'numToStr/Comment.nvim',
|
||||
config = function()
|
||||
require('Comment').setup()
|
||||
end
|
||||
}
|
||||
-- coc 代码提示
|
||||
use {'neoclide/coc.nvim', branch = 'release'}
|
||||
-- 搜索
|
||||
use {
|
||||
'nvim-telescope/telescope.nvim', tag = '0.1.1',
|
||||
requires = { {'nvim-lua/plenary.nvim'} }
|
||||
}
|
||||
-- lua 代码格式化
|
||||
use({ "jose-elias-alvarez/null-ls.nvim", requires = "nvim-lua/plenary.nvim" })
|
||||
end)
|
||||
|
|
Loading…
Reference in New Issue