update to nvim 0.9

This commit is contained in:
veypi 2023-09-12 18:55:10 +08:00
parent 1349868048
commit e53c7aa336
8 changed files with 66 additions and 97 deletions

View File

@ -2,10 +2,3 @@
my vim cfg
asdmertge
o1
o2
o3
o4
o5
sfads

View File

@ -1,65 +1,25 @@
local tree_cb = require 'nvim-tree.config'.nvim_tree_callback -- following options are the default
-- r rename
-- d delete
-- 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,
sort_by = "case_sensitive",
renderer = {
group_empty = true,
},
filters = {
dotfiles = true,
custom = {},
exclude = {},
},
system_open = {
cmd = nil,
args = {},
git = {
enable = true,
ignore = true,
timeout = 400,
},
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 = "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") },
}
}
}
}

View File

@ -11,12 +11,12 @@ require("mason").setup({
-- https://github.com/williamboman/mason-lspconfig.nvim
require("mason-lspconfig").setup {
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 capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities = require('cmp_nvim_lsp').update_capabilities(capabilities)
capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities)
-- 需特别配置的lsp插件
-- { key: 语言 value: 配置文件 }
@ -24,7 +24,7 @@ capabilities = require('cmp_nvim_lsp').update_capabilities(capabilities)
local servers = {
sumneko_lua = require "lsp.lua", -- /lua/lsp/lua.lua
tailwindcss = require "lsp.tailwind",
sqls = require "lsp.sql",
sqlls = require "lsp.sqlls",
efm = require "lsp.efm",
volar = require "lsp.volar"
}

View File

@ -10,7 +10,7 @@
return {
settings = {
sqls = {
sqlls = {
connections = {
{
driver = 'mysql',
@ -20,7 +20,6 @@ return {
},
},
on_attach = function(client)
-- sqls there seem a bug when format file
client.resolved_capabilities.document_formatting = false
client.resolved_capabilities.document_range_formatting = false
client.server_capabilities.documentFormattingProvider = false

View File

@ -76,7 +76,7 @@ return require('packer').startup(function()
use { "akinsho/toggleterm.nvim" }
-- 自动保存
use "Pocco81/AutoSave.nvim"
-- use "Pocco81/AutoSave.nvim"
-- git状态
use 'lewis6991/gitsigns.nvim'

View File

@ -11,21 +11,21 @@ require("toggleterm").setup {
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
}
-- 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
-- }
require('gitsigns').setup {

View File

@ -8,7 +8,11 @@ let g:license = 'Apache'
" 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
@ -54,3 +58,9 @@ let g:vimtex_compiler_latexmk = {
" let maplocalleader = ","
" copilot config
imap <silent><script><expr> <C-J> copilot#Accept("\<CR>")
let g:copilot_no_tab_map = v:true

View File

@ -9,10 +9,13 @@ 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
_G._packer = _G._packer or {}
_G._packer.inside_compile = true
local time
local profile_info
local should_profile = false
if should_profile then
local hrtime = vim.loop.hrtime
profile_info = {}
time = function(chunk, start)
@ -22,9 +25,9 @@ local no_errors, error_msg = pcall(function()
profile_info[chunk] = (hrtime() - profile_info[chunk]) / 1e6
end
end
else
else
time = function(chunk, start) end
end
end
local function save_profiles(threshold)
local sorted_times = {}
@ -38,8 +41,10 @@ local function save_profiles(threshold)
results[i] = elem[1] .. ' took ' .. elem[2] .. 'ms'
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
end
@ -69,11 +74,6 @@ end
time([[try_loadstring definition]], false)
time([[Defining packer_plugins]], true)
_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"] = {
loaded = true,
path = "/Users/veypi/.local/share/nvim/site/pack/packer/start/Comment.nvim",
@ -232,6 +232,13 @@ _G.packer_plugins = {
}
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
end)