Alpha Chen 2 months ago
parent 1ac81a0952
commit 7f2ba97d3c
Signed by: alpha
SSH Key Fingerprint: SHA256:3fOT8fiYQG/aK9ntivV3Bqtg8AYQ7q4nV6ZgihOA20g

@ -3,7 +3,7 @@
;; .envrc: ;; .envrc:
;; use vim ;; use vim
;; ;;
;; $ rake init:local-nvim ;; $ rake init:local-nvim[DIR]
(local lspconfig (require :lspconfig)) (local lspconfig (require :lspconfig))
(local {: lsp} vim) (local {: lsp} vim)
@ -35,18 +35,8 @@
(let [bufopts {:noremap true :silent true :buffer bufnr}] (let [bufopts {:noremap true :silent true :buffer bufnr}]
(vim.keymap.set :n :gD lsp.buf.declaration bufopts) (vim.keymap.set :n :gD lsp.buf.declaration bufopts)
(vim.keymap.set :n :gd lsp.buf.definition bufopts) (vim.keymap.set :n :gd lsp.buf.definition bufopts)
(vim.keymap.set :n :K lsp.buf.hover bufopts)
(vim.keymap.set :n :gi lsp.buf.implementation bufopts) (vim.keymap.set :n :gi lsp.buf.implementation bufopts)
(vim.keymap.set :n :<C-k> lsp.buf.signature_help bufopts)
(vim.keymap.set :n :<leader>wa lsp.buf.add_workspace_folder bufopts)
(vim.keymap.set :n :<leader>wr lsp.buf.remove_workspace_folder bufopts)
(vim.keymap.set :n :<leader>wl
#(print (vim.inspect (lsp.buf.list_workspace_folders)))
bufopts)
(vim.keymap.set :n :<leader>D lsp.buf.type_definition bufopts) (vim.keymap.set :n :<leader>D lsp.buf.type_definition bufopts)
(vim.keymap.set :n :<leader>rn lsp.buf.rename bufopts)
(vim.keymap.set :n :<leader>ca lsp.buf.code_action bufopts)
(vim.keymap.set :n :gr lsp.buf.references bufopts)
(vim.keymap.set :n :<leader>lf #(lsp.buf.format {:async true}) bufopts))) (vim.keymap.set :n :<leader>lf #(lsp.buf.format {:async true}) bufopts)))
(fn on-attach-do [...] (fn on-attach-do [...]
@ -66,8 +56,10 @@
(let [{: setup} (. lspconfig lsp)] (let [{: setup} (. lspconfig lsp)]
(setup (or config {:on_attach on-attach})))) (setup (or config {:on_attach on-attach}))))
;; efm-langserver things
(local fmt #{:formatCommand $1 :formatStdin true}) (local fmt #{:formatCommand $1 :formatStdin true})
(local lint #{:lintCommand $1 :lintFormats $2 :lintStdin true}) (local lint #{:lintCommand $1 :lintFormats $2 :lintStdin true})
(local fennel-lint (local fennel-lint
"fennel --globals vim,hs,spoon --raw-errors $(realpath --relative-to . ${INPUT}) 2>&1") "fennel --globals vim,hs,spoon --raw-errors $(realpath --relative-to . ${INPUT}) 2>&1")
@ -80,8 +72,12 @@
(local prettier (fmt "prettier --stdin-filepath ${INPUT}")) (local prettier (fmt "prettier --stdin-filepath ${INPUT}"))
(local javascript [eslint prettier]) (local javascript [eslint prettier])
(local yamlfmt (fmt "yamlfmt -in")) (local yamlfmt (fmt "yamlfmt -in"))
(local shellcheck {:lintCommand "shellcheck -f gcc -x"
:lintSource :shellcheck
:lintFormats ["%f:%l:%c: %trror: %m"
"%f:%l:%c: %tarning: %m"
"%f:%l:%c: %tote: %m"]})
(setup-lsp :efm {:on_attach on-attach (setup-lsp :efm {:on_attach on-attach
:init_options {:documentFormatting true :init_options {:documentFormatting true
@ -91,12 +87,14 @@
:completion true} :completion true}
:settings {:languages {: fennel :settings {:languages {: fennel
: javascript : javascript
:sh [shellcheck]
:typescript javascript :typescript javascript
:typescriptreact javascript :typescriptreact javascript
:vue [prettier] :vue [prettier]
:yaml [yamlfmt]}} :yaml [yamlfmt]}}
:filetypes [:fennel :filetypes [:fennel
:javascript :javascript
:sh
:typescript :typescript
:typescriptreact :typescriptreact
:vue :vue
@ -108,7 +106,9 @@
(setup-lsp :pyright (setup-lsp :pyright
{:on_attach on-attach {:on_attach on-attach
:settings {:python {:analysis {:autoImportCompletions true}}}}) :settings {:python {:analysis {:autoImportCompletions true}}}})
(setup-lsp :ruff_lsp)
(setup-lsp :ruff)
(setup-lsp :ruby_lsp)
(setup-lsp :rust_analyzer (setup-lsp :rust_analyzer
{:on_attach on-attach {:on_attach on-attach
:cmd [:rustup :run :stable :rust-analyzer] :cmd [:rustup :run :stable :rust-analyzer]

Loading…
Cancel
Save