neovim updates

- use vim.o instead of vim.opt
- disable hlsearch
- add navic in preparation for 0.8
- disable tree-sitter indent because it's awful in Ruby
- add parameter text objects via tree-sitter
- use typeprof lsp for Ruby
pull/2/head
Alpha Chen 2 years ago
parent 32ebbc8168
commit 8f1f8082cb

@ -1,26 +1,21 @@
(vim.cmd "colorscheme paramount") (vim.cmd "colorscheme paramount")
(set vim.opt.foldlevel 1) (set vim.o.foldlevel 1)
(set vim.opt.linebreak true) (set vim.o.linebreak true)
(set vim.opt.list true) (set vim.o.list true)
(set vim.o.listchars
;; fnlfmt: skip "tab:\\u21e5 ,trail:\\u2423,extends:\\u21c9,precedes:\\u21c7,nbsp:\\u00b7")
(set vim.opt.listchars {:tab "\\u21e5 "
:trail "\\u2423" (set vim.o.number true)
:extends "\\u21c9" (set vim.o.showmode false)
:precedes "\\u21c7" (set vim.o.termguicolors true)
:nbsp "\\u00b7"}) (set vim.o.virtualedit :block)
(set vim.o.wildmode "longest:full")
(set vim.opt.number true)
(set vim.opt.showmode false)
(set vim.opt.termguicolors true)
(set vim.opt.virtualedit :block)
(set vim.opt.wildmode "longest:full")
;; search ;; search
(set vim.opt.gdefault true) (set vim.o.gdefault true)
(set vim.opt.ignorecase true) (set vim.o.ignorecase true)
(set vim.opt.smartcase true) (set vim.o.smartcase true)
(set vim.g.mapleader " ") (set vim.g.mapleader " ")
@ -32,8 +27,9 @@
(vim.keymap.set :n "\\\\" ":write<cr>") (vim.keymap.set :n "\\\\" ":write<cr>")
(vim.keymap.set :i "\\\\" "<esc>:write<cr>") (vim.keymap.set :i "\\\\" "<esc>:write<cr>")
;; clear highlight ;; highlight
(vim.keymap.set :n :<leader>/ ":nohlsearch<cr>") (set vim.o.hlsearch false)
; (vim.keymap.set :n :<leader>/ ":nohlsearch<cr>")
;; non-shifted shortcuts for moving the cursor to the start/end of the current line ;; non-shifted shortcuts for moving the cursor to the start/end of the current line
(vim.keymap.set :n :H "^") (vim.keymap.set :n :H "^")
@ -90,6 +86,12 @@
(tset palette f :middle [[:NONE :NONE :NONE :NONE]])) (tset palette f :middle [[:NONE :NONE :NONE :NONE]]))
(tset vim.g palette-key palette)) (tset vim.g palette-key palette))
;;; navic
;; TODO Enable this when 0.8 is released
;; TODO Use fennel for this?
; (set vim.o.winbar "%{%v:lua.require'nvim-navic'.get_location()%}")
;;; netrw ;;; netrw
;; https://github.com/tpope/vim-vinegar/issues/13 ;; https://github.com/tpope/vim-vinegar/issues/13
@ -102,7 +104,8 @@
(setup {:ensure_installed [:fennel :lua :ruby :rust :typescript] (setup {:ensure_installed [:fennel :lua :ruby :rust :typescript]
:sync_install false :sync_install false
:highlight {:enable true :additional_vim_regex_highlighting false} :highlight {:enable true :additional_vim_regex_highlighting false}
:indent {:enable true} ;; disabling since this is super annoying in Ruby
; :indent {:enable true}
:incremental_selection {:enable true :incremental_selection {:enable true
:keymaps {:init_selection :gnn :keymaps {:init_selection :gnn
:node_incremental :grn :node_incremental :grn
@ -115,10 +118,12 @@
:ac "@class.outer" :ac "@class.outer"
:ic "@class.inner" :ic "@class.inner"
:ab "@block.outer" :ab "@block.outer"
:ib "@block.inner"}}}})) :ib "@block.inner"
:aa "@parameter.outer"
:ia "@parameter.inner"}}}}))
(set vim.opt.foldmethod :expr) (set vim.o.foldmethod :expr)
(set vim.opt.foldexpr "nvim_treesitter#foldexpr()") (set vim.o.foldexpr "nvim_treesitter#foldexpr()")
;;; generate help files ;;; generate help files

@ -38,7 +38,11 @@
(vim.keymap.set :n :<leader>rn lsp.buf.rename 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 :<leader>ca lsp.buf.code_action bufopts)
(vim.keymap.set :n :gr lsp.buf.references bufopts) (vim.keymap.set :n :gr lsp.buf.references bufopts)
(vim.keymap.set :n :<leader>lf lsp.buf.formatting bufopts))) (vim.keymap.set :n :<leader>lf lsp.buf.formatting bufopts))
(when (not= client.name :efm)
(let [navic (require :nvim-navic)
{: attach} navic]
(attach client bufnr))))
(local prettier (fmt "prettier --stdin-filepath ${INPUT}" true)) (local prettier (fmt "prettier --stdin-filepath ${INPUT}" true))
(local fennel [(fmt "fnlfmt /dev/stdin" true) (local fennel [(fmt "fnlfmt /dev/stdin" true)
@ -64,9 +68,10 @@
(set client.resolved_capabilities.document_formatting (set client.resolved_capabilities.document_formatting
false))) false)))
(let [{: efm : rust_analyzer : tsserver} (require :lspconfig)] (let [{: efm : rust_analyzer : tsserver : typeprof} (require :lspconfig)]
(efm.setup efm-setup) (efm.setup efm-setup)
(rust_analyzer.setup {:on_attach on-attach (rust_analyzer.setup {:on_attach on-attach
:settings {:rust-analyzer {:checkOnSave {:command :clippy}}}}) :settings {:rust-analyzer {:checkOnSave {:command :clippy}}}})
(tsserver.setup {:on_attach tsserver-attach})) (tsserver.setup {:on_attach tsserver-attach})
(typeprof.setup {:on_attach on-attach}))

Loading…
Cancel
Save