From 31dfdece921451724ca3ccbb58543718844a65c6 Mon Sep 17 00:00:00 2001 From: Alpha Chen Date: Thu, 30 Jun 2022 13:52:07 -0700 Subject: [PATCH] more updates to neovim configuration --- .config/nvim/fnl/init.fnl | 91 +++++++++++++------ .gitmodules | 7 +- .../pack/kejadlen/start/colorscheme-paramount | 1 - .../nvim/site/pack/kejadlen/start/paramount | 1 + 4 files changed, 69 insertions(+), 31 deletions(-) delete mode 160000 .local/share/nvim/site/pack/kejadlen/start/colorscheme-paramount create mode 160000 .local/share/nvim/site/pack/kejadlen/start/paramount diff --git a/.config/nvim/fnl/init.fnl b/.config/nvim/fnl/init.fnl index 7f2a8d2..ea5314d 100644 --- a/.config/nvim/fnl/init.fnl +++ b/.config/nvim/fnl/init.fnl @@ -1,36 +1,71 @@ (vim.cmd "colorscheme paramount") -;; clear background -(let [l [:Normal :htmlH1 :htmlH2 :htmlH3 :htmlH4 :htmlH5 :htmlH6]] - (each [_ v (ipairs l)] - (vim.cmd (.. "highlight " v " ctermbg=None")))) +(set vim.opt.list true) +(set vim.opt.listchars "tab:\\u21e5 ,trail:\\u2423,extends:\\u21c9,precedes:\\u21c7,nbsp:\\u00b7") +(set vim.opt.number true) (set vim.g.mapleader " ") (vim.keymap.set :n "\\\\" ":write" {:noremap true}) (vim.keymap.set :i "\\\\" ":write" {:noremap true}) -(vim.keymap.set :n "/" ":nohlsearch" opts) - -(let [opts {:noremap true :silent true}] - (vim.keymap.set :n "e" vim.diagnostic.open_float opts) - (vim.keymap.set :n "[d" vim.diagnostic.goto_prev opts) - (vim.keymap.set :n "]d" vim.diagnostic.goto_next opts) - (vim.keymap.set :n "q" vim.diagnostic.setloclist opts)) - -(fn on_attach [client bufnr] - (vim.api.nvim_buf_set_option bufnr :omnifunc "v:lua.vim.lsp.omnifunc") - (let [bufopts {:noremap true :silent true :buffer bufnr}] - (vim.keymap.set :n "gD" vim.lsp.buf.declaration bufopts) - (vim.keymap.set :n "gd" vim.lsp.buf.definition bufopts) - (vim.keymap.set :n "K" vim.lsp.buf.hover bufopts) - (vim.keymap.set :n "gi" vim.lsp.buf.implementation bufopts) - (vim.keymap.set :n "" vim.lsp.buf.signature_help bufopts) - (vim.keymap.set :n "wa" vim.lsp.buf.add_workspace_folder bufopts) - (vim.keymap.set :n "wr" vim.lsp.buf.remove_workspace_folder bufopts) - (vim.keymap.set :n "wl" (fn [] (print (vim.inspect (vim.lsp.buf.list_workspace_folders)))) bufopts) - (vim.keymap.set :n "D" vim.lsp.buf.type_definition bufopts) - (vim.keymap.set :n "rn" vim.lsp.buf.rename bufopts) - (vim.keymap.set :n "ca" vim.lsp.buf.code_action bufopts) - (vim.keymap.set :n "gr" vim.lsp.buf.references bufopts) - (vim.keymap.set :n "f" vim.lsp.buf.formatting bufopts))) +(vim.keymap.set :n :/ ":nohlsearch" opts) + +;; restore cursor location +;; +;; https://github.com/vim/vim/blob/master/runtime/defaults.vim#L108 +(let [{: nvim_command : nvim_create_autocmd : nvim_create_augroup} vim.api + au-group (nvim_create_augroup :nvim-startup {}) + cb (fn [] + (when (and + (>= (vim.fn.line "'\"") 1) + (<= (vim.fn.line "'\"") (vim.fn.line "$")) + (not (string.find vim.bo.filetype "commit"))) + (nvim_command "normal! g`\"")))] + ;; when restoring the cursor, we want to ignore commit filetypes, so + ;; we need to manually enable filetype detection to set up those + ;; autocommands before creating the autocommand to restore the cursor + ;; + ;; https://github.com/neovim/neovim/issues/15536#issuecomment-909331778 + (nvim_command "filetype plugin indent on") + (nvim_create_autocmd :BufReadPost {:callback cb :group au-group})) + +;; ftplugins in fennel +;; +;; https://github.com/rktjmp/hotpot.nvim/discussions/41#discussioncomment-3050564 +(let [{: nvim_create_autocmd : nvim_create_augroup} vim.api + au-group (nvim_create_augroup :hotpot-ft {}) + cb #(pcall require (.. :ftplugin. (vim.fn.expand :)))] + (nvim_create_autocmd :FileType {:callback cb :group au-group})) + +;; ale + +(set vim.g.ale_fix_on_save 1) +(set vim.g.ale_floating_preview 1) + +;; lspconfig +; (let [opts {:noremap true :silent true}] +; (vim.keymap.set :n :e vim.diagnostic.open_float opts) +; (vim.keymap.set :n "[d" vim.diagnostic.goto_prev opts) +; (vim.keymap.set :n "]d" vim.diagnostic.goto_next opts) +; (vim.keymap.set :n :q vim.diagnostic.setloclist opts)) + +; (fn on_attach [client bufnr] +; (vim.api.nvim_buf_set_option bufnr :omnifunc "v:lua.vim.lsp.omnifunc") +; (let [bufopts {:noremap true :silent true :buffer bufnr}] +; (vim.keymap.set :n :gD vim.lsp.buf.declaration bufopts) +; (vim.keymap.set :n :gd vim.lsp.buf.definition bufopts) +; (vim.keymap.set :n :K vim.lsp.buf.hover bufopts) +; (vim.keymap.set :n :gi vim.lsp.buf.implementation bufopts) +; (vim.keymap.set :n : vim.lsp.buf.signature_help bufopts) +; (vim.keymap.set :n :wa vim.lsp.buf.add_workspace_folder bufopts) +; (vim.keymap.set :n :wr vim.lsp.buf.remove_workspace_folder bufopts) +; (vim.keymap.set :n :wl +; (fn [] +; (print (vim.inspect (vim.lsp.buf.list_workspace_folders)))) +; bufopts) +; (vim.keymap.set :n :D vim.lsp.buf.type_definition bufopts) +; (vim.keymap.set :n :rn vim.lsp.buf.rename bufopts) +; (vim.keymap.set :n :ca vim.lsp.buf.code_action bufopts) +; (vim.keymap.set :n :gr vim.lsp.buf.references bufopts) +; (vim.keymap.set :n :f vim.lsp.buf.formatting bufopts))) diff --git a/.gitmodules b/.gitmodules index 18983aa..ba12269 100644 --- a/.gitmodules +++ b/.gitmodules @@ -133,8 +133,8 @@ path = .local/share/nvim/site/pack/kejadlen/start/hotpot url = https://github.com/rktjmp/hotpot.nvim [submodule ".local/share/nvim/site/pack/kejadlen/start/colorscheme-paramount"] - path = .local/share/nvim/site/pack/kejadlen/start/colorscheme-paramount - url = https://github.com/owickstrom/vim-colors-paramount.git + path = .local/share/nvim/site/pack/kejadlen/start/paramount + url = https://github.com/kejadlen/vim-colors-paramount.git [submodule ".local/share/nvim/site/pack/kejadlen/start/vim-tmux-navigator"] path = .local/share/nvim/site/pack/kejadlen/start/tmux-navigator url = https://github.com/christoomey/vim-tmux-navigator.git @@ -165,3 +165,6 @@ [submodule ".local/share/nvim/site/pack/kejadlen/start/surround"] path = .local/share/nvim/site/pack/kejadlen/start/surround url = https://github.com/tpope/vim-surround.git +[submodule ".local/share/nvim/site/pack/kejadlen/start/ale"] + path = .local/share/nvim/site/pack/kejadlen/start/ale + url = https://github.com/dense-analysis/ale.git diff --git a/.local/share/nvim/site/pack/kejadlen/start/colorscheme-paramount b/.local/share/nvim/site/pack/kejadlen/start/colorscheme-paramount deleted file mode 160000 index a5601d3..0000000 --- a/.local/share/nvim/site/pack/kejadlen/start/colorscheme-paramount +++ /dev/null @@ -1 +0,0 @@ -Subproject commit a5601d36fb6932e8d1a6f8b37b179a99b1456798 diff --git a/.local/share/nvim/site/pack/kejadlen/start/paramount b/.local/share/nvim/site/pack/kejadlen/start/paramount new file mode 160000 index 0000000..b004f06 --- /dev/null +++ b/.local/share/nvim/site/pack/kejadlen/start/paramount @@ -0,0 +1 @@ +Subproject commit b004f06bc49ff3fded75e0d374bc592d6902cf6b