fix: update autocommands

This commit is contained in:
2023-09-15 14:10:38 +08:00
parent fa8b291b1d
commit f12a4caccb
3 changed files with 11 additions and 11 deletions
+9 -9
View File
@@ -2,13 +2,13 @@ local utils = require('utils')
local auto_formatters = { }
local python_autoformat = {'BufWritePre', '*.py', 'lua vim.lsp.buf.formatting_sync(nil, 1000)'}
local python_autoformat = {'BufWritePre', '*.py', 'lua vim.lsp.buf.format({async=false})'}
if O.python.autoformat then table.insert(auto_formatters, python_autoformat) end
local javascript_autoformat = {'BufWritePre', '*.js', 'lua vim.lsp.buf.formatting_sync(nil, 1000)'}
local javascriptreact_autoformat = {'BufWritePre', '*.jsx', 'lua vim.lsp.buf.formatting_sync(nil, 1000)'}
local typescript_autoformat = {'BufWritePre', '*.ts', 'lua vim.lsp.buf.formatting_sync(nil, 1000)'}
local typescriptreact_autoformat = {'BufWritePre', '*.tsx', 'lua vim.lsp.buf.formatting_sync(nil, 1000)'}
local javascript_autoformat = {'BufWritePre', '*.js', 'lua vim.lsp.buf.format({async=false})'}
local javascriptreact_autoformat = {'BufWritePre', '*.jsx', 'lua vim.lsp.buf.format({async=false})'}
local typescript_autoformat = {'BufWritePre', '*.ts', 'lua vim.lsp.buf.format({async=false})'}
local typescriptreact_autoformat = {'BufWritePre', '*.tsx', 'lua vim.lsp.buf.format({async=false})'}
if O.tsserver.autoformat then
table.insert(auto_formatters, javascript_autoformat)
table.insert(auto_formatters, javascriptreact_autoformat)
@@ -16,16 +16,16 @@ if O.tsserver.autoformat then
table.insert(auto_formatters, typescriptreact_autoformat)
end
local lua_format = {'BufWritePre', '*.lua', 'lua vim.lsp.buf.formatting_sync(nil, 1000)'}
local lua_format = {'BufWritePre', '*.lua', 'lua vim.lsp.buf.format({async=false})'}
if O.lua.autoformat then table.insert(auto_formatters, lua_format) end
local json_format = {'BufWritePre', '*.json', 'lua vim.lsp.buf.formatting_sync(nil, 1000)'}
local json_format = {'BufWritePre', '*.json', 'lua vim.lsp.buf.format({async=false})'}
if O.json.autoformat then table.insert(auto_formatters, json_format) end
local ruby_format = {'BufWritePre', '*.rb', 'lua vim.lsp.buf.formatting_sync(nil,1000)'}
local ruby_format = {'BufWritePre', '*.rb', 'lua vim.lsp.buf.format({async=false})'}
if O.ruby.autoformat then table.insert(auto_formatters, ruby_format) end
local go_format = {'BufWritePre', '*.go', 'lua vim.lsp.buf.formatting_sync(nil,1000)'}
local go_format = {'BufWritePre', '*.go', 'lua vim.lsp.buf.format({async=false})'}
if O.go.autoformat then table.insert(auto_formatters, go_format) end
utils.define_augroups({
+1 -1
View File
@@ -19,7 +19,7 @@ end
function lv_utils.open_md()
local p = vim.fn.expand('%:p')
vim.fn.system("open -a typora "..p)
vim.fn.system("open -a marktext "..p)
end
function lv_utils.define_augroups(definitions) -- {{{1