update
This commit is contained in:
parent
4a1ad02483
commit
f40ae333fe
@ -5,62 +5,62 @@ local tree_cb = require 'nvim-tree.config'.nvim_tree_callback -- following optio
|
||||
-- s open item in system tool
|
||||
-- a add file/dir
|
||||
require 'nvim-tree'.setup {
|
||||
open_on_setup = true;
|
||||
open_on_setup_file = false,
|
||||
git = {
|
||||
enable = true,
|
||||
ignore = true,
|
||||
timeout = 400,
|
||||
},
|
||||
filters = {
|
||||
dotfiles = true,
|
||||
custom = {},
|
||||
exclude = {},
|
||||
},
|
||||
system_open = {
|
||||
cmd = nil,
|
||||
args = {},
|
||||
},
|
||||
view = {
|
||||
width = 24,
|
||||
mappings = {
|
||||
custom_only = true,
|
||||
list = {
|
||||
{ key = "<BS>", cb = tree_cb("dir_up") },
|
||||
{ key = { "q", "<Esc>" }, cb = tree_cb("close") },
|
||||
{ key = { "<2-RightMouse>", "<CR>" }, cb = tree_cb("cd") },
|
||||
{ key = "<Tab>", cb = tree_cb("preview") },
|
||||
{ key = "R", cb = tree_cb("refresh") },
|
||||
{ key = "h", cb = tree_cb("close_node") },
|
||||
open_on_setup = true;
|
||||
open_on_setup_file = false,
|
||||
git = {
|
||||
enable = true,
|
||||
ignore = true,
|
||||
timeout = 400,
|
||||
},
|
||||
filters = {
|
||||
dotfiles = true,
|
||||
custom = {},
|
||||
exclude = {},
|
||||
},
|
||||
system_open = {
|
||||
cmd = nil,
|
||||
args = {},
|
||||
},
|
||||
view = {
|
||||
width = 24,
|
||||
mappings = {
|
||||
custom_only = true,
|
||||
list = {
|
||||
{ key = "<BS>", cb = tree_cb("dir_up") },
|
||||
{ key = { "q", "<Esc>" }, cb = tree_cb("close") },
|
||||
{ key = { "<2-RightMouse>", "<CR>" }, cb = tree_cb("cd") },
|
||||
{ key = "<Tab>", cb = tree_cb("preview") },
|
||||
{ key = "R", cb = tree_cb("refresh") },
|
||||
{ key = "h", cb = tree_cb("close_node") },
|
||||
|
||||
|
||||
{ key = { "o", "<CR>", "<2-RightMouse>" }, cb = tree_cb("edit") },
|
||||
{ key = "a", cb = tree_cb("create") },
|
||||
{ key = "d", cb = tree_cb("remove") },
|
||||
{ key = "r", cb = tree_cb("rename") },
|
||||
{ key = "x", cb = tree_cb("cut") },
|
||||
{ key = "c", cb = tree_cb("copy") },
|
||||
{ key = "p", cb = tree_cb("paste") },
|
||||
{ key = { "o", "<CR>", "<2-RightMouse>" }, cb = tree_cb("edit") },
|
||||
{ key = "a", cb = tree_cb("create") },
|
||||
{ key = "d", cb = tree_cb("remove") },
|
||||
{ key = "r", cb = tree_cb("rename") },
|
||||
{ key = "x", cb = tree_cb("cut") },
|
||||
{ key = "c", cb = tree_cb("copy") },
|
||||
{ key = "p", cb = tree_cb("paste") },
|
||||
|
||||
{ key = "G", cb = tree_cb("prev_git_item") },
|
||||
{ key = "g", cb = tree_cb("next_git_item") },
|
||||
{ key = "?", cb = tree_cb("toggle_help") },
|
||||
{ key = "G", cb = tree_cb("prev_git_item") },
|
||||
{ key = "g", cb = tree_cb("next_git_item") },
|
||||
{ key = "?", cb = tree_cb("toggle_help") },
|
||||
|
||||
{ key = "<", cb = tree_cb("prev_sibling") },
|
||||
{ key = ">", cb = tree_cb("next_sibling") },
|
||||
{ key = "P", cb = tree_cb("parent_node") },
|
||||
{ key = "K", cb = tree_cb("first_sibling") },
|
||||
{ key = "J", cb = tree_cb("last_sibling") },
|
||||
{ key = "I", cb = tree_cb("toggle_ignored") },
|
||||
{ key = "H", cb = tree_cb("toggle_dotfiles") },
|
||||
{ key = "<C-r>", cb = tree_cb("full_rename") },
|
||||
{ key = "y", cb = tree_cb("copy_name") },
|
||||
{ key = "Y", cb = tree_cb("copy_path") },
|
||||
{ key = "gy", cb = tree_cb("copy_absolute_path") },
|
||||
{ key = "S", cb = tree_cb("system_open") },
|
||||
}
|
||||
}
|
||||
}
|
||||
{ key = "<", cb = tree_cb("prev_sibling") },
|
||||
{ key = ">", cb = tree_cb("next_sibling") },
|
||||
{ key = "P", cb = tree_cb("parent_node") },
|
||||
{ key = "K", cb = tree_cb("first_sibling") },
|
||||
{ key = "J", cb = tree_cb("last_sibling") },
|
||||
{ key = "I", cb = tree_cb("toggle_ignored") },
|
||||
{ key = "H", cb = tree_cb("toggle_dotfiles") },
|
||||
{ key = "<C-r>", cb = tree_cb("full_rename") },
|
||||
{ key = "y", cb = tree_cb("copy_name") },
|
||||
{ key = "Y", cb = tree_cb("copy_path") },
|
||||
{ key = "gy", cb = tree_cb("copy_absolute_path") },
|
||||
{ key = "S", cb = tree_cb("system_open") },
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -69,49 +69,55 @@ vim.cmd([[colorscheme gruvbox]])
|
||||
|
||||
vim.opt.termguicolors = true
|
||||
require("bufferline").setup {
|
||||
options = {
|
||||
sort_by = 'id',
|
||||
numbers = 'ordinal',
|
||||
-- 左侧让出 nvim-tree 的位置
|
||||
diagnostics = "nvim_lsp";
|
||||
offsets = { {
|
||||
filetype = "NvimTree",
|
||||
text = "veypi.com",
|
||||
highlight = "Directory",
|
||||
text_align = "center"
|
||||
} }
|
||||
}
|
||||
options = {
|
||||
sort_by = 'id',
|
||||
numbers = 'ordinal',
|
||||
-- 左侧让出 nvim-tree 的位置
|
||||
diagnostics = "nvim_lsp";
|
||||
offsets = { {
|
||||
filetype = "NvimTree",
|
||||
text = "veypi.com",
|
||||
highlight = "Directory",
|
||||
text_align = "center"
|
||||
} }
|
||||
}
|
||||
}
|
||||
|
||||
vim.g.gitblame_display_virtual_text = 0 -- Disable virtual text
|
||||
vim.g.gitblame_date_format = "%r"
|
||||
local git_blame = require('gitblame')
|
||||
|
||||
require('lualine').setup {
|
||||
options = {
|
||||
icons_enabled = true,
|
||||
theme = 'auto',
|
||||
component_separators = { left = '', right = '' },
|
||||
section_separators = { left = '', right = '' },
|
||||
disabled_filetypes = {},
|
||||
always_divide_middle = true,
|
||||
globalstatus = false,
|
||||
},
|
||||
sections = {
|
||||
lualine_a = { 'mode' },
|
||||
lualine_b = { 'branch', 'diff', 'diagnostics' },
|
||||
lualine_c = { 'filename' },
|
||||
lualine_x = { 'encoding', 'fileformat', 'filetype' },
|
||||
lualine_y = { 'progress' },
|
||||
lualine_z = { 'location' }
|
||||
},
|
||||
inactive_sections = {
|
||||
lualine_a = {},
|
||||
lualine_b = {},
|
||||
lualine_c = { 'filename' },
|
||||
lualine_x = { 'location' },
|
||||
lualine_y = {},
|
||||
lualine_z = {}
|
||||
},
|
||||
tabline = {},
|
||||
extensions = {}
|
||||
options = {
|
||||
icons_enabled = true,
|
||||
theme = 'auto',
|
||||
component_separators = { left = '', right = '' },
|
||||
section_separators = { left = '', right = '' },
|
||||
disabled_filetypes = {},
|
||||
always_divide_middle = true,
|
||||
globalstatus = false,
|
||||
},
|
||||
sections = {
|
||||
lualine_a = { 'mode' },
|
||||
lualine_b = { 'branch', 'diff', 'diagnostics' },
|
||||
lualine_c = {
|
||||
{ git_blame.get_current_blame_text, cond = git_blame.is_blame_text_available },
|
||||
'filename'
|
||||
},
|
||||
lualine_x = { 'encoding', 'fileformat', 'filetype' },
|
||||
lualine_y = { 'progress' },
|
||||
lualine_z = { 'location' }
|
||||
},
|
||||
inactive_sections = {
|
||||
lualine_a = {},
|
||||
lualine_b = {},
|
||||
lualine_c = { 'filename' },
|
||||
lualine_x = { 'location' },
|
||||
lualine_y = {},
|
||||
lualine_z = {}
|
||||
},
|
||||
tabline = {},
|
||||
extensions = {}
|
||||
}
|
||||
|
||||
|
||||
@ -119,29 +125,29 @@ require('lualine').setup {
|
||||
|
||||
|
||||
require 'nvim-treesitter.configs'.setup {
|
||||
-- A list of parser names, or "all"
|
||||
ensure_installed = { "c", "lua", "rust", "go", "javascript", "html", "json", "python", "typescript", "vue", "css" },
|
||||
-- A list of parser names, or "all"
|
||||
ensure_installed = { "c", "lua", "rust", "go", "javascript", "html", "json", "python", "typescript", "vue", "css" },
|
||||
|
||||
-- Install parsers synchronously (only applied to `ensure_installed`)
|
||||
sync_install = false,
|
||||
-- Install parsers synchronously (only applied to `ensure_installed`)
|
||||
sync_install = false,
|
||||
|
||||
-- List of parsers to ignore installing (for "all")
|
||||
ignore_install = { "" },
|
||||
-- List of parsers to ignore installing (for "all")
|
||||
ignore_install = { "" },
|
||||
|
||||
highlight = {
|
||||
-- `false` will disable the whole extension
|
||||
enable = true,
|
||||
highlight = {
|
||||
-- `false` will disable the whole extension
|
||||
enable = true,
|
||||
|
||||
-- NOTE: these are the names of the parsers and not the filetype. (for example if you want to
|
||||
-- disable highlighting for the `tex` filetype, you need to include `latex` in this list as this is
|
||||
-- the name of the parser)
|
||||
-- list of language that will be disabled
|
||||
disable = {},
|
||||
-- NOTE: these are the names of the parsers and not the filetype. (for example if you want to
|
||||
-- disable highlighting for the `tex` filetype, you need to include `latex` in this list as this is
|
||||
-- the name of the parser)
|
||||
-- list of language that will be disabled
|
||||
disable = {},
|
||||
|
||||
-- Setting this to true will run `:h syntax` and tree-sitter at the same time.
|
||||
-- Set this to `true` if you depend on 'syntax' being enabled (like for indentation).
|
||||
-- Using this option may slow down your editor, and you may see some duplicate highlights.
|
||||
-- Instead of true it can also be a list of languages
|
||||
additional_vim_regex_highlighting = false,
|
||||
},
|
||||
-- Setting this to true will run `:h syntax` and tree-sitter at the same time.
|
||||
-- Set this to `true` if you depend on 'syntax' being enabled (like for indentation).
|
||||
-- Using this option may slow down your editor, and you may see some duplicate highlights.
|
||||
-- Instead of true it can also be a list of languages
|
||||
additional_vim_regex_highlighting = false,
|
||||
},
|
||||
}
|
||||
|
||||
@ -1,20 +1,26 @@
|
||||
-- 部分补全代码不支持autoformat 需使用efm自动补全
|
||||
-- https://github.com/mattn/efm-langserver
|
||||
return {
|
||||
init_options = { documentFormatting = true },
|
||||
filetypes = { 'python', 'json' },
|
||||
settings = {
|
||||
rootMarkers = { ".git/" },
|
||||
languages = {
|
||||
python = {
|
||||
-- pip install yapf
|
||||
{ formatCommand = "yapf --quiet", formatStdin = true }
|
||||
},
|
||||
json = {
|
||||
-- yarn global add fixjson
|
||||
{ formatCommand = "fixjson", formatStdin = true }
|
||||
init_options = { documentFormatting = true },
|
||||
filetypes = { 'python', 'json', 'css' },
|
||||
settings = {
|
||||
rootMarkers = { ".git/" },
|
||||
languages = {
|
||||
python = {
|
||||
-- pip install yapf
|
||||
{ formatCommand = "yapf --quiet", formatStdin = true }
|
||||
},
|
||||
json = {
|
||||
-- yarn global add fixjson
|
||||
{ formatCommand = "fixjson", formatStdin = true }
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
css = {
|
||||
-- yarn global add prettier
|
||||
{ formatCommand = "prettier --tab-width=4 ${--single-quote:singleQuote} --parser css", formatStdin = true }
|
||||
-- { formatCommand = "prettier ${--tab-width:tabWidth} ${--single-quote:singleQuote} --parser css", formatStdin = true }
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,13 +1,14 @@
|
||||
local eslint_config = require("lspconfig.server_configurations.eslint")
|
||||
|
||||
return {
|
||||
on_attach = function(client, bufnr)
|
||||
-- neovim's LSP client does not currently support dynamic capabilities registration, so we need to set
|
||||
-- the resolved capabilities of the eslint server ourselves!
|
||||
client.resolved_capabilities.document_formatting = true
|
||||
end,
|
||||
settings = {
|
||||
format = { enable = true },
|
||||
},
|
||||
cmd = { "yarn", "exec", unpack(eslint_config.default_config.cmd) }
|
||||
on_attach = function(client, bufnr)
|
||||
-- neovim's LSP client does not currently support dynamic capabilities registration, so we need to set
|
||||
-- the resolved capabilities of the eslint server ourselves!
|
||||
client.resolved_capabilities.document_formatting = true
|
||||
end,
|
||||
settings = {
|
||||
format = { enable = true },
|
||||
},
|
||||
print(unpack(eslint_config.default_config.cmd)),
|
||||
cmd = { "yarn", "exec", unpack(eslint_config.default_config.cmd) }
|
||||
}
|
||||
|
||||
@ -10,9 +10,12 @@ local keyOpts = { noremap = true, silent = true }
|
||||
vim.api.nvim_set_keymap('n', '<C-]>', '<cmd>lua vim.lsp.buf.definition()<CR>', keyOpts)
|
||||
vim.api.nvim_set_keymap('n', '<space>f', '<cmd>lua vim.lsp.buf.formatting()<CR>', keyOpts)
|
||||
vim.api.nvim_set_keymap('n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<CR>', keyOpts)
|
||||
vim.api.nvim_set_keymap('n', 'e[', '<cmd>lua vim.diagnostic.goto_prev()<CR>',keyOpts)
|
||||
vim.api.nvim_set_keymap('n', 'e[', '<cmd>lua vim.diagnostic.goto_prev()<CR>', keyOpts)
|
||||
vim.api.nvim_set_keymap('n', 'e]', '<cmd>lua vim.diagnostic.goto_next()<CR>', keyOpts)
|
||||
|
||||
-- vim.cmd [[autocmd BufWritePre <buffer> lua vim.lsp.buf.formatting_seq_sync()]]
|
||||
|
||||
|
||||
|
||||
|
||||
-- 安装列表
|
||||
@ -20,38 +23,38 @@ vim.api.nvim_set_keymap('n', 'e]', '<cmd>lua vim.diagnostic.goto_next()<CR>', ke
|
||||
-- { key: 语言 value: 配置文件 }
|
||||
-- pyright 不支持autoformat
|
||||
local servers = {
|
||||
sumneko_lua = require "lsp.lua", -- /lua/lsp/lua.lua
|
||||
gopls = require "lsp.base",
|
||||
volar = require "lsp.base",
|
||||
basels = require "lsp.base",
|
||||
cssls = require "lsp.base",
|
||||
eslint = require "lsp.eslint",
|
||||
tsserver = require "lsp.base",
|
||||
prosemd_lsp = require "lsp.base",
|
||||
pyright = require "lsp.base",
|
||||
rust_analyzer = require "lsp.base",
|
||||
tailwindcss = require "lsp.base",
|
||||
efm = require "lsp.efm"
|
||||
sumneko_lua = require "lsp.lua", -- /lua/lsp/lua.lua
|
||||
gopls = require "lsp.base",
|
||||
volar = require "lsp.base",
|
||||
basels = require "lsp.base",
|
||||
cssls = require "lsp.base",
|
||||
-- eslint = require "lsp.eslint",
|
||||
tsserver = require "lsp.base",
|
||||
prosemd_lsp = require "lsp.base",
|
||||
pyright = require "lsp.base",
|
||||
rust_analyzer = require "lsp.base",
|
||||
tailwindcss = require "lsp.base",
|
||||
efm = require "lsp.efm"
|
||||
}
|
||||
|
||||
-- 自动安装 LanguageServers
|
||||
for name, _ in pairs(servers) do
|
||||
local server_is_found, server = lsp_installer.get_server(name)
|
||||
if server_is_found then
|
||||
if not server:is_installed() then
|
||||
print("Installing " .. name)
|
||||
server:install()
|
||||
end
|
||||
end
|
||||
local server_is_found, server = lsp_installer.get_server(name)
|
||||
if server_is_found then
|
||||
if not server:is_installed() then
|
||||
print("Installing " .. name)
|
||||
server:install()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
lsp_installer.on_server_ready(function(server)
|
||||
local opts = servers[server.name]
|
||||
opts.capabilities = capabilities
|
||||
opts.flags = {
|
||||
debounce_text_changes = 150,
|
||||
}
|
||||
server:setup(opts)
|
||||
local opts = servers[server.name]
|
||||
opts.capabilities = capabilities
|
||||
opts.flags = {
|
||||
debounce_text_changes = 150,
|
||||
}
|
||||
server:setup(opts)
|
||||
end)
|
||||
|
||||
-- luasnip setup
|
||||
@ -65,42 +68,42 @@ local cmp = require 'cmp'
|
||||
cmp.event:on('confirm_done', cmp_autopairs.on_confirm_done({ map_char = { tex = '' } }))
|
||||
|
||||
cmp.setup {
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
luasnip.lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
['<C-d>'] = cmp.mapping.scroll_docs(-4),
|
||||
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
||||
['<C-Space>'] = cmp.mapping.complete(),
|
||||
['<CR>'] = cmp.mapping.confirm {
|
||||
behavior = cmp.ConfirmBehavior.Replace,
|
||||
select = true,
|
||||
},
|
||||
['<Tab>'] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
elseif luasnip.expand_or_jumpable() then
|
||||
luasnip.expand_or_jump()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { 'i', 's' }),
|
||||
['<S-Tab>'] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
elseif luasnip.jumpable(-1) then
|
||||
luasnip.jump(-1)
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { 'i', 's' }),
|
||||
}),
|
||||
sources = {
|
||||
{ name = 'nvim_lsp' },
|
||||
{ name = 'luasnip' },
|
||||
{ name = 'buffer' },
|
||||
{ name = 'path' }
|
||||
},
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
luasnip.lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
['<C-d>'] = cmp.mapping.scroll_docs(-4),
|
||||
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
||||
['<C-Space>'] = cmp.mapping.complete(),
|
||||
['<CR>'] = cmp.mapping.confirm {
|
||||
behavior = cmp.ConfirmBehavior.Replace,
|
||||
select = true,
|
||||
},
|
||||
['<Tab>'] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
elseif luasnip.expand_or_jumpable() then
|
||||
luasnip.expand_or_jump()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { 'i', 's' }),
|
||||
['<S-Tab>'] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
elseif luasnip.jumpable(-1) then
|
||||
luasnip.jump(-1)
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { 'i', 's' }),
|
||||
}),
|
||||
sources = {
|
||||
{ name = 'nvim_lsp' },
|
||||
{ name = 'luasnip' },
|
||||
{ name = 'buffer' },
|
||||
{ name = 'path' }
|
||||
},
|
||||
}
|
||||
|
||||
@ -4,55 +4,60 @@
|
||||
vim.cmd [[packadd packer.nvim]]
|
||||
|
||||
return require('packer').startup(function()
|
||||
-- Packer can manage itself
|
||||
use 'wbthomason/packer.nvim'
|
||||
-- Packer can manage itself
|
||||
use 'wbthomason/packer.nvim'
|
||||
|
||||
-- LSP
|
||||
-- LSP
|
||||
|
||||
use { 'neovim/nvim-lspconfig', 'williamboman/nvim-lsp-installer' }
|
||||
use { 'neovim/nvim-lspconfig', 'williamboman/nvim-lsp-installer' }
|
||||
|
||||
use 'windwp/nvim-autopairs'
|
||||
use 'windwp/nvim-autopairs'
|
||||
|
||||
use 'windwp/nvim-ts-autotag'
|
||||
use 'windwp/nvim-ts-autotag'
|
||||
|
||||
use 'hrsh7th/nvim-cmp'
|
||||
use 'hrsh7th/cmp-path'
|
||||
use 'hrsh7th/cmp-buffer'
|
||||
use 'hrsh7th/cmp-nvim-lsp'
|
||||
use 'saadparwaiz1/cmp_luasnip'
|
||||
use 'L3MON4D3/LuaSnip'
|
||||
use 'hrsh7th/nvim-cmp'
|
||||
use 'hrsh7th/cmp-path'
|
||||
use 'hrsh7th/cmp-buffer'
|
||||
use 'hrsh7th/cmp-nvim-lsp'
|
||||
use 'saadparwaiz1/cmp_luasnip'
|
||||
use 'L3MON4D3/LuaSnip'
|
||||
|
||||
|
||||
-- Frame
|
||||
-- Frame
|
||||
|
||||
use { "ellisonleao/gruvbox.nvim" }
|
||||
-- need to install nerd font
|
||||
use 'kyazdani42/nvim-web-devicons'
|
||||
use 'kyazdani42/nvim-tree.lua'
|
||||
use 'akinsho/bufferline.nvim'
|
||||
use 'nvim-lualine/lualine.nvim'
|
||||
use { "ellisonleao/gruvbox.nvim" }
|
||||
-- need to install nerd font
|
||||
use 'kyazdani42/nvim-web-devicons'
|
||||
use 'kyazdani42/nvim-tree.lua'
|
||||
use 'akinsho/bufferline.nvim'
|
||||
use 'nvim-lualine/lualine.nvim'
|
||||
use 'f-person/git-blame.nvim'
|
||||
|
||||
use {
|
||||
'nvim-treesitter/nvim-treesitter',
|
||||
run = ':TSUpdate'
|
||||
}
|
||||
use {
|
||||
'nvim-treesitter/nvim-treesitter',
|
||||
run = ':TSUpdate'
|
||||
}
|
||||
|
||||
|
||||
-- utils
|
||||
use 'numToStr/Comment.nvim'
|
||||
use {
|
||||
'nvim-telescope/telescope.nvim',
|
||||
requires = { { 'nvim-lua/plenary.nvim' } }
|
||||
}
|
||||
-- utils
|
||||
use 'numToStr/Comment.nvim'
|
||||
use {
|
||||
'nvim-telescope/telescope.nvim',
|
||||
requires = { { 'nvim-lua/plenary.nvim' } }
|
||||
}
|
||||
|
||||
use { "akinsho/toggleterm.nvim" }
|
||||
use { "akinsho/toggleterm.nvim" }
|
||||
|
||||
|
||||
use "Pocco81/AutoSave.nvim"
|
||||
use "Pocco81/AutoSave.nvim"
|
||||
|
||||
use 'lewis6991/gitsigns.nvim'
|
||||
use 'lewis6991/gitsigns.nvim'
|
||||
|
||||
use 'ybian/smartim'
|
||||
use 'ybian/smartim'
|
||||
|
||||
use 'aperezdc/vim-template'
|
||||
use 'aperezdc/vim-template'
|
||||
|
||||
use "lukas-reineke/indent-blankline.nvim"
|
||||
|
||||
use "norcalli/nvim-colorizer.lua"
|
||||
end)
|
||||
|
||||
@ -4,30 +4,37 @@ require('nvim-autopairs').setup()
|
||||
|
||||
|
||||
require("toggleterm").setup {
|
||||
open_mapping = [[<C-\>]],
|
||||
hide_numbers = true,
|
||||
insert_mappings = true, -- whether or not the open mapping applies in insert mode
|
||||
terminal_mappings = true,
|
||||
shell = vim.o.shell,
|
||||
open_mapping = [[<C-\>]],
|
||||
hide_numbers = true,
|
||||
insert_mappings = true, -- whether or not the open mapping applies in insert mode
|
||||
terminal_mappings = true,
|
||||
shell = vim.o.shell,
|
||||
}
|
||||
|
||||
require("autosave").setup {
|
||||
enabled = true,
|
||||
execution_message = "AutoSave: saved at " .. vim.fn.strftime("%H:%M:%S"),
|
||||
events = { "BufLeave", "FocusLost" },
|
||||
conditions = {
|
||||
exists = true,
|
||||
filename_is_not = {},
|
||||
filetype_is_not = {},
|
||||
modifiable = true
|
||||
},
|
||||
write_all_buffers = true,
|
||||
on_off_commands = true,
|
||||
clean_command_line_interval = 0,
|
||||
debounce_delay = 135
|
||||
enabled = true,
|
||||
execution_message = "AutoSave: saved at " .. vim.fn.strftime("%H:%M:%S"),
|
||||
events = { "BufLeave", "FocusLost" },
|
||||
conditions = {
|
||||
exists = true,
|
||||
filename_is_not = {},
|
||||
filetype_is_not = {},
|
||||
modifiable = true
|
||||
},
|
||||
write_all_buffers = true,
|
||||
on_off_commands = true,
|
||||
clean_command_line_interval = 0,
|
||||
debounce_delay = 135
|
||||
}
|
||||
|
||||
require('gitsigns').setup {
|
||||
|
||||
}
|
||||
|
||||
require("indent_blankline").setup {
|
||||
-- for example, context is off by default, use this to turn it on
|
||||
show_current_context = true,
|
||||
show_current_context_start = true,
|
||||
}
|
||||
|
||||
require 'colorizer'.setup()
|
||||
|
||||
6
plug.vim
6
plug.vim
@ -1,6 +1,10 @@
|
||||
|
||||
let g:templates_directory = '~/.config/nvim/templates/'
|
||||
|
||||
let g:smartim_default = 'com.apple.keylayout.ABC'
|
||||
let g:smartim_disable = 0
|
||||
|
||||
autocmd BufWritePre <buffer> lua vim.lsp.buf.formatting_sync()
|
||||
" autocmd BufWritePre <buffer> lua vim.lsp.buf.formatting_sync()
|
||||
autocmd BufWritePre * lua vim.lsp.buf.formatting_sync()
|
||||
|
||||
|
||||
|
||||
222
plugin/packer_compiled.lua
Normal file
222
plugin/packer_compiled.lua
Normal file
@ -0,0 +1,222 @@
|
||||
-- Automatically generated packer.nvim plugin loader code
|
||||
|
||||
if vim.api.nvim_call_function('has', {'nvim-0.5'}) ~= 1 then
|
||||
vim.api.nvim_command('echohl WarningMsg | echom "Invalid Neovim version for packer.nvim! | echohl None"')
|
||||
return
|
||||
end
|
||||
|
||||
vim.api.nvim_command('packadd packer.nvim')
|
||||
|
||||
local no_errors, error_msg = pcall(function()
|
||||
|
||||
local time
|
||||
local profile_info
|
||||
local should_profile = false
|
||||
if should_profile then
|
||||
local hrtime = vim.loop.hrtime
|
||||
profile_info = {}
|
||||
time = function(chunk, start)
|
||||
if start then
|
||||
profile_info[chunk] = hrtime()
|
||||
else
|
||||
profile_info[chunk] = (hrtime() - profile_info[chunk]) / 1e6
|
||||
end
|
||||
end
|
||||
else
|
||||
time = function(chunk, start) end
|
||||
end
|
||||
|
||||
local function save_profiles(threshold)
|
||||
local sorted_times = {}
|
||||
for chunk_name, time_taken in pairs(profile_info) do
|
||||
sorted_times[#sorted_times + 1] = {chunk_name, time_taken}
|
||||
end
|
||||
table.sort(sorted_times, function(a, b) return a[2] > b[2] end)
|
||||
local results = {}
|
||||
for i, elem in ipairs(sorted_times) do
|
||||
if not threshold or threshold and elem[2] > threshold then
|
||||
results[i] = elem[1] .. ' took ' .. elem[2] .. 'ms'
|
||||
end
|
||||
end
|
||||
|
||||
_G._packer = _G._packer or {}
|
||||
_G._packer.profile_output = results
|
||||
end
|
||||
|
||||
time([[Luarocks path setup]], true)
|
||||
local package_path_str = "/Users/light/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?.lua;/Users/light/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?/init.lua;/Users/light/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?.lua;/Users/light/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?/init.lua"
|
||||
local install_cpath_pattern = "/Users/light/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/lua/5.1/?.so"
|
||||
if not string.find(package.path, package_path_str, 1, true) then
|
||||
package.path = package.path .. ';' .. package_path_str
|
||||
end
|
||||
|
||||
if not string.find(package.cpath, install_cpath_pattern, 1, true) then
|
||||
package.cpath = package.cpath .. ';' .. install_cpath_pattern
|
||||
end
|
||||
|
||||
time([[Luarocks path setup]], false)
|
||||
time([[try_loadstring definition]], true)
|
||||
local function try_loadstring(s, component, name)
|
||||
local success, result = pcall(loadstring(s), name, _G.packer_plugins[name])
|
||||
if not success then
|
||||
vim.schedule(function()
|
||||
vim.api.nvim_notify('packer.nvim: Error running ' .. component .. ' for ' .. name .. ': ' .. result, vim.log.levels.ERROR, {})
|
||||
end)
|
||||
end
|
||||
return result
|
||||
end
|
||||
|
||||
time([[try_loadstring definition]], false)
|
||||
time([[Defining packer_plugins]], true)
|
||||
_G.packer_plugins = {
|
||||
["AutoSave.nvim"] = {
|
||||
loaded = true,
|
||||
path = "/Users/light/.local/share/nvim/site/pack/packer/start/AutoSave.nvim",
|
||||
url = "https://github.com/Pocco81/AutoSave.nvim"
|
||||
},
|
||||
["Comment.nvim"] = {
|
||||
loaded = true,
|
||||
path = "/Users/light/.local/share/nvim/site/pack/packer/start/Comment.nvim",
|
||||
url = "https://github.com/numToStr/Comment.nvim"
|
||||
},
|
||||
LuaSnip = {
|
||||
loaded = true,
|
||||
path = "/Users/light/.local/share/nvim/site/pack/packer/start/LuaSnip",
|
||||
url = "https://github.com/L3MON4D3/LuaSnip"
|
||||
},
|
||||
["bufferline.nvim"] = {
|
||||
loaded = true,
|
||||
path = "/Users/light/.local/share/nvim/site/pack/packer/start/bufferline.nvim",
|
||||
url = "https://github.com/akinsho/bufferline.nvim"
|
||||
},
|
||||
["cmp-buffer"] = {
|
||||
loaded = true,
|
||||
path = "/Users/light/.local/share/nvim/site/pack/packer/start/cmp-buffer",
|
||||
url = "https://github.com/hrsh7th/cmp-buffer"
|
||||
},
|
||||
["cmp-nvim-lsp"] = {
|
||||
loaded = true,
|
||||
path = "/Users/light/.local/share/nvim/site/pack/packer/start/cmp-nvim-lsp",
|
||||
url = "https://github.com/hrsh7th/cmp-nvim-lsp"
|
||||
},
|
||||
["cmp-path"] = {
|
||||
loaded = true,
|
||||
path = "/Users/light/.local/share/nvim/site/pack/packer/start/cmp-path",
|
||||
url = "https://github.com/hrsh7th/cmp-path"
|
||||
},
|
||||
cmp_luasnip = {
|
||||
loaded = true,
|
||||
path = "/Users/light/.local/share/nvim/site/pack/packer/start/cmp_luasnip",
|
||||
url = "https://github.com/saadparwaiz1/cmp_luasnip"
|
||||
},
|
||||
["git-blame.nvim"] = {
|
||||
loaded = true,
|
||||
path = "/Users/light/.local/share/nvim/site/pack/packer/start/git-blame.nvim",
|
||||
url = "https://github.com/f-person/git-blame.nvim"
|
||||
},
|
||||
["gitsigns.nvim"] = {
|
||||
loaded = true,
|
||||
path = "/Users/light/.local/share/nvim/site/pack/packer/start/gitsigns.nvim",
|
||||
url = "https://github.com/lewis6991/gitsigns.nvim"
|
||||
},
|
||||
["gruvbox.nvim"] = {
|
||||
loaded = true,
|
||||
path = "/Users/light/.local/share/nvim/site/pack/packer/start/gruvbox.nvim",
|
||||
url = "https://github.com/ellisonleao/gruvbox.nvim"
|
||||
},
|
||||
["indent-blankline.nvim"] = {
|
||||
loaded = true,
|
||||
path = "/Users/light/.local/share/nvim/site/pack/packer/start/indent-blankline.nvim",
|
||||
url = "https://github.com/lukas-reineke/indent-blankline.nvim"
|
||||
},
|
||||
["lualine.nvim"] = {
|
||||
loaded = true,
|
||||
path = "/Users/light/.local/share/nvim/site/pack/packer/start/lualine.nvim",
|
||||
url = "https://github.com/nvim-lualine/lualine.nvim"
|
||||
},
|
||||
["nvim-autopairs"] = {
|
||||
loaded = true,
|
||||
path = "/Users/light/.local/share/nvim/site/pack/packer/start/nvim-autopairs",
|
||||
url = "https://github.com/windwp/nvim-autopairs"
|
||||
},
|
||||
["nvim-cmp"] = {
|
||||
loaded = true,
|
||||
path = "/Users/light/.local/share/nvim/site/pack/packer/start/nvim-cmp",
|
||||
url = "https://github.com/hrsh7th/nvim-cmp"
|
||||
},
|
||||
["nvim-colorizer.lua"] = {
|
||||
loaded = true,
|
||||
path = "/Users/light/.local/share/nvim/site/pack/packer/start/nvim-colorizer.lua",
|
||||
url = "https://github.com/norcalli/nvim-colorizer.lua"
|
||||
},
|
||||
["nvim-lsp-installer"] = {
|
||||
loaded = true,
|
||||
path = "/Users/light/.local/share/nvim/site/pack/packer/start/nvim-lsp-installer",
|
||||
url = "https://github.com/williamboman/nvim-lsp-installer"
|
||||
},
|
||||
["nvim-lspconfig"] = {
|
||||
loaded = true,
|
||||
path = "/Users/light/.local/share/nvim/site/pack/packer/start/nvim-lspconfig",
|
||||
url = "https://github.com/neovim/nvim-lspconfig"
|
||||
},
|
||||
["nvim-tree.lua"] = {
|
||||
loaded = true,
|
||||
path = "/Users/light/.local/share/nvim/site/pack/packer/start/nvim-tree.lua",
|
||||
url = "https://github.com/kyazdani42/nvim-tree.lua"
|
||||
},
|
||||
["nvim-treesitter"] = {
|
||||
loaded = true,
|
||||
path = "/Users/light/.local/share/nvim/site/pack/packer/start/nvim-treesitter",
|
||||
url = "https://github.com/nvim-treesitter/nvim-treesitter"
|
||||
},
|
||||
["nvim-ts-autotag"] = {
|
||||
loaded = true,
|
||||
path = "/Users/light/.local/share/nvim/site/pack/packer/start/nvim-ts-autotag",
|
||||
url = "https://github.com/windwp/nvim-ts-autotag"
|
||||
},
|
||||
["nvim-web-devicons"] = {
|
||||
loaded = true,
|
||||
path = "/Users/light/.local/share/nvim/site/pack/packer/start/nvim-web-devicons",
|
||||
url = "https://github.com/kyazdani42/nvim-web-devicons"
|
||||
},
|
||||
["packer.nvim"] = {
|
||||
loaded = true,
|
||||
path = "/Users/light/.local/share/nvim/site/pack/packer/start/packer.nvim",
|
||||
url = "https://github.com/wbthomason/packer.nvim"
|
||||
},
|
||||
["plenary.nvim"] = {
|
||||
loaded = true,
|
||||
path = "/Users/light/.local/share/nvim/site/pack/packer/start/plenary.nvim",
|
||||
url = "https://github.com/nvim-lua/plenary.nvim"
|
||||
},
|
||||
smartim = {
|
||||
loaded = true,
|
||||
path = "/Users/light/.local/share/nvim/site/pack/packer/start/smartim",
|
||||
url = "https://github.com/ybian/smartim"
|
||||
},
|
||||
["telescope.nvim"] = {
|
||||
loaded = true,
|
||||
path = "/Users/light/.local/share/nvim/site/pack/packer/start/telescope.nvim",
|
||||
url = "https://github.com/nvim-telescope/telescope.nvim"
|
||||
},
|
||||
["toggleterm.nvim"] = {
|
||||
loaded = true,
|
||||
path = "/Users/light/.local/share/nvim/site/pack/packer/start/toggleterm.nvim",
|
||||
url = "https://github.com/akinsho/toggleterm.nvim"
|
||||
},
|
||||
["vim-template"] = {
|
||||
loaded = true,
|
||||
path = "/Users/light/.local/share/nvim/site/pack/packer/start/vim-template",
|
||||
url = "https://github.com/aperezdc/vim-template"
|
||||
}
|
||||
}
|
||||
|
||||
time([[Defining packer_plugins]], false)
|
||||
if should_profile then save_profiles() end
|
||||
|
||||
end)
|
||||
|
||||
if not no_errors then
|
||||
error_msg = error_msg:gsub('"', '\\"')
|
||||
vim.api.nvim_command('echohl ErrorMsg | echom "Error in packer_compiled: '..error_msg..'" | echom "Please check your config for correctness" | echohl None')
|
||||
end
|
||||
10
templates/=template=.go
Normal file
10
templates/=template=.go
Normal file
@ -0,0 +1,10 @@
|
||||
//
|
||||
// %FFILE%
|
||||
// Copyright (C) %YEAR% %USER% <%MAIL%>
|
||||
// %FDATE%
|
||||
// Distributed under terms of the %LICENSE% license.
|
||||
//
|
||||
|
||||
package main
|
||||
|
||||
%HERE%
|
||||
8
templates/=template=.ts
Normal file
8
templates/=template=.ts
Normal file
@ -0,0 +1,8 @@
|
||||
/*
|
||||
* %FFILE%
|
||||
* Copyright (C) %YEAR% %USER% <%MAIL%>
|
||||
* %FDATE%
|
||||
* Distributed under terms of the %LICENSE% license.
|
||||
*/
|
||||
|
||||
%HERE%
|
||||
16
templates/=template=.vue
Normal file
16
templates/=template=.vue
Normal file
@ -0,0 +1,16 @@
|
||||
<!--
|
||||
* %FFILE%
|
||||
* Copyright (C) %YEAR% %USER% <%MAIL%>
|
||||
* %FDATE%
|
||||
* Distributed under terms of the %LICENSE% license.
|
||||
-->
|
||||
<template>
|
||||
<div>%HERE%</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
</style>
|
||||
|
||||
17
vimrc.vim
17
vimrc.vim
@ -27,8 +27,21 @@ set signcolumn=yes:1
|
||||
" 在文件外修改时自动加载
|
||||
set autoread
|
||||
|
||||
"自动保存
|
||||
set autowrite
|
||||
set expandtab
|
||||
set smartindent
|
||||
|
||||
" 自动按照缩进进行代码折叠
|
||||
set foldmethod=indent
|
||||
set foldnestmax=10 "deepest fold is 10 levels
|
||||
set nofoldenable "dont fold by default
|
||||
set foldlevel=1
|
||||
|
||||
|
||||
" 启用预览被折叠的代码
|
||||
let g:SimpylFold_docstring_preview = 1
|
||||
|
||||
" 搜索大小写不敏感
|
||||
set ignorecase smartcase
|
||||
|
||||
" 显示按下的按键
|
||||
set showcmd
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user