mirror of
https://github.com/stevenproctor/dotfiles.git
synced 2026-01-28 10:09:55 -06:00
move to almost all fennel
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
(module my_vim.core
|
||||
(module dotfiles.core
|
||||
{autoload
|
||||
{a aniseed.core}
|
||||
require
|
||||
@@ -18,8 +18,8 @@
|
||||
(a.map safe-source ["~/.vimrc" "~/.vimrc.local"])
|
||||
|
||||
|
||||
(def- backup-dir "$HOME/.vim/backup")
|
||||
(def- undo-dir "$HOME.vim/undo")
|
||||
(def- backup-dir (.. (nvim.fn.glob "$HOME") "/.vim/backup"))
|
||||
(def- undo-dir (.. (nvim.fn.glob "$HOME") "/.vim/backup"))
|
||||
|
||||
(def- on-opts [
|
||||
:autoindent
|
||||
@@ -47,7 +47,7 @@
|
||||
|
||||
(def- val-based-opts
|
||||
{
|
||||
:t_Co 256
|
||||
; :t_Co 256
|
||||
:laststatus 2
|
||||
:encoding "utf-8"
|
||||
:history 500
|
||||
@@ -67,15 +67,16 @@
|
||||
:undoreload 10000
|
||||
:foldmethod "expr"
|
||||
:foldexpr "nvim_treesitter#foldexpr()"
|
||||
:foldlevelstart 99
|
||||
:foldlevelstart 100
|
||||
:foldlevel 99
|
||||
:tabstop 2
|
||||
:shiftwidth 2
|
||||
:softtabstop 2
|
||||
:list "listchars=tab:➥\\ ,trail:·"
|
||||
:list true
|
||||
:listchars "tab:➥\\ ,trail:·"
|
||||
:backspace "indent,eol,start" ;allow backspacing over everything in insert mode
|
||||
:wildmode "list:longest,list:full"
|
||||
:wrap "off"
|
||||
:wrap false
|
||||
})
|
||||
|
||||
(defn- set-opt
|
||||
@@ -88,9 +89,13 @@
|
||||
|
||||
(a.map set-opt-on on-opts)
|
||||
|
||||
(a.map set-opt val-based-opts)
|
||||
(a.map-indexed set-opt val-based-opts)
|
||||
|
||||
(nvim.ex.syntax "on")
|
||||
(nvim.ex.colorscheme "solarized8")
|
||||
(nvim.ex.colorscheme :solarized8)
|
||||
|
||||
(nvim.fn.glob "~/.vimrc.local")
|
||||
|
||||
|
||||
; (nvim.ex.autocmd "vimenter" "*" "++nested" "colorscheme" "solarized8")
|
||||
;
|
||||
; (nvim.fn.glob "~/.vimrc.local")
|
||||
13
nvim/.config/nvim/fnl/dotfiles/init.fnl
Normal file
13
nvim/.config/nvim/fnl/dotfiles/init.fnl
Normal file
@@ -0,0 +1,13 @@
|
||||
(module dotfiles.init
|
||||
{autoload
|
||||
{a aniseed.core}
|
||||
require
|
||||
{nvim aniseed.nvim}})
|
||||
|
||||
|
||||
(require :dotfiles.plugins)
|
||||
(require :dotfiles.core)
|
||||
(require :dotfiles.mapping)
|
||||
|
||||
;(nvim.ex.source "~/.vimrc")
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
(module my_nvim.mapping
|
||||
(module dotfiles.mapping
|
||||
{autoload {nvim aniseed.nvim
|
||||
nu aniseed.nvim.util
|
||||
core aniseed.core}})
|
||||
@@ -52,7 +52,7 @@
|
||||
(noremap :n :gph ":GitGutterPrevHunk<CR>")
|
||||
(noremap :n :gsh ":GitGutterStageHunk<CR>")
|
||||
|
||||
(noremap :n :<leader>li "<Cmd>LspInfo<CR>")
|
||||
; (noremap :n :<leader>li "<Cmd>LspInfo<CR>")
|
||||
;vim.api.nvim_set_keymap('n', '<leader>li', '<Cmd>LspInfo<CR>', { noremap=true, silent=true })
|
||||
|
||||
; Open file in Marked 2 (markdown viewer)
|
||||
19
nvim/.config/nvim/fnl/dotfiles/plugin/conjure.fnl
Normal file
19
nvim/.config/nvim/fnl/dotfiles/plugin/conjure.fnl
Normal file
@@ -0,0 +1,19 @@
|
||||
(module dotfiles.plugin.conjure
|
||||
{autoload {nvim aniseed.nvim}})
|
||||
|
||||
; (set nvim.g.conjure#eval#result_register "*")
|
||||
; (set nvim.g.conjure#log#botright true)
|
||||
; (set nvim.g.conjure#mapping#doc_word "gk")
|
||||
(set nvim.g.conjure#extract#tree_sitter#enabled true)
|
||||
|
||||
; (n
|
||||
|
||||
;
|
||||
;
|
||||
; au User asyncomplete_setup call asyncomplete#register_source(asyncomplete#sources#conjure#get_source_options({
|
||||
; \ 'name': 'conjure',
|
||||
; \ 'allowlist': ['clojure', 'fennel'],
|
||||
; \ 'triggers': {'*': ['/']},
|
||||
; \ 'time': 20,
|
||||
; \ 'completor': function('asyncomplete#sources#conjure#completor'),
|
||||
; \ }))
|
||||
171
nvim/.config/nvim/fnl/dotfiles/plugin/lspconfig.fnl
Normal file
171
nvim/.config/nvim/fnl/dotfiles/plugin/lspconfig.fnl
Normal file
@@ -0,0 +1,171 @@
|
||||
(module dotfiles.plugin.lspconfig
|
||||
{autoload
|
||||
{a aniseed.core
|
||||
u dotfiles.util
|
||||
nvim aniseed.nvim
|
||||
}
|
||||
})
|
||||
|
||||
(defn bufmap [mode from to]
|
||||
(u.noremap mode from to {:local? true}))
|
||||
|
||||
(defn nbufmap [from to]
|
||||
(bufmap :n from to))
|
||||
|
||||
(defn xbufmap [from to]
|
||||
(bufmap :x from to))
|
||||
|
||||
|
||||
(defn define-sign [level sign]
|
||||
(let [sign-level (.. "LspDiagnosticsSign" level)]
|
||||
(nvim.fn.sign_define sign-level
|
||||
{:texthl sign-level
|
||||
:text sign
|
||||
:numhl sign-level})))
|
||||
|
||||
(define-sign :Error "☢️")
|
||||
(define-sign :Warning "⚠️")
|
||||
(define-sign :Hint "🔎")
|
||||
(define-sign :Information "ℹ️")
|
||||
|
||||
; -- function LspExecuteCommand(cmd, ...)
|
||||
; -- arguments = {vim.uri_from_bufnr(0), vim.api.nvim_win_get_cursor(0)[1] - 1, vim.api.nvim_win_get_cursor(0)[2] -1}
|
||||
; -- for _,a in pairs({...}) do table.insert(arguments, a) end
|
||||
; -- vim.lsp.buf.execute_command({command = cmd, arguments = arguments})
|
||||
; -- end
|
||||
|
||||
|
||||
(def core-nmappings
|
||||
{
|
||||
:gd "lua vim.lsp.buf.definition()"
|
||||
:gD "lua vim.lsp.buf.declaration()"
|
||||
:gi "lua vim.lsp.buf.implementation()"
|
||||
:gr "lua vim.lsp.buf.references()"
|
||||
:K "lua vim.lsp.buf.hover()"
|
||||
"[g" "lua vim.lsp.diagnostic.goto_prev()"
|
||||
"g" "lua vim.lsp.diagnostic.goto_prev()"
|
||||
:<leader>ca "lua vim.lsp.buf.codeaction()"
|
||||
:<leader>sld "lua vim.lsp.diagnostic.show_line_diagnostics()"
|
||||
:<leader>rn "lua vim.lsp.buf.rename()"
|
||||
:<leader>fa "lua vim.lsp.buf.formattting_sync()"
|
||||
})
|
||||
|
||||
(def client-nmappings
|
||||
{:clojure
|
||||
{
|
||||
; -- buf_set_keymap('n', '<leader>cn', "<cmd>lua LspExecuteCommand('clean-ns')<CR>", opts)
|
||||
; -- buf_set_keymap('n', '<leader>ref', "<cmd>lua LspExecuteCommand('extract-function', vim.api.nvim_eval(\"input('Function name: ')\"))<CR>", opts)
|
||||
; -- buf_set_keymap('x', '<leader>ref', "<cmd>lua LspExecuteCommand('extract-function', vim.api.nvim_eval(\"input('Function name: ')\"))<CR>", opts)
|
||||
; -- buf_set_keymap('n', '<leader>id', "<cmd>lua LspExecuteCommand('inline-symbol')<CR>", opts)
|
||||
; -- buf_set_keymap('x', '<leader>id', "<cmd>lua LspExecuteCommand('inline-symbol')<CR>", opts)
|
||||
; -- buf_set_keymap('n', '<leader>il', "<cmd>lua LspExecuteCommand('introduce-let', vim.api.nvim_eval(\"input('Binding name: ')\"))<CR>", opts)
|
||||
; -- buf_set_keymap('x', '<leader>il', "<cmd>lua LspExecuteCommand('introduce-let', vim.api.nvim_eval(\"input('Binding name: ')\"))<CR>", opts)
|
||||
; -- buf_set_keymap('n', '<leader>m2l', "<cmd>lua LspExecuteCommand('move-to-let', vim.api.nvim_eval(\"input('Binding name: ')\"))<CR>", opts)
|
||||
; -- buf_set_keymap('x', '<leader>m2l', "<cmd>lua LspExecuteCommand('move-to-let', vim.api.nvim_eval(\"input('Binding name: ')\"))<CR>", opts)
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
(defn bind-client-mappings [client]
|
||||
(let [mappings (a.get client-nmappings client)]
|
||||
(when mappings
|
||||
(each [mapping cmd (pairs mappings)]
|
||||
(nbufmap mapping cmd)))))
|
||||
|
||||
(defn on_attach [client bufnr]
|
||||
(each [mapping cmd (pairs core-nmappings)]
|
||||
(nbufmap mapping cmd))
|
||||
|
||||
; x mode mappings
|
||||
(xbufmap :<leader>fa "lua vim.lsp.buf.formattting_sync()")
|
||||
|
||||
; -- buf_set_keymap('n', 'gs', '<Cmd>lua vim.lsp.buf.document_symbol()<CR>', opts)
|
||||
; -- buf_set_keymap('n', 'gS', '<Cmd>lua vim.lsp.buf.workspace_symbol()<CR>', opts)
|
||||
; -- buf_set_keymap('n', 'gt', '<cmd>lua vim.lsp.buf.type_definition()<CR>', opts)
|
||||
; -- buf_set_keymap('n', '<leader>wa', '<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>', opts)
|
||||
; -- buf_set_keymap('n', '<leader>wr', '<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>', opts)
|
||||
; -- buf_set_keymap('n', '<leader>wl', '<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>', opts)
|
||||
; -- buf_set_keymap('n', '<leader>q', '<cmd>lua vim.lsp.diagnostic.set_loclist()<CR>', opts)
|
||||
; -- buf_set_keymap('n', '<leader>ic', "<cmd>lua vim.lsp.buf.incoming_calls()<CR>", opts)
|
||||
; -- buf_set_keymap('x', '<leader>ic', "<cmd>lua vim.lsp.buf.incoming_calls()<CR>", opts)
|
||||
|
||||
|
||||
(bind-client-mappings client)
|
||||
; -- vim.api.nvim_command[[autocmd BufWritePre <buffer> lua vim.lsp.buf.formatting_sync()]]
|
||||
; -- vim.api.nvim_command[[autocmd BufWritePre <buffer> lua vim.lsp.buf_request_sync(vim.api.nvim_get_current_buf(), 'workspace/executeCommand', {command = 'clean-ns', arguments = {vim.uri_from_bufnr(0), vim.api.nvim_win_get_cursor(0)[1], vim.api.nvim_win_get_cursor(0)[2]}, title = 'Clean Namespace'})]]
|
||||
|
||||
(print "LSP Client Attached.");
|
||||
)
|
||||
|
||||
(let [lspi (require :lspinstall)]
|
||||
(when lspi
|
||||
(defn setup-servers []
|
||||
(lspi.setup)
|
||||
(let [lspconfig (require :lspconfig)
|
||||
servers (lspi.installed_servers)]
|
||||
(each [_ server (pairs servers)]
|
||||
((. lspconfig server :setup) {:on_attach on_attach :flags {:debounce_text_changes 150} }))))
|
||||
|
||||
(setup-servers)
|
||||
|
||||
(u.nnoremap :<leader>li "LspInfo")))
|
||||
|
||||
; ()lspi.post_install_hook = post_lsp_install
|
||||
; -- require'lspinstall'.post_install_hook = function ()
|
||||
; -- setup_servers() -- reload installed servers
|
||||
; -- vim.cmd("bufdo e") -- this triggers the FileType autocmd that starts the server
|
||||
; -- end
|
||||
|
||||
; -- local nvim_lsp = require('lspconfig')
|
||||
; --
|
||||
; -- function LspExecuteCommand(cmd, ...)
|
||||
; -- arguments = {vim.uri_from_bufnr(0), vim.api.nvim_win_get_cursor(0)[1] - 1, vim.api.nvim_win_get_cursor(0)[2] -1}
|
||||
; -- for _,a in pairs({...}) do table.insert(arguments, a) end
|
||||
; -- vim.lsp.buf.execute_command({command = cmd, arguments = arguments})
|
||||
; -- end
|
||||
; --
|
||||
; -- -- Use an on_attach function to only map the following keys
|
||||
; -- -- after the language server attaches to the current buffer
|
||||
; -- local on_attach = function(client, bufnr)
|
||||
; -- local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end
|
||||
; -- local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end
|
||||
; --
|
||||
; -- --Enable completion triggered by <c-x><c-o>
|
||||
; -- buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc')
|
||||
; --
|
||||
; -- -- Mappings.
|
||||
; -- local opts = { noremap=true, silent=true }
|
||||
; --
|
||||
; -- -- See `:help vim.lsp.*` for documentation on any of the below functions
|
||||
|
||||
; --
|
||||
; --
|
||||
; -- -- vim.api.nvim_command[[autocmd BufWritePre <buffer> lua vim.lsp.buf_request_sync(vim.api.nvim_get_current_buf(), 'workspace/executeCommand', {command = 'clean-ns', arguments = {vim.uri_from_bufnr(0), vim.api.nvim_win_get_cursor(0)[1], vim.api.nvim_win_get_cursor(0)[2]}, title = 'Clean Namespace'})]]
|
||||
; --
|
||||
; -- vim.api.nvim_command[[lua print("Lsp Client Attached.")]]
|
||||
; -- end
|
||||
; --
|
||||
; --
|
||||
; -- -- vim.api.nvim_set_keymap('n', '<leader>li', '<Cmd>LspInfo<CR>', { noremap=true, silent=true })
|
||||
; --
|
||||
; --
|
||||
; -- local function setup_servers()
|
||||
; -- require'lspinstall'.setup()
|
||||
; -- local servers = require'lspinstall'.installed_servers()
|
||||
; -- for _, server in pairs(servers) do
|
||||
; -- require'lspconfig'[server].setup{
|
||||
; -- on_attach = on_attach,
|
||||
; -- flags = {
|
||||
; -- debounce_text_changes = 150,
|
||||
; -- }
|
||||
; -- }
|
||||
; -- end
|
||||
; -- end
|
||||
; --
|
||||
; -- setup_servers()
|
||||
; --
|
||||
; -- -- Automatically reload after `:LspInstall <server>` so we don't have to restart neovim
|
||||
; -- require'lspinstall'.post_install_hook = function ()
|
||||
; -- setup_servers() -- reload installed servers
|
||||
; -- vim.cmd("bufdo e") -- this triggers the FileType autocmd that starts the server
|
||||
; -- end
|
||||
9
nvim/.config/nvim/fnl/dotfiles/plugin/packer.fnl
Normal file
9
nvim/.config/nvim/fnl/dotfiles/plugin/packer.fnl
Normal file
@@ -0,0 +1,9 @@
|
||||
(module dotfiles.plugin.packer
|
||||
{autoload
|
||||
{u dotfiles.util}
|
||||
require
|
||||
{nvim aniseed.nvim}})
|
||||
|
||||
(u.nnoremap :<leader>pi :PackerInstall)
|
||||
(u.nnoremap :<leader>pu :PackerUpdate)
|
||||
|
||||
32
nvim/.config/nvim/fnl/dotfiles/plugin/telescope.fnl
Normal file
32
nvim/.config/nvim/fnl/dotfiles/plugin/telescope.fnl
Normal file
@@ -0,0 +1,32 @@
|
||||
(module dotfiles.plugin.telescope
|
||||
{autoload {nvim aniseed.nvim
|
||||
util dotfiles.util
|
||||
telescope telescope}})
|
||||
|
||||
(telescope.setup
|
||||
{:defaults
|
||||
{:vimgrep_arguments ["ag" "--nocolor=never" "--noheading"
|
||||
"--files-with-matches" "--number" "--column"
|
||||
"--smart-case" "--hidden" "--follow"
|
||||
"-g" "!.git/"]}})
|
||||
|
||||
|
||||
(util.lnnoremap :ff "Telescope find_files hidden=true")
|
||||
(util.lnnoremap :f- "Telescope file_browser")
|
||||
(util.lnnoremap :fg "Telescope live_grep")
|
||||
(util.lnnoremap :* "Telescope grep_string")
|
||||
(util.lnnoremap :fb "Telescope buffers")
|
||||
(util.lnnoremap :fH "Telescope help_tags")
|
||||
(util.lnnoremap :fm "Telescope keymaps")
|
||||
(util.lnnoremap :fM "Telescope marks")
|
||||
(util.lnnoremap :fh "Telescope oldfiles")
|
||||
(util.lnnoremap :ft "Telescope filetypes")
|
||||
(util.lnnoremap :fc "Telescope commands")
|
||||
(util.lnnoremap :fC "Telescope command_history")
|
||||
(util.lnnoremap :fq "Telescope quickfix")
|
||||
(util.lnnoremap :fl "Telescope loclist")
|
||||
(util.lnnoremap :fsa "Telescope lsp_code_actions")
|
||||
(util.lnnoremap :fsi "Telescope lsp_implementations")
|
||||
(util.lnnoremap :fsr "Telescope lsp_references")
|
||||
(util.lnnoremap :fsS "Telescope lsp_document_symbols")
|
||||
(util.lnnoremap :fss "Telescope lsp_workspace_symbols")
|
||||
6
nvim/.config/nvim/fnl/dotfiles/plugin/treesitter.fnl
Normal file
6
nvim/.config/nvim/fnl/dotfiles/plugin/treesitter.fnl
Normal file
@@ -0,0 +1,6 @@
|
||||
(module dotfiles.plugin.treesitter
|
||||
{autoload {treesitter nvim-treesitter.configs}})
|
||||
|
||||
(treesitter.setup
|
||||
{:highlight {:enable true
|
||||
:additional_vim_regex_highlighting false}})
|
||||
116
nvim/.config/nvim/fnl/dotfiles/plugins.fnl
Normal file
116
nvim/.config/nvim/fnl/dotfiles/plugins.fnl
Normal file
@@ -0,0 +1,116 @@
|
||||
(module dotfiles.plugins
|
||||
{autoload {nvim aniseed.nvim
|
||||
a aniseed.core
|
||||
;; util dotfiles.util
|
||||
packer packer
|
||||
|
||||
}
|
||||
;; require {minpac minpac}
|
||||
})
|
||||
|
||||
|
||||
(defn safe-require-plugin-config [name]
|
||||
(let [(ok? val-or-err) (pcall require (.. :dotfiles.plugin. name))]
|
||||
(when (not ok?)
|
||||
(print (.. "dotfiles error: " val-or-err)))))
|
||||
|
||||
(defn- use [pkgs]
|
||||
"Iterates through the arguments as pairs and calls packer's use function for
|
||||
each of them. Works around Fennel not liking mixed associative and sequential
|
||||
tables as well."
|
||||
(packer.startup
|
||||
(fn [use]
|
||||
(each [name opts (pairs pkgs)]
|
||||
(-?> (. opts :mod) (safe-require-plugin-config))
|
||||
(use (a.assoc opts 1 name))
|
||||
))))
|
||||
|
||||
|
||||
(def- packages
|
||||
{
|
||||
:wbthomason/packer.nvim {:mod :packer}
|
||||
:airblade/vim-gitgutter {} ; Git
|
||||
:clojure-vim/vim-jack-in {} ; Conjure support - jack-in with nrepl dependencies
|
||||
:thecontinium/asyncomplete-conjure.vim {}
|
||||
:tpope/vim-dispatch {} ; Conjure support - jack-in with nrepl dependencies
|
||||
:Olical/conjure {} ; Clojure
|
||||
:Olical/aniseed {}
|
||||
:Olical/fennel.vim {} ; Fennel
|
||||
:neovim/nvim-lspconfig {:mod :lspconfig} ; NeoVim lsp config
|
||||
:kabouzeid/nvim-lspinstall {} ; NeoVim lsp server installs
|
||||
:airblade/vim-gitgutter {} ; Git
|
||||
:kovisoft/paredit {}
|
||||
:luochen1990/rainbow {}
|
||||
:jiangmiao/auto-pairs {} ; backets, parens, and quotes in pairs
|
||||
:nvim-treesitter/nvim-treesitter {:run ":TSUpdate" :mod :treesitter}
|
||||
:hashivim/vim-terraform {} ; Terraform
|
||||
:skywind3000/asyncrun.vim {} ; :AsyncRun
|
||||
:tpope/vim-classpath {}
|
||||
:tpope/vim-fugitive {} ; Git
|
||||
:tpope/vim-git {} ; Git Commit Message
|
||||
:tpope/vim-pathogen {}
|
||||
:tpope/vim-surround {}
|
||||
:tpope/vim-repeat {}
|
||||
:tpope/vim-unimpaired {}
|
||||
:tpope/vim-vinegar {}
|
||||
:radenling/vim-dispatch-neovim {} ; Clojure
|
||||
:nvim-telescope/telescope.nvim {:requires [[:nvim-lua/popup.nvim] [:nvim-lua/plenary.nvim]] :mod :telescope}
|
||||
|
||||
}
|
||||
|
||||
; :tpope/vim-fireplace {} ; Clojure
|
||||
; :tpope/vim-sexp-mappings-for-regular-people {}
|
||||
)
|
||||
|
||||
(use packages)
|
||||
|
||||
;;(nu.fn-bridge
|
||||
;; :DeleteHiddenBuffers
|
||||
;; :dotfiles.mapping :delete-hidden-buffers)
|
||||
|
||||
; " Define user commands for updating/cleaning the plugins.
|
||||
; " Each of them loads minpac, reloads .vimrc to register the
|
||||
; information of plugins, then performs the task.
|
||||
; command! PackUpdate call PackInit() | call minpac#update('', {'do': 'call minpac#status()'})
|
||||
; command! PackClean call PackInit() | call minpac#clean()
|
||||
; command! PackStatus packadd minpac | call minpac#status()
|
||||
|
||||
|
||||
;; call minpac#add('dense-analysis/ale') " Linting
|
||||
;; call minpac#add('editorconfig/editorconfig-vim')
|
||||
;; call minpac#add('elixir-lang/vim-elixir') " Elixir
|
||||
;; call minpac#add('ElmCast/elm-vim') " Elm
|
||||
;; call minpac#add('jgdavey/tslime.vim', {'branch': 'main'}) " Send to Tmux
|
||||
;; call minpac#add('leafgarland/typescript-vim') " TypeScript
|
||||
;; call minpac#add('idris-hackers/idris-vim') " Idris
|
||||
;; call minpac#add('mxw/vim-jsx') " React JSX support
|
||||
;; call minpac#add('neomake/neomake') " Linting/Make
|
||||
;; call minpac#add('nvie/vim-flake8') " Python
|
||||
;; call minpac#add('pangloss/vim-javascript') " JavaScript
|
||||
;; call minpac#add('prabirshrestha/async.vim') " Vim/NeoVim async normalization
|
||||
;; call minpac#add('prabirshrestha/asyncomplete.vim') " Language Server Protocol
|
||||
;; call minpac#add('raichoo/purescript-vim') " PureScript
|
||||
;; call minpac#add('reasonml-editor/vim-reason') " ReasonML
|
||||
;; call minpac#add('thoughtbot/vim-rspec')
|
||||
;; call minpac#add('vim-erlang/erlang-motions.vim') " Erlang
|
||||
;; call minpac#add('vim-erlang/vim-erlang-runtime') " Erlang
|
||||
;; call minpac#add('vim-erlang/vim-erlang-compiler') " Erlang
|
||||
;; call minpac#add('vim-erlang/vim-erlang-omnicomplete') " Erlang
|
||||
;; call minpac#add('vim-erlang/vim-erlang-tags') " Erlang
|
||||
;; call minpac#add('vim-erlang/vim-erlang-skeletons') " Erlang
|
||||
;; call minpac#add('vim-ruby/vim-ruby') " Ruby
|
||||
;; call minpac#add('vim-syntastic/syntastic')
|
||||
;; call minpac#add('vim-jp/syntax-vim-ex')
|
||||
;; call minpac#add('tsandall/vim-rego') " Rego
|
||||
;;
|
||||
|
||||
;; " call minpac#add('guns/vim-clojure-static') " Clojure
|
||||
;; "" call minpac#add('guns/vim-sexp') " Lisps
|
||||
;; " call minpac#add('ncm2/float-preview.nvim') " autocomplete with preview
|
||||
;; " call minpac#add('Shougo/deoplete.nvim') " async completion
|
||||
;; " call minpac#add('prabirshrestha/vim-lsp') " Language Server Protocol
|
||||
;; " call minpac#add('rhysd/vim-lsp-ale') " vim-lsp + ALE
|
||||
;; " call minpac#add('mattn/vim-lsp-settings') " Generic LSP Server install and settings for all languages
|
||||
;; " call minpac#add('prabirshrestha/asyncomplete-lsp.vim') " Language Server Protocol
|
||||
;; " call minpac#add('prabirshrestha/vim-lsp') " Language Server Protocol
|
||||
;; " call minpac#add('rhysd/vim-lsp-ale') " vim-lsp + ALE
|
||||
21
nvim/.config/nvim/fnl/dotfiles/util.fnl
Normal file
21
nvim/.config/nvim/fnl/dotfiles/util.fnl
Normal file
@@ -0,0 +1,21 @@
|
||||
(module dotfiles.util
|
||||
{autoload
|
||||
{a aniseed.core}
|
||||
require
|
||||
{nvim aniseed.nvim}})
|
||||
|
||||
|
||||
(defn noremap [mode from to opts]
|
||||
(let [map-opts {:noremap true :silent true}
|
||||
to (.. ":" to "<cr>")
|
||||
buff-num (a.get opts :buff-num)]
|
||||
|
||||
(if (or (a.get opts :local?) buff-num )
|
||||
(nvim.buf_set_keymap (or buff-num 0) mode from to map-opts)
|
||||
(nvim.set_keymap mode from to map-opts))))
|
||||
|
||||
(defn nnoremap [from to opts]
|
||||
(noremap :n from to opts))
|
||||
|
||||
(defn lnnoremap [from to]
|
||||
(nnoremap (.. "<leader>" from) to))
|
||||
@@ -1,10 +0,0 @@
|
||||
(module my_vim.init
|
||||
{autoload
|
||||
{a aniseed.core}
|
||||
require
|
||||
{nvim aniseed.nvim}})
|
||||
|
||||
(nvim.ex.source "~/.vimrc")
|
||||
|
||||
(require :my_nvim.core)
|
||||
(require :my_nvim.mapping)
|
||||
@@ -1,111 +1,41 @@
|
||||
-- Source init.vim for migration of vimrc to neovim
|
||||
vim.fn.sign_define("LspDiagnosticsSignError",
|
||||
{texthl = "LspDiagnosticsSignError", text = "☢️", numhl = "LspDiagnosticsSignError"})
|
||||
vim.fn.sign_define("LspDiagnosticsSignWarning",
|
||||
{texthl = "LspDiagnosticsSignWarning", text = "⚠️", numhl = "LspDiagnosticsSignWarning"})
|
||||
vim.fn.sign_define("LspDiagnosticsSignHint",
|
||||
{texthl = "LspDiagnosticsSignHint", text = "🔎", numhl = "LspDiagnosticsSignHint"})
|
||||
vim.fn.sign_define("LspDiagnosticsSignInformation",
|
||||
{texthl = "LspDiagnosticsSignInformation", text = "ℹ️", numhl = "LspDiagnosticsSignInformation"})
|
||||
local execute = vim.api.nvim_command
|
||||
local fn = vim.fn
|
||||
|
||||
local nvim_lsp = require('lspconfig')
|
||||
local pack_path = fn.stdpath("data") .. "/site/pack"
|
||||
local fmt = string.format
|
||||
|
||||
function LspExecuteCommand(cmd, ...)
|
||||
arguments = {vim.uri_from_bufnr(0), vim.api.nvim_win_get_cursor(0)[1] - 1, vim.api.nvim_win_get_cursor(0)[2] -1}
|
||||
for _,a in pairs({...}) do table.insert(arguments, a) end
|
||||
vim.lsp.buf.execute_command({command = cmd, arguments = arguments})
|
||||
end
|
||||
|
||||
-- Use an on_attach function to only map the following keys
|
||||
-- after the language server attaches to the current buffer
|
||||
local on_attach = function(client, bufnr)
|
||||
local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end
|
||||
local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end
|
||||
|
||||
--Enable completion triggered by <c-x><c-o>
|
||||
buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc')
|
||||
|
||||
-- Mappings.
|
||||
local opts = { noremap=true, silent=true }
|
||||
|
||||
-- See `:help vim.lsp.*` for documentation on any of the below functions
|
||||
buf_set_keymap('n', 'gD', '<Cmd>lua vim.lsp.buf.declaration()<CR>', opts)
|
||||
buf_set_keymap('n', 'gd', '<Cmd>lua vim.lsp.buf.definition()<CR>', opts)
|
||||
buf_set_keymap('n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<CR>', opts)
|
||||
buf_set_keymap('n', 'gr', '<cmd>lua vim.lsp.buf.references()<CR>', opts)
|
||||
buf_set_keymap('n', 'gs', '<Cmd>lua vim.lsp.buf.document_symbol()<CR>', opts)
|
||||
buf_set_keymap('n', 'gS', '<Cmd>lua vim.lsp.buf.workspace_symbol()<CR>', opts)
|
||||
buf_set_keymap('n', 'gt', '<cmd>lua vim.lsp.buf.type_definition()<CR>', opts)
|
||||
buf_set_keymap('n', 'K', '<Cmd>lua vim.lsp.buf.hover()<CR>', opts)
|
||||
buf_set_keymap('n', '[g', '<cmd>lua vim.lsp.diagnostic.goto_prev()<CR>', opts)
|
||||
buf_set_keymap('n', ']g', '<cmd>lua vim.lsp.diagnostic.goto_next()<CR>', opts)
|
||||
buf_set_keymap('n', '<C-k>', '<cmd>lua vim.lsp.buf.signature_help()<CR>', opts)
|
||||
buf_set_keymap('n', '<leader>wa', '<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>', opts)
|
||||
buf_set_keymap('n', '<leader>wr', '<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>', opts)
|
||||
buf_set_keymap('n', '<leader>wl', '<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>', opts)
|
||||
buf_set_keymap('n', '<leader>rn', '<cmd>lua vim.lsp.buf.rename()<CR>', opts)
|
||||
buf_set_keymap('n', '<leader>ca', '<cmd>lua vim.lsp.buf.code_action()<CR>', opts)
|
||||
buf_set_keymap('n', '<leader>cn', "<cmd>lua LspExecuteCommand('clean-ns')<CR>", opts)
|
||||
buf_set_keymap('n', '<leader>e', '<cmd>lua vim.lsp.diagnostic.show_line_diagnostics()<CR>', opts)
|
||||
buf_set_keymap('n', '<leader>ref', "<cmd>lua LspExecuteCommand('extract-function', vim.api.nvim_eval(\"input('Function name: ')\"))<CR>", opts)
|
||||
buf_set_keymap('x', '<leader>ref', "<cmd>lua LspExecuteCommand('extract-function', vim.api.nvim_eval(\"input('Function name: ')\"))<CR>", opts)
|
||||
buf_set_keymap('n', '<leader>q', '<cmd>lua vim.lsp.diagnostic.set_loclist()<CR>', opts)
|
||||
buf_set_keymap('n', '<leader>fa', "<cmd>lua vim.lsp.buf.formatting_sync()<CR>", opts)
|
||||
buf_set_keymap('x', '<leader>fa', "<cmd>lua vim.lsp.buf.formatting_sync()<CR>", opts)
|
||||
buf_set_keymap('n', '<leader>ic', "<cmd>lua vim.lsp.buf.incoming_calls()<CR>", opts)
|
||||
buf_set_keymap('x', '<leader>ic', "<cmd>lua vim.lsp.buf.incoming_calls()<CR>", opts)
|
||||
buf_set_keymap('n', '<leader>id', "<cmd>lua LspExecuteCommand('inline-symbol')<CR>", opts)
|
||||
buf_set_keymap('x', '<leader>id', "<cmd>lua LspExecuteCommand('inline-symbol')<CR>", opts)
|
||||
buf_set_keymap('n', '<leader>il', "<cmd>lua LspExecuteCommand('introduce-let', vim.api.nvim_eval(\"input('Binding name: ')\"))<CR>", opts)
|
||||
buf_set_keymap('x', '<leader>il', "<cmd>lua LspExecuteCommand('introduce-let', vim.api.nvim_eval(\"input('Binding name: ')\"))<CR>", opts)
|
||||
buf_set_keymap('n', '<leader>m2l', "<cmd>lua LspExecuteCommand('move-to-let', vim.api.nvim_eval(\"input('Binding name: ')\"))<CR>", opts)
|
||||
buf_set_keymap('x', '<leader>m2l', "<cmd>lua LspExecuteCommand('move-to-let', vim.api.nvim_eval(\"input('Binding name: ')\"))<CR>", opts)
|
||||
|
||||
vim.api.nvim_command[[autocmd BufWritePre <buffer> lua vim.lsp.buf.formatting_sync()]]
|
||||
-- vim.api.nvim_command[[autocmd BufWritePre <buffer> lua vim.lsp.buf_request_sync(vim.api.nvim_get_current_buf(), 'workspace/executeCommand', {command = 'clean-ns', arguments = {vim.uri_from_bufnr(0), vim.api.nvim_win_get_cursor(0)[1], vim.api.nvim_win_get_cursor(0)[2]}, title = 'Clean Namespace'})]]
|
||||
|
||||
vim.api.nvim_command[[lua print("Lsp Client Attached.")]]
|
||||
end
|
||||
|
||||
|
||||
-- vim.api.nvim_set_keymap('n', '<leader>li', '<Cmd>LspInfo<CR>', { noremap=true, silent=true })
|
||||
|
||||
|
||||
local function setup_servers()
|
||||
require'lspinstall'.setup()
|
||||
local servers = require'lspinstall'.installed_servers()
|
||||
for _, server in pairs(servers) do
|
||||
require'lspconfig'[server].setup{
|
||||
on_attach = on_attach,
|
||||
flags = {
|
||||
debounce_text_changes = 150,
|
||||
}
|
||||
}
|
||||
function ensure (user, repo)
|
||||
-- Ensures a given github.com/USER/REPO is cloned in the pack/packer/start directory.
|
||||
local install_path = fmt("%s/packer/start/%s", pack_path, repo, repo)
|
||||
if fn.empty(fn.glob(install_path)) > 0 then
|
||||
execute(fmt("!git clone https://github.com/%s/%s %s", user, repo, install_path))
|
||||
execute(fmt("packadd %s", repo))
|
||||
end
|
||||
end
|
||||
|
||||
setup_servers()
|
||||
-- Bootstrap essential plugins required for installing and loading the rest.
|
||||
ensure("wbthomason", "packer.nvim")
|
||||
ensure("Olical", "aniseed")
|
||||
|
||||
-- Automatically reload after `:LspInstall <server>` so we don't have to restart neovim
|
||||
require'lspinstall'.post_install_hook = function ()
|
||||
setup_servers() -- reload installed servers
|
||||
vim.cmd("bufdo e") -- this triggers the FileType autocmd that starts the server
|
||||
end
|
||||
-- Enable Aniseed's automatic compilation and loading of Fennel source code.
|
||||
vim.g["aniseed#env"] = {
|
||||
module = "dotfiles.init",
|
||||
compile = true
|
||||
}
|
||||
|
||||
|
||||
-- require'nvim-treesitter.configs'.setup {
|
||||
-- ensure_installed = "all", -- one of "all", "maintained" (parsers with maintainers), or a list of languages
|
||||
-- -- ignore_install = { "javascript" }, -- List of parsers to ignore installing
|
||||
-- -- highlight = {
|
||||
-- -- enable = true, -- false will disable the whole extension
|
||||
-- -- disable = { "c", "rust" }, -- list of language that will be disabled
|
||||
-- -- -- Setting this to true will run `:h syntax` and tree-sitter at the same time.
|
||||
-- -- -- Set this to `true` if you depend on 'syntax' being enabled (like for indentation).
|
||||
-- -- -- Using this option may slow down your editor, and you may see some duplicate highlights.
|
||||
-- -- -- Instead of true it can also be a list of languages
|
||||
-- -- additional_vim_regex_highlighting = false,
|
||||
-- -- },
|
||||
-- }
|
||||
--
|
||||
--
|
||||
vim.g["aniseed#env"] = { module = "my_nvim.init" }
|
||||
-- -- require'nvim-treesitter.configs'.setup {
|
||||
-- -- ensure_installed = "all", -- one of "all", "maintained" (parsers with maintainers), or a list of languages
|
||||
-- -- -- ignore_install = { "javascript" }, -- List of parsers to ignore installing
|
||||
-- -- -- highlight = {
|
||||
-- -- -- enable = true, -- false will disable the whole extension
|
||||
-- -- -- disable = { "c", "rust" }, -- list of language that will be disabled
|
||||
-- -- -- -- Setting this to true will run `:h syntax` and tree-sitter at the same time.
|
||||
-- -- -- -- Set this to `true` if you depend on 'syntax' being enabled (like for indentation).
|
||||
-- -- -- -- Using this option may slow down your editor, and you may see some duplicate highlights.
|
||||
-- -- -- -- Instead of true it can also be a list of languages
|
||||
-- -- -- additional_vim_regex_highlighting = false,
|
||||
-- -- -- },
|
||||
-- -- }
|
||||
-- --
|
||||
-- --
|
||||
-- --
|
||||
|
||||
Reference in New Issue
Block a user