nvim - replace aniseed.util fn-bridge with vim.api call

This commit is contained in:
2025-04-29 10:08:21 -05:00
parent 8186744af8
commit 07eb5d3b94
6 changed files with 267 additions and 274 deletions

View File

@@ -1,8 +1,8 @@
(module dotfiles.core {autoload {a aniseed.core} (module dotfiles.core
require {anenv aniseed.env {autoload {a aniseed.core}
nvim aniseed.nvim require {anenv aniseed.env nvim aniseed.nvim}})
nu aniseed.nvim.util
u dotfiles.util}}) (local u (require :dotfiles.util))
(nvim.ex.set :shortmess+=c) (nvim.ex.set :shortmess+=c)
@@ -10,86 +10,90 @@
(nvim.ex.set :path+=**) (nvim.ex.set :path+=**)
(nvim.ex.set "wildignore+=*.o,*.obj,.git,*.rbc,*.class,.svn,vendor/gems/*") (nvim.ex.set "wildignore+=*.o,*.obj,.git,*.rbc,*.class,.svn,vendor/gems/*")
(defn- safe-source [filename] (defn- safe-source
(let [glob (nvim.fn.glob filename)] [filename]
(if (not (a.empty? glob)) (let [glob (nvim.fn.glob filename)]
(nvim.ex.source filename)))) (if (not (a.empty? glob))
(nvim.ex.source filename))))
; (a.map safe-source ["~/.vimrc" "~/.vimrc.local"]) ; (a.map safe-source ["~/.vimrc" "~/.vimrc.local"])
(def- backup-dir (.. (nvim.fn.glob :$HOME) :/.vim/backup)) (def- backup-dir (.. (nvim.fn.glob :$HOME) :/.vim/backup))
(def- undo-dir (.. (nvim.fn.glob :$HOME) :/.vim/backup)) (def- undo-dir (.. (nvim.fn.glob :$HOME) :/.vim/backup))
(def- on-opts [:autoindent (def- on-opts
:autoread [:autoindent
:expandtab :autoread
:exrc :expandtab
; allow project level (neo)vim files :exrc
:hlsearch ; allow project level (neo)vim files
:ignorecase :hlsearch
:incsearch :ignorecase
:number :incsearch
:ruler :number
:secure :ruler
:shiftround :secure
; When at 3 spaces and I hit >>, go to 4, not 5. :shiftround
:showcmd ; When at 3 spaces and I hit >>, go to 4, not 5.
; shows (parital) command in the status line :showcmd
:showmatch ; shows (parital) command in the status line
:smartcase :showmatch
:splitbelow :smartcase
:splitright :splitbelow
:termguicolors :splitright
:title :termguicolors
:undofile :title
:wildmenu]) :undofile
:wildmenu])
(def- val-based-opts {; :t_Co 256 (def- val-based-opts
:laststatus 2 {; :t_Co 256
:encoding :utf-8 :laststatus 2
:history 500 :encoding :utf-8
:redrawtime 5000 :history 500
:scrolloff 3 :redrawtime 5000
:guifont :Hasklig :scrolloff 3
:guifontwide :Hasklig :guifont :Hasklig
:background :dark :guifontwide :Hasklig
:backupdir backup-dir :background :dark
:directory backup-dir :backupdir backup-dir
;Don't clutter my dirs up with swp and tmp files :directory backup-dir
:grepprg "ag --vimgrep" ;Don't clutter my dirs up with swp and tmp files
; Use Silver Searcher instead of grep :grepprg "ag --vimgrep"
:tags :tags ; Use Silver Searcher instead of grep
:updatetime 300 :tags :tags
; per coc.vim for diagnostic messages :updatetime 300
:signcolumn "auto:1-3" ; per coc.vim for diagnostic messages
:colorcolumn [81 100] :signcolumn "auto:1-3"
:cmdheight 2 :colorcolumn [81 100]
; Better display for messages :cmdheight 2
:undodir undo-dir ; Better display for messages
:undolevels 1000 :undodir undo-dir
:undoreload 10000 :undolevels 1000
:foldmethod :expr :undoreload 10000
:foldexpr "nvim_treesitter#foldexpr()" :foldmethod :expr
:foldlevelstart 100 :foldexpr "nvim_treesitter#foldexpr()"
:foldlevel 99 :foldlevelstart 100
:tabstop 2 :foldlevel 99
:shiftwidth 2 :tabstop 2
:softtabstop 2 :shiftwidth 2
:mouse "" :softtabstop 2
:list true :mouse ""
:listchars "tab:➥\\ ,trail:·,nbsp:■" :list true
:backspace "indent,eol,start" :listchars "tab:➥\\ ,trail:·,nbsp:■"
;allow backspacing over everything in insert mode :backspace "indent,eol,start"
:wildmode "list:longest,list:full" ;allow backspacing over everything in insert mode
:wrap false}) :wildmode "list:longest,list:full"
:wrap false})
(def- append-val-opts {:diffopt "algorithm:patience"}) (def- append-val-opts {:diffopt "algorithm:patience"})
(defn- set-opt [[opt val]] (tset vim.opt (a.str opt) val)) (defn- set-opt [[opt val]] (tset vim.opt (a.str opt) val))
(defn- set-opt+ [[opt val]] (defn- set-opt+
(let [existing-opt-val (a.get nvim.o opt)] [[opt val]]
(tset vim.opt (a.str opt) (a.str existing-opt-val "," val)))) (let [existing-opt-val (a.get nvim.o opt)]
(tset vim.opt (a.str opt) (a.str existing-opt-val "," val))))
(defn- set-opt-on [opt] (set-opt [opt true])) (defn- set-opt-on [opt] (set-opt [opt true]))
@@ -109,15 +113,14 @@
; ;
; (nvim.fn.glob "~/.vimrc.local") ; (nvim.fn.glob "~/.vimrc.local")
(defn make-fennel-scratch [] (fn make-fennel-scratch []
(nvim.command "new | setlocal bt=nofile bh=wipe nobl noswapfile nu filetype=fennel")) (vim.cmd "new | setlocal bt=nofile bh=wipe nobl noswapfile nu filetype=fennel"))
(nu.fn-bridge :FennelScratchBuffer :dotfiles.core :make-fennel-scratch (vim.api.nvim_create_user_command :FennelScratchBuffer make-fennel-scratch {})
{:return false})
(u.nnoremap :<leader>fsb ":call FennelScratchBuffer ()<CR>") (u.nnoremap :<leader>fsb ":call FennelScratchBuffer ()<CR>")
(defn compile-fnl [] (print :recompiling) (fn compile-fnl [] (print :recompiling)
(anenv.init {:force true :init :dotfiles.init})) (anenv.init {:force true :init :dotfiles.init}))
(nu.fn-bridge :AniseedCompile :dotfiles.core :compile-fnl {:return false}) (vim.api.nvim_create_user_command :AniseedCompile compile-fnl {})

View File

@@ -4,7 +4,6 @@
nvim aniseed.nvim nvim aniseed.nvim
lsp vim.lsp lsp vim.lsp
lspconfig lspconfig lspconfig lspconfig
nu aniseed.nvim.util
mason dotfiles.plugin.mason mason dotfiles.plugin.mason
cmp_nvim_lsp cmp_nvim_lsp}}) cmp_nvim_lsp cmp_nvim_lsp}})
@@ -14,139 +13,138 @@
(defn xbufmap [from to] (bufmap :x from to)) (defn xbufmap [from to] (bufmap :x from to))
(vim.diagnostic.config (vim.diagnostic.config {:signs {:text {vim.diagnostic.severity.ERROR "☢️"
{:signs {:text {vim.diagnostic.severity.ERROR "" vim.diagnostic.severity.WARN ""
vim.diagnostic.severity.WARN "" vim.diagnostic.severity.INFO ""
vim.diagnostic.severity.INFO "" vim.diagnostic.severity.HINT "🔎"}
vim.diagnostic.severity.HINT "🔎"} ;; :linehl {vim.diagnostic.severity.ERROR :ErrorMsg}
:linehl {vim.diagnostic.severity.ERROR :ErrorMsg} ;; :numhl {vim.diagnostic.severity.WARN :WarningMsg}
:numhl {vim.diagnostic.severity.WARN :WarningMsg}}}) }})
(def core-nmappings (def core-nmappings
{:gd "lua vim.lsp.buf.definition()" {:gd "lua vim.lsp.buf.definition()"
:gD "lua vim.lsp.buf.declaration()" :gD "lua vim.lsp.buf.declaration()"
:gi "lua vim.lsp.buf.implementation()" :gi "lua vim.lsp.buf.implementation()"
:gr "lua vim.lsp.buf.references()" :gr "lua vim.lsp.buf.references()"
:K "lua vim.lsp.buf.hover()" :K "lua vim.lsp.buf.hover()"
"[g" "lua vim.diagnostic.goto_prev()" "[g" "lua vim.diagnostic.goto_prev()"
"]g" "lua vim.diagnostic.goto_next()" "]g" "lua vim.diagnostic.goto_next()"
;:<c-k> "lua vim.lsp.buf.signature_help()" ;:<c-k> "lua vim.lsp.buf.signature_help()"
:<leader>ca "lua vim.lsp.buf.code_action()" :<leader>ca "lua vim.lsp.buf.code_action()"
:<leader>cl "lua vim.lsp.codelens.run()" :<leader>cl "lua vim.lsp.codelens.run()"
:<leader>ic "lua vim.lsp.buf.incoming_calls()" :<leader>ic "lua vim.lsp.buf.incoming_calls()"
;; TODO: think of new mapping; conficts with org mode ;; TODO: think of new mapping; conficts with org mode
;; :<leader>oc "lua vim.lsp.buf.outgoing_calls()" ;; :<leader>oc "lua vim.lsp.buf.outgoing_calls()"
:<leader>sld "lua vim.diagnostic.open_float(nil, {source = 'always'})" :<leader>sld "lua vim.diagnostic.open_float(nil, {source = 'always'})"
:<leader>rn "lua vim.lsp.buf.rename()" :<leader>rn "lua vim.lsp.buf.rename()"
:<leader>fa "lua vim.lsp.buf.format()"}) :<leader>fa "lua vim.lsp.buf.format()"})
(def client-nmappings (def client-nmappings
{:clojure_lsp {:<leader>cn "call LspExecuteCommand('clean-ns')" {:clojure_lsp {:<leader>cn "call LspExecuteCommand('clean-ns')"
:<leader>ref "call LspExecuteCommand('extract-function', input('Function name: '))" :<leader>ref "call LspExecuteCommand('extract-function', input('Function name: '))"
:<leader>id "call LspExecuteCommand('inline-symbol')" :<leader>id "call LspExecuteCommand('inline-symbol')"
:<leader>il "call LspExecuteCommand('introduce-let', input('Binding name: '))" :<leader>il "call LspExecuteCommand('introduce-let', input('Binding name: '))"
:<leader>m2l "call LspExecuteCommand('move-to-let', input('Binding name: '))"}}) :<leader>m2l "call LspExecuteCommand('move-to-let', input('Binding name: '))"}})
(def client-command-lnmappings (def client-command-lnmappings
{:clojure_lsp {:ai [:add-import-to-namespace {:clojure_lsp {:ai [:add-import-to-namespace ["input('Namespace name: ')"]]
["input('Namespace name: ')"]] :am [:add-missing-libspec []]
:am [:add-missing-libspec []] :as [:add-require-suggestion
:as [:add-require-suggestion ["input('Namespace name: ')"
["input('Namespace name: ')" "input('Namespace as: ')"
"input('Namespace as: ')" "input('Namespace name: ')"]]
"input('Namespace name: ')"]] :cc [:cycle-coll []]
:cc [:cycle-coll []] :cn [:clean-ns []]
:cn [:clean-ns []] :cp [:cycle-privacy []]
:cp [:cycle-privacy []] :ct [:create-test []]
:ct [:create-test []] :df [:drag-forward []]
:df [:drag-forward []] :db [:drag-backward []]
:db [:drag-backward []] :df [:drag-forward []]
:df [:drag-forward []] :dk [:destructure-keys []]
:dk [:destructure-keys []] :ed [:extract-to-def ["input('Definition name: ')"]]
:ed [:extract-to-def ["input('Definition name: ')"]] :ef [:extract-function ["input('Function name: ')"]]
:ef [:extract-function ["input('Function name: ')"]] :el [:expand-let []]
:el [:expand-let []] :fe [:create-function []]
:fe [:create-function []] :il [:introduce-let ["input('Binding name: ')"]]
:il [:introduce-let ["input('Binding name: ')"]] :is [:inline-symbol []]
:is [:inline-symbol []] :ma [:resolve-macro-as []]
:ma [:resolve-macro-as []] :mf [:move-form ["input('File name: ')"]]
:mf [:move-form ["input('File name: ')"]] :ml [:move-to-let ["input('Binding name: ')"]]
:ml [:move-to-let ["input('Binding name: ')"]] :pf [:promote-fn ["input('Function name: ')"]]
:pf [:promote-fn ["input('Function name: ')"]] :sc [:change-collection ["input('Collection type: ')"]]
:sc [:change-collection ["input('Collection type: ')"]] :sm [:sort-map []]
:sm [:sort-map []] :tf [:thread-first-all []]
:tf [:thread-first-all []] :tF [:thread-first []]
:tF [:thread-first []] :tl [:thread-last-all []]
:tl [:thread-last-all []] :tL [:thread-last []]
:tL [:thread-last []] :ua [:unwind-all []]
:ua [:unwind-all []] :uw [:unwind-thread []]}})
:uw [:unwind-thread []]}})
(def server-specific-opts {}) (def server-specific-opts {})
(defn bind-client-mappings [client] (defn bind-client-mappings
(let [client-name (a.get client :name) [client]
mappings (a.get client-nmappings client-name) (let [client-name (a.get client :name)
command-lnmappings (a.get client-command-lnmappings client-name)] mappings (a.get client-nmappings client-name)
(when mappings command-lnmappings (a.get client-command-lnmappings client-name)]
(each [mapping cmd (pairs mappings)] (when mappings
(nbufmap mapping cmd))) (each [mapping cmd (pairs mappings)]
(when command-lnmappings (nbufmap mapping cmd)))
(each [lnmapping command-mapping (pairs command-lnmappings)] (when command-lnmappings
(let [lsp-cmd (a.first command-mapping) (each [lnmapping command-mapping (pairs command-lnmappings)]
opts-str (accumulate [s "" i opt (ipairs (a.second command-mapping))] (let [lsp-cmd (a.first command-mapping)
(.. s ", " opt)) opts-str (accumulate [s "" i opt (ipairs (a.second command-mapping))]
mapping (.. :<leader> lnmapping) (.. s ", " opt))
cmd (.. "call LspExecuteCommand('" lsp-cmd "'" opts-str ")")] mapping (.. :<leader> lnmapping)
(nbufmap mapping cmd)))))) cmd (.. "call LspExecuteCommand('" lsp-cmd "'" opts-str ")")]
(nbufmap mapping cmd))))))
(defn on_attach [client bufnr] (defn on_attach
(each [mapping cmd (pairs core-nmappings)] [client bufnr]
(nbufmap mapping cmd)) ; x mode mappings (each [mapping cmd (pairs core-nmappings)]
(xbufmap :<leader>fa "lua vim.lsp.buf.format()") (nbufmap mapping cmd)) ; x mode mappings
; -- buf_set_keymap('n', 'gs', '<Cmd>lua vim.lsp.buf.document_symbol()<CR>', opts) (xbufmap :<leader>fa "lua vim.lsp.buf.format()") ; -- 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', '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', '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>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>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>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>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('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('x', '<leader>ic', "<cmd>lua vim.lsp.buf.incoming_calls()<CR>", opts)
(nvim.buf_set_option 0 :omnifunc "v:lua.vim.lsp.omnifunc") (nvim.buf_set_option 0 :omnifunc "v:lua.vim.lsp.omnifunc")
(bind-client-mappings client) (bind-client-mappings client)
(if client.server_capabilities.documentFormattingProvider (if client.server_capabilities.documentFormattingProvider
(nvim.ex.autocmd :BufWritePre :<buffer> ":lua vim.lsp.buf.format()")) (nvim.ex.autocmd :BufWritePre :<buffer> ":lua vim.lsp.buf.format()")) ; (nvim.ex.autocmd "BufEnter,CursorHold,InsertLeave" :<buffer> :lua "vim.lsp.codelens.refresh()")
; (nvim.ex.autocmd "BufEnter,CursorHold,InsertLeave" :<buffer> :lua "vim.lsp.codelens.refresh()") ; client autocmds ; -- 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(1), vim.api.nvim_win_get_cursor(0)[1], vim.api.nvim_win_get_cursor(0)[2]}, title = 'Clean Namespace'})]]
; client autocmds (print "LSP Client Attached."))
; -- 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(1), vim.api.nvim_win_get_cursor(0)[1], vim.api.nvim_win_get_cursor(0)[2]}, title = 'Clean Namespace'})]]
(print "LSP Client Attached."))
(def base-server-opts (def base-server-opts
(let [capabilities (cmp_nvim_lsp.default_capabilities (lsp.protocol.make_client_capabilities))] (let [capabilities (cmp_nvim_lsp.default_capabilities (lsp.protocol.make_client_capabilities))]
{: on_attach : capabilities :flags {:debounce_text_changes 150}})) {: on_attach : capabilities :flags {:debounce_text_changes 150}}))
(defn default-server-handler [server-name] (defn default-server-handler
(let [specific-opts (a.get server-specific-opts server-name {}) [server-name]
server (a.get lspconfig server-name) (let [specific-opts (a.get server-specific-opts server-name {})
server-opts (a.merge base-server-opts server-opts)] server (a.get lspconfig server-name)
(server.setup server-opts))) server-opts (a.merge base-server-opts server-opts)]
(server.setup server-opts)))
(defn lsp-execute-command [cmd ...] (defn lsp-execute-command
(let [buf-uri (vim.uri_from_bufnr 0) [cmd ...]
cursor (vim.api.nvim_win_get_cursor 0) (let [buf-uri (vim.uri_from_bufnr 0)
r (- (a.first cursor) 1) cursor (vim.api.nvim_win_get_cursor 0)
c (a.second cursor) r (- (a.first cursor) 1)
opts [buf-uri r c] c (a.second cursor)
args (a.concat opts [...])] opts [buf-uri r c]
(vim.lsp.buf.execute_command {:command cmd :arguments args}))) args (a.concat opts [...])]
(vim.lsp.buf.execute_command {:command cmd :arguments args})))
(mason.setup) (mason.setup)
(when-let [mason-lspconfig (require :mason-lspconfig)] (when-let [mason-lspconfig (require :mason-lspconfig)] (mason-lspconfig.setup)
(mason-lspconfig.setup) (mason-lspconfig.setup_handlers {1 default-server-handler}))
(mason-lspconfig.setup_handlers {1 default-server-handler}))
(u.nnoremap :<leader>li :LspInfo) (u.nnoremap :<leader>li :LspInfo)
(nu.fn-bridge :LspExecuteCommand :dotfiles.plugin.lspconfig
:lsp-execute-command {:return false}) (vim.api.nvim_create_user_command :LspExecuteCommand lsp-execute-command {})

View File

@@ -1,30 +1,27 @@
(module dotfiles.toggleterm (local toggleterm (require :toggleterm))
{autoload {a aniseed.core}
require {nvim aniseed.nvim
nu aniseed.nvim.util
toggleterm toggleterm}})
(toggleterm.setup { (toggleterm.setup {:open_mapping "<c-\\>"
:open_mapping :<c-\> :start_in_insert true
:start_in_insert true :insert_mappings true
:insert_mappings true ;; whether or not the open mapping applies in insert mode ;; whether or not the open mapping applies in insert mode
:terminal_mappings true ;; whether or not the open mapping applies in the opened terminals :terminal_mappings true
:persist_size true ;; whether or not the open mapping applies in the opened terminals
:persist_mode true ;; if set to true (default) the previous terminal mode will be remembered :persist_size true
:autochdir true :persist_mode true
}) ;; if set to true (default) the previous terminal mode will be remembered
:autochdir true})
(fn set-terminal-keymaps []
(defn set_terminal_keymaps [] (vim.keymap.set :t :<esc> "<C-\\><C-n>")
(vim.keymap.set :t :<esc> :<C-\><C-n>) (vim.keymap.set :t :jk "<C-\\><C-n>")
(vim.keymap.set :t :jk :<C-\><C-n>)
(vim.keymap.set :t :<C-h> "<Cmd>wincmd h<CR>") (vim.keymap.set :t :<C-h> "<Cmd>wincmd h<CR>")
(vim.keymap.set :t :<C-j> "<Cmd>wincmd j<CR>") (vim.keymap.set :t :<C-j> "<Cmd>wincmd j<CR>")
(vim.keymap.set :t :<C-k> "<Cmd>wincmd k<CR>") (vim.keymap.set :t :<C-k> "<Cmd>wincmd k<CR>")
(vim.keymap.set :t :<C-l> "<Cmd>wincmd l<CR>") (vim.keymap.set :t :<C-l> "<Cmd>wincmd l<CR>")
(vim.keymap.set :t :<C-w> :<C-\><C-n><C-w>)) (vim.keymap.set :t :<C-w> "<C-\\><C-n><C-w>"))
(vim.api.nvim_create_user_command :SetTerminalKeymaps set-terminal-keymaps {})
(nu.fn-bridge :SetTerminalKeymaps :dotfiles.toggleterm :set_terminal_keymaps {:return false}) (vim.api.nvim_create_autocmd [:TermOpen]
{:pattern "term://*"
(nvim.ex.autocmd :TermOpen "term://*" :call "SetTerminalKeymaps()") :callback set-terminal-keymaps})

View File

@@ -1,29 +1,31 @@
(module dotfiles.plugin.treesitter (local treesitter-configs (require :nvim-treesitter.configs))
{autoload {treesitter nvim-treesitter
ts_utils nvim-treesitter.ts_utils
treesitter-configs nvim-treesitter.configs}})
(treesitter-configs.setup (treesitter-configs.setup {:highlight {:enable true
{:highlight {:enable true ;; :additional_vim_regex_highlighting false
;; :additional_vim_regex_highlighting false :additional_vim_regex_highlighting [:org]}
:additional_vim_regex_highlighting [:org] :ensure_installed :all
} ; [:org]
:rainbow {:enable true
:ensure_installed :all ; [:org] :extended_mode true
; Also highlight non-bracket delimiters like html tags, boolean or table: lang -> boolean
:rainbow {:enable true :max_file_lines 10000
:extended_mode true ; Also highlight non-bracket delimiters like html tags, boolean or table: lang -> boolean ; Do not enable for files with more than 1000 lines, int
:max_file_lines 10000 ; Do not enable for files with more than 1000 lines, int :colors ["#dc322f"
:colors [ ; red
:#dc322f ; red "#b58900"
:#b58900 ; yellow ; yellow
:#d33682 ; magenta "#d33682"
:#859900 ; green ; magenta
:#2aa198 ; cyan "#859900"
:#268bd2 ; blue ; green
:#6c71c4 ; violet / brmagenta "#2aa198"
] ; table of hex strings ; cyan
} "#268bd2"
}) ; blue
"#6c71c4"
; violet / brmagenta
]
; table of hex strings
}})
; lua print(require('nvim-treesitter.parsers').get_parser():language_for_range({ require('nvim-treesitter.ts_utils').get_node_at_cursor():range() }):lang()) ; lua print(require('nvim-treesitter.parsers').get_parser():language_for_range({ require('nvim-treesitter.ts_utils').get_node_at_cursor():range() }):lang())

View File

@@ -1,22 +1,18 @@
(module dotfiles.terraform-helpers (module dotfiles.terraform-helpers
{autoload {a aniseed.core} {autoload {a aniseed.core}
require {anenv aniseed.env require {anenv aniseed.env nvim aniseed.nvim u dotfiles.util}})
nvim aniseed.nvim
nu aniseed.nvim.util
u dotfiles.util}})
(defn append-to-buf [bufno lines] (fn append-to-buf [bufno lines]
(when lines (when lines
(nvim.buf_set_lines buffno -1 -1 false lines))) (nvim.buf_set_lines buffno -1 -1 false lines)))
(var tf-log-bufno nil) (var tf-log-bufno nil)
(defn tf-log-buffer [])
(defn terraform-import [] (fn terraform-import []
(vim.fn.jobstart [:terraform :import :-no-color address id] (vim.fn.jobstart [:terraform :import :-no-color address id]
{:stdout_buffered true {:stdout_buffered true
:on_stdout (fn [_ data] :on_stdout (fn [_ data]
(append-to-buf bufno data))})) (append-to-buf bufno data))}))
; (nu.fn-bridge :ZoomToggle :dotfiles.zoom-toggle :zoom-toggle {:return false}) ; (nu.fn-bridge :ZoomToggle :dotfiles.zoom-toggle :zoom-toggle {:return false})
; (u.nnoremap :<C-W>z ":call ZoomToggle()<CR>") ; (u.nnoremap :<C-W>z ":call ZoomToggle()<CR>")

View File

@@ -1,21 +1,18 @@
(module dotfiles.zoom-toggle (local u (require :dotfiles.util))
{autoload {a aniseed.core}
require {anenv aniseed.env
nvim aniseed.nvim
nu aniseed.nvim.util
u dotfiles.util}})
(var unzoom! nil) (var unzoom! nil)
(defn zoom-toggle [] (if unzoom! (fn zoom-toggle []
(do (if unzoom!
(nvim.command unzoom!) (do
(set unzoom! nil)) (vim.cmd unzoom!)
(do (set unzoom! nil))
(set unzoom! (nvim.fn.winrestcmd)) (do
(nvim.ex.resize) (set unzoom! (vim.fn.winrestcmd))
(nvim.ex.vertical :resize)))) (vim.fn.resize)
(vim.fn.vertical :resize))))
(vim.api.nvim_create_user_command :ZoomToggle zoom-toggle {})
(nu.fn-bridge :ZoomToggle :dotfiles.zoom-toggle :zoom-toggle {:return false})
(u.nnoremap :<M-z> ":call ZoomToggle()<CR>") (u.nnoremap :<M-z> ":call ZoomToggle()<CR>")
(u.tnoremap :<M-z> "<c-\\><c-n>:call ZoomToggle()<CR>") (u.tnoremap :<M-z> "<c-\\><c-n>:call ZoomToggle()<CR>")