update to nvim 0.9
This commit is contained in:
parent
1349868048
commit
e53c7aa336
@ -1,65 +1,25 @@
|
|||||||
local tree_cb = require 'nvim-tree.config'.nvim_tree_callback -- following options are the default
|
|
||||||
|
|
||||||
-- r rename
|
-- r rename
|
||||||
-- d delete
|
-- d delete
|
||||||
-- s open item in system tool
|
-- s open item in system tool
|
||||||
-- a add file/dir
|
-- a add file/dir
|
||||||
require 'nvim-tree'.setup {
|
require 'nvim-tree'.setup {
|
||||||
open_on_setup = true;
|
sort_by = "case_sensitive",
|
||||||
open_on_setup_file = false,
|
renderer = {
|
||||||
git = {
|
group_empty = true,
|
||||||
enable = true,
|
|
||||||
ignore = true,
|
|
||||||
timeout = 400,
|
|
||||||
},
|
},
|
||||||
filters = {
|
filters = {
|
||||||
dotfiles = true,
|
dotfiles = true,
|
||||||
custom = {},
|
custom = {},
|
||||||
exclude = {},
|
exclude = {},
|
||||||
},
|
},
|
||||||
system_open = {
|
git = {
|
||||||
cmd = nil,
|
enable = true,
|
||||||
args = {},
|
ignore = true,
|
||||||
|
timeout = 400,
|
||||||
},
|
},
|
||||||
view = {
|
view = {
|
||||||
width = 24,
|
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 = "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") },
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -11,12 +11,12 @@ require("mason").setup({
|
|||||||
-- https://github.com/williamboman/mason-lspconfig.nvim
|
-- https://github.com/williamboman/mason-lspconfig.nvim
|
||||||
require("mason-lspconfig").setup {
|
require("mason-lspconfig").setup {
|
||||||
ensure_installed = { "rust_analyzer", "gopls", "volar", "cssls", "yamlls", "zk", "tsserver", "pyright",
|
ensure_installed = { "rust_analyzer", "gopls", "volar", "cssls", "yamlls", "zk", "tsserver", "pyright",
|
||||||
"tailwindcss", "sqls", "efm", "html", "prettierd" },
|
"tailwindcss", "sqlls", "efm", "html" },
|
||||||
}
|
}
|
||||||
|
|
||||||
local lspconfig = require('lspconfig')
|
local lspconfig = require('lspconfig')
|
||||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||||
capabilities = require('cmp_nvim_lsp').update_capabilities(capabilities)
|
capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities)
|
||||||
|
|
||||||
-- 需特别配置的lsp插件
|
-- 需特别配置的lsp插件
|
||||||
-- { key: 语言 value: 配置文件 }
|
-- { key: 语言 value: 配置文件 }
|
||||||
@ -24,7 +24,7 @@ capabilities = require('cmp_nvim_lsp').update_capabilities(capabilities)
|
|||||||
local servers = {
|
local servers = {
|
||||||
sumneko_lua = require "lsp.lua", -- /lua/lsp/lua.lua
|
sumneko_lua = require "lsp.lua", -- /lua/lsp/lua.lua
|
||||||
tailwindcss = require "lsp.tailwind",
|
tailwindcss = require "lsp.tailwind",
|
||||||
sqls = require "lsp.sql",
|
sqlls = require "lsp.sqlls",
|
||||||
efm = require "lsp.efm",
|
efm = require "lsp.efm",
|
||||||
volar = require "lsp.volar"
|
volar = require "lsp.volar"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
settings = {
|
settings = {
|
||||||
sqls = {
|
sqlls = {
|
||||||
connections = {
|
connections = {
|
||||||
{
|
{
|
||||||
driver = 'mysql',
|
driver = 'mysql',
|
||||||
@ -20,7 +20,6 @@ return {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
on_attach = function(client)
|
on_attach = function(client)
|
||||||
-- sqls there seem a bug when format file
|
|
||||||
client.resolved_capabilities.document_formatting = false
|
client.resolved_capabilities.document_formatting = false
|
||||||
client.resolved_capabilities.document_range_formatting = false
|
client.resolved_capabilities.document_range_formatting = false
|
||||||
client.server_capabilities.documentFormattingProvider = false
|
client.server_capabilities.documentFormattingProvider = false
|
||||||
@ -76,7 +76,7 @@ return require('packer').startup(function()
|
|||||||
use { "akinsho/toggleterm.nvim" }
|
use { "akinsho/toggleterm.nvim" }
|
||||||
|
|
||||||
-- 自动保存
|
-- 自动保存
|
||||||
use "Pocco81/AutoSave.nvim"
|
-- use "Pocco81/AutoSave.nvim"
|
||||||
|
|
||||||
-- git状态
|
-- git状态
|
||||||
use 'lewis6991/gitsigns.nvim'
|
use 'lewis6991/gitsigns.nvim'
|
||||||
|
|||||||
@ -11,21 +11,21 @@ require("toggleterm").setup {
|
|||||||
shell = vim.o.shell,
|
shell = vim.o.shell,
|
||||||
}
|
}
|
||||||
|
|
||||||
require("autosave").setup {
|
-- require("autosave").setup {
|
||||||
enabled = true,
|
-- enabled = true,
|
||||||
execution_message = "AutoSave: saved at " .. vim.fn.strftime("%H:%M:%S"),
|
-- execution_message = "AutoSave: saved at " .. vim.fn.strftime("%H:%M:%S"),
|
||||||
events = { "BufLeave", "FocusLost" },
|
-- events = { "BufLeave", "FocusLost" },
|
||||||
conditions = {
|
-- conditions = {
|
||||||
exists = true,
|
-- exists = true,
|
||||||
filename_is_not = {},
|
-- filename_is_not = {},
|
||||||
filetype_is_not = {},
|
-- filetype_is_not = {},
|
||||||
modifiable = true
|
-- modifiable = true
|
||||||
},
|
-- },
|
||||||
write_all_buffers = true,
|
-- write_all_buffers = true,
|
||||||
on_off_commands = true,
|
-- on_off_commands = true,
|
||||||
clean_command_line_interval = 0,
|
-- clean_command_line_interval = 0,
|
||||||
debounce_delay = 135
|
-- debounce_delay = 135
|
||||||
}
|
-- }
|
||||||
|
|
||||||
require('gitsigns').setup {
|
require('gitsigns').setup {
|
||||||
|
|
||||||
|
|||||||
12
plug.vim
12
plug.vim
@ -8,7 +8,11 @@ let g:license = 'Apache'
|
|||||||
|
|
||||||
|
|
||||||
" 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()
|
augroup FormatAutogroup
|
||||||
|
autocmd!
|
||||||
|
" autocmd BufWritePost * FormatWrite
|
||||||
|
augroup END
|
||||||
|
" autocmd BufWritePre * lua vim.lsp.buf.formatting_sync()
|
||||||
|
|
||||||
filetype plugin indent on
|
filetype plugin indent on
|
||||||
|
|
||||||
@ -54,3 +58,9 @@ let g:vimtex_compiler_latexmk = {
|
|||||||
" let maplocalleader = ","
|
" let maplocalleader = ","
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
" copilot config
|
||||||
|
imap <silent><script><expr> <C-J> copilot#Accept("\<CR>")
|
||||||
|
let g:copilot_no_tab_map = v:true
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -9,22 +9,25 @@ vim.api.nvim_command('packadd packer.nvim')
|
|||||||
|
|
||||||
local no_errors, error_msg = pcall(function()
|
local no_errors, error_msg = pcall(function()
|
||||||
|
|
||||||
local time
|
_G._packer = _G._packer or {}
|
||||||
local profile_info
|
_G._packer.inside_compile = true
|
||||||
local should_profile = false
|
|
||||||
if should_profile then
|
local time
|
||||||
local hrtime = vim.loop.hrtime
|
local profile_info
|
||||||
profile_info = {}
|
local should_profile = false
|
||||||
time = function(chunk, start)
|
if should_profile then
|
||||||
if start then
|
local hrtime = vim.loop.hrtime
|
||||||
profile_info[chunk] = hrtime()
|
profile_info = {}
|
||||||
else
|
time = function(chunk, start)
|
||||||
profile_info[chunk] = (hrtime() - profile_info[chunk]) / 1e6
|
if start then
|
||||||
end
|
profile_info[chunk] = hrtime()
|
||||||
|
else
|
||||||
|
profile_info[chunk] = (hrtime() - profile_info[chunk]) / 1e6
|
||||||
end
|
end
|
||||||
else
|
|
||||||
time = function(chunk, start) end
|
|
||||||
end
|
end
|
||||||
|
else
|
||||||
|
time = function(chunk, start) end
|
||||||
|
end
|
||||||
|
|
||||||
local function save_profiles(threshold)
|
local function save_profiles(threshold)
|
||||||
local sorted_times = {}
|
local sorted_times = {}
|
||||||
@ -38,8 +41,10 @@ local function save_profiles(threshold)
|
|||||||
results[i] = elem[1] .. ' took ' .. elem[2] .. 'ms'
|
results[i] = elem[1] .. ' took ' .. elem[2] .. 'ms'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
if threshold then
|
||||||
|
table.insert(results, '(Only showing plugins that took longer than ' .. threshold .. ' ms ' .. 'to load)')
|
||||||
|
end
|
||||||
|
|
||||||
_G._packer = _G._packer or {}
|
|
||||||
_G._packer.profile_output = results
|
_G._packer.profile_output = results
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -69,11 +74,6 @@ end
|
|||||||
time([[try_loadstring definition]], false)
|
time([[try_loadstring definition]], false)
|
||||||
time([[Defining packer_plugins]], true)
|
time([[Defining packer_plugins]], true)
|
||||||
_G.packer_plugins = {
|
_G.packer_plugins = {
|
||||||
["AutoSave.nvim"] = {
|
|
||||||
loaded = true,
|
|
||||||
path = "/Users/veypi/.local/share/nvim/site/pack/packer/start/AutoSave.nvim",
|
|
||||||
url = "https://github.com/Pocco81/AutoSave.nvim"
|
|
||||||
},
|
|
||||||
["Comment.nvim"] = {
|
["Comment.nvim"] = {
|
||||||
loaded = true,
|
loaded = true,
|
||||||
path = "/Users/veypi/.local/share/nvim/site/pack/packer/start/Comment.nvim",
|
path = "/Users/veypi/.local/share/nvim/site/pack/packer/start/Comment.nvim",
|
||||||
@ -232,6 +232,13 @@ _G.packer_plugins = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
time([[Defining packer_plugins]], false)
|
time([[Defining packer_plugins]], false)
|
||||||
|
|
||||||
|
_G._packer.inside_compile = false
|
||||||
|
if _G._packer.needs_bufread == true then
|
||||||
|
vim.cmd("doautocmd BufRead")
|
||||||
|
end
|
||||||
|
_G._packer.needs_bufread = false
|
||||||
|
|
||||||
if should_profile then save_profiles() end
|
if should_profile then save_profiles() end
|
||||||
|
|
||||||
end)
|
end)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user