fix sqls bug, add start.sh

This commit is contained in:
git 2022-07-08 04:03:03 +08:00
parent 24cdd07e35
commit 9cd1989c5c
9 changed files with 61 additions and 7 deletions

View File

@ -1,6 +1,6 @@
let g:username = 'veypi'
let g:email = 'veypi@qq.com'
let g:email = 'i@veypi.com'
runtime ./vimrc.vim
" 插件管理

View File

@ -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 }

View File

@ -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"
}

30
lua/lsp/sql.lua Normal file
View File

@ -0,0 +1,30 @@
#! /usr/bin/env lua
--
-- sql.lua
-- Copyright (C) 2022 veypi <i@veypi.com>
--
-- 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,
}

View File

@ -53,7 +53,6 @@ return require('packer').startup(function()
use 'lewis6991/gitsigns.nvim'
use 'ybian/smartim'
use 'aperezdc/vim-template'

View File

@ -50,8 +50,8 @@ nmap <C-a> gg<S-v>G
" 切换页面
" nmap <S-Tab> :bprev<Return>
" nmap <Tab> :bnext<Return>
nmap <S-Tab> :BufferLineCyclePrev<CR>
nmap <Tab> :BufferLineCycleNext<CR>
nmap <leader>[ :BufferLineCyclePrev<CR>
nmap <leader>] :BufferLineCycleNext<CR>
nmap <leader>1 :BufferLineGoToBuffer 1<CR>
nmap <leader>2 :BufferLineGoToBuffer 2<CR>
nmap <leader>3 :BufferLineGoToBuffer 3<CR>

View File

@ -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 <buffer> lua vim.lsp.buf.formatting_sync()
autocmd BufWritePre * lua vim.lsp.buf.formatting_sync()

12
start.sh Normal file
View File

@ -0,0 +1,12 @@
#! /bin/sh
#
# start.sh
# Copyright (C) 2022 veypi <veypi@qq.com>
#
# Distributed under terms of the Apache license.
#
yarn global add fixjson
yarn global add prettier
pip install yapf

View File

@ -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"