diff --git a/init.vim b/init.vim index 5d2f85d..aa8ce26 100644 --- a/init.vim +++ b/init.vim @@ -1,6 +1,6 @@ let g:username = 'veypi' -let g:email = 'veypi@qq.com' +let g:email = 'i@veypi.com' runtime ./vimrc.vim " 插件管理 diff --git a/lua/lsp/efm.lua b/lua/lsp/efm.lua index dd9e6ea..e8465ef 100644 --- a/lua/lsp/efm.lua +++ b/lua/lsp/efm.lua @@ -2,7 +2,7 @@ -- https://github.com/mattn/efm-langserver return { init_options = { documentFormatting = true }, - filetypes = { 'python', 'json', 'css' }, + filetypes = { 'python', 'json', 'css', 'yaml' }, settings = { rootMarkers = { ".git/" }, languages = { @@ -15,6 +15,10 @@ return { { formatCommand = "fixjson", formatStdin = true } }, + -- yarn global add yaml-lint + yaml = { + { formatCommand = "yamllint -f parsable -", formatStdin = true } + }, css = { -- yarn global add prettier { formatCommand = "prettier --tab-width=4 ${--single-quote:singleQuote} --parser css", formatStdin = true } diff --git a/lua/lsp/setup.lua b/lua/lsp/setup.lua index 66310df..d8c7a4b 100644 --- a/lua/lsp/setup.lua +++ b/lua/lsp/setup.lua @@ -35,6 +35,7 @@ local servers = { pyright = require "lsp.base", rust_analyzer = require "lsp.base", tailwindcss = require "lsp.tailwind", + sqls = require "lsp.sql", efm = require "lsp.efm" } diff --git a/lua/lsp/sql.lua b/lua/lsp/sql.lua new file mode 100644 index 0000000..dc4ef44 --- /dev/null +++ b/lua/lsp/sql.lua @@ -0,0 +1,30 @@ +#! /usr/bin/env lua +-- +-- sql.lua +-- Copyright (C) 2022 veypi +-- +-- Distributed under terms of the Apache license. +-- + + + +return { + settings = { + sqls = { + connections = { + { + driver = 'mysql', + dataSourceName = 'root:123456@tcp(127.0.0.1:3306)/test', + }, + }, + }, + }, + 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 + client.server_capabilities.documentRangeFormattingProvider = false + -- print(vim.inspect(client)) + end, +} diff --git a/lua/plugins.lua b/lua/plugins.lua index 905024e..695a650 100644 --- a/lua/plugins.lua +++ b/lua/plugins.lua @@ -53,7 +53,6 @@ return require('packer').startup(function() use 'lewis6991/gitsigns.nvim' - use 'ybian/smartim' use 'aperezdc/vim-template' diff --git a/maps.vim b/maps.vim index e4110ed..49f2b9f 100644 --- a/maps.vim +++ b/maps.vim @@ -50,8 +50,8 @@ nmap ggG " 切换页面 " nmap :bprev " nmap :bnext -nmap :BufferLineCyclePrev -nmap :BufferLineCycleNext +nmap [ :BufferLineCyclePrev +nmap ] :BufferLineCycleNext nmap 1 :BufferLineGoToBuffer 1 nmap 2 :BufferLineGoToBuffer 2 nmap 3 :BufferLineGoToBuffer 3 diff --git a/plug.vim b/plug.vim index 6039a84..00ef44e 100644 --- a/plug.vim +++ b/plug.vim @@ -4,9 +4,8 @@ let g:mergetool_layout = 'LmR' let g:templates_directory = '~/.config/nvim/templates/' +let g:license = 'Apache' -let g:smartim_default = 'com.apple.keylayout.ABC' -let g:smartim_disable = 0 " autocmd BufWritePre lua vim.lsp.buf.formatting_sync() autocmd BufWritePre * lua vim.lsp.buf.formatting_sync() diff --git a/start.sh b/start.sh new file mode 100644 index 0000000..0486921 --- /dev/null +++ b/start.sh @@ -0,0 +1,12 @@ +#! /bin/sh +# +# start.sh +# Copyright (C) 2022 veypi +# +# Distributed under terms of the Apache license. +# + + +yarn global add fixjson +yarn global add prettier +pip install yapf diff --git a/templates/=template=Makefile b/templates/=template=Makefile new file mode 100644 index 0000000..5ffdd47 --- /dev/null +++ b/templates/=template=Makefile @@ -0,0 +1,9 @@ +# +# %FFILE% +# Copyright (C) %YEAR% %USER% <%MAIL%> +# %FDATE% +# Distributed under terms of the %LICENSE% license. +# + +all: + %HERE%@echo "%FFILE% needs your attention"