Compare commits

..

1 Commits

Author SHA1 Message Date
Proctor
414909f66f look into language eval with Conjure in Markdown Language blocks 2022-07-07 14:41:27 -05:00
17 changed files with 130 additions and 185 deletions

View File

@@ -1,27 +0,0 @@
# This is Git's per-user configuration file.
[user]
email = steven.proctor@gmail.com
name = Proctor
[core]
editor = nvim
excludesFile = ~/.gitignore.global
[init]
defaultBranch = main
[alias] ; Command aliases for the git[1] command wrapper
last = cat-file commit HEAD
[branch]
autoSetupRebase = always
[merge]
ff = only
[push]
autoSetupRemote = true
[rerere]
enabled = true
[remote]
pushDefault = origin
;; This is last, take in any other local file overrides
[include]
path = ~/.gitconfig.local ; find ".gitconfig.local" in your `$HOME` directory

View File

@@ -21,8 +21,6 @@
:false :⊥ :false :⊥
;; and ;; and
;; or ;; or
;; if-not
;; when-not
;; (not ;; (not
;; None | ∅ ;; None | ∅
;; true, false | , ⊥ (top and bottom from logic) ;; true, false | , ⊥ (top and bottom from logic)
@@ -48,18 +46,16 @@
(set nvim.wo.conceallevel 2) (set nvim.wo.conceallevel 2)
(set nvim.wo.conceallevel 0))) (set nvim.wo.conceallevel 0)))
;(setup-conceals)
;(toggle-conceal)
;(if true true false) ;(if true true false)
(nu.fn-bridge :ToggleConceal :dotfiles.conceal :toggle-conceal {:return false}) (nu.fn-bridge :ToggleConceal :dotfiles.conceal :toggle-conceal {:return false})
(nu.fn-bridge :SetupConceals :dotfiles.conceal :setup-conceals {:return false}) (nu.fn-bridge :SetupConceals :dotfiles.conceal :setup-conceals {:return false})
(u.nnoremap :<leader>tc "call ToggleConceal()") (u.nnoremap :<leader>ct "call ToggleConceal()")
(def pretty-filetypes [:fennel (def pretty-filetypes [:fennel
:clojure]) :clojure])
(each [_ ftype (pairs pretty-filetypes)] ; (each [_ ftype (pairs pretty-filetypes)]
(nvim.ex.autocmd :FileType ftype :call "SetupConceals()")) ; (nvim.ex.autocmd :FileType ftype :call "SetupConceals()"))
;

View File

@@ -19,7 +19,8 @@
(if (not (a.empty? glob)) (if (not (a.empty? glob))
(nvim.ex.source filename)))) (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"))
@@ -50,37 +51,36 @@
(def- val-based-opts (def- val-based-opts
{ {
; :t_Co 256 ; :t_Co 256
:laststatus 2 :laststatus 2
:encoding "utf-8" :encoding "utf-8"
:history 500 :history 500
:redrawtime 5000 :redrawtime 5000
:scrolloff 3 :scrolloff 3
:guifont "Hasklig" :guifont "Hasklig"
:background "dark" :background "dark"
:backupdir backup-dir :backupdir backup-dir
:directory backup-dir ;Don't clutter my dirs up with swp and tmp files :directory backup-dir ;Don't clutter my dirs up with swp and tmp files
:grepprg "ag --vimgrep" ; Use Silver Searcher instead of grep :grepprg "ag" ; Use Silver Searcher instead of grep
:tags "tags" :tags "tags"
:updatetime 300 ; per coc.vim for diagnostic messages :updatetime 300 ; per coc.vim for diagnostic messages
:signcolumn "auto:1-3" :signcolumn "auto:1-3"
:colorcolumn [80 100] :cmdheight 2 ; Better display for messages
:cmdheight 2 ; Better display for messages :undodir undo-dir
:undodir undo-dir :undolevels 1000
:undolevels 1000 :undoreload 10000
:undoreload 10000 :foldmethod "expr"
:foldmethod "expr" :foldexpr "nvim_treesitter#foldexpr()"
:foldexpr "nvim_treesitter#foldexpr()" :foldlevelstart 100
:foldlevelstart 100 :foldlevel 99
:foldlevel 99 :tabstop 2
:tabstop 2 :shiftwidth 2
:shiftwidth 2 :softtabstop 2
:softtabstop 2 :list true
:list true :listchars "tab:➥\\ ,trail:·"
:listchars "tab:➥\\ ,trail:·," :backspace "indent,eol,start" ;allow backspacing over everything in insert mode
:backspace "indent,eol,start" ;allow backspacing over everything in insert mode :wildmode "list:longest,list:full"
:wildmode "list:longest,list:full" :wrap false
:wrap false
}) })
(defn- set-opt (defn- set-opt
@@ -100,9 +100,9 @@
;(nvim.ex.autocmd "vimenter" "*" "++nested" "colorscheme" "solarized8") (nvim.ex.autocmd "vimenter" "*" "++nested" "colorscheme" "solarized8")
;(nvim.ex.autocmd "vimenter" "*" "luafile" "treesitter.lua") ;(nvim.ex.autocmd "vimenter" "*" "luafile" "treesitter.lua")
; ;
; (nvim.fn.glob "~/.vimrc.local") ; (nvim.fn.glob "~/.vimrc.local")
(defn make-fennel-scratch (defn make-fennel-scratch

View File

@@ -5,12 +5,11 @@
{nvim aniseed.nvim}}) {nvim aniseed.nvim}})
(require :dotfiles.core)
(require :dotfiles.plugins) (require :dotfiles.plugins)
(require :dotfiles.core)
(require :dotfiles.mapping) (require :dotfiles.mapping)
(require :dotfiles.conceal) (require :dotfiles.conceal)
(require :dotfiles.zoom-toggle) (require :dotfiles.zoom-toggle)
;(nvim.ex.source "~/.vimrc") ;(nvim.ex.source "~/.vimrc")
(a.println "(re)loaded")

View File

@@ -1,9 +1,7 @@
(module dotfiles.mapping (module dotfiles.mapping
{autoload {nvim aniseed.nvim {autoload {nvim aniseed.nvim
nu aniseed.nvim.util nu aniseed.nvim.util
core aniseed.core core aniseed.core}})
util dotfiles.util
}})
(defn- noremap [mode from to] (defn- noremap [mode from to]
"Sets a mapping with {:noremap true}." "Sets a mapping with {:noremap true}."

View File

@@ -13,12 +13,9 @@
(def- cmp-srcs (def- cmp-srcs
[{:name :nvim_lsp} [{:name :nvim_lsp}
{:name :nvim_lua}
{:name :vsnip} {:name :vsnip}
{:name :conjure} {:name :conjure}
{:name :buffer} {:name :buffer}])
{:name :orgmode}
{:name :emoji}])
;; Setup cmp with desired settings ;; Setup cmp with desired settings
(let [cmp (require :cmp)] (let [cmp (require :cmp)]

View File

@@ -1,13 +1,13 @@
(module dotfiles.plugin.colorizer (module dotfiles.plugin.colorizer
{autoload {colorizer colorizer}}) {autoload {colorizer colorizer}})
(colorizer.setup [:*] (colorizer.setup {"*" {}}
{:RGB true ; #RGB hex codes, like #F00 {:RGB true ; #RGB hex codes, like #F00
:RRGGBB true ; #RRGGBB hex codes, like #00FF00 :RRGGBB true ; #RRGGBB hex codes, like #00FF00
:names true ; "Name" codes like Blue :names true ; "Name" codes like Blue
:RRGGBBAA true ; #RRGGBBAA hex codes :RRGGBBAA true ; #RRGGBBAA hex codes
:rgb_fn true ; CSS rgb() and rgba() functions :rgb_fn true ; CSS rgb() and rgba() functions
:hsl_fn true ; CSS hsl() and hsla() functions :hsl_fn true ; CSS hsl() and hsla() functions
:css true ; Enable all CSS features: rgb_fn, hsl_fn, names, RGB, RRGGBB :css true ; Enable all CSS features: rgb_fn, hsl_fn, names, RGB, RRGGBB
:css_fn true ; Enable all CSS *functions*: rgb_fn, hsl_fn :css_fn true ; Enable all CSS *functions*: rgb_fn, hsl_fn
}) })

View File

@@ -25,7 +25,6 @@
:nvim_lsp true :nvim_lsp true
:nvim_lua true :nvim_lua true
:conjure true :conjure true
:orgmode true
:vsnip true :vsnip true
:vim_dadbod_completion true}}))) :vim_dadbod_completion true}})))

View File

@@ -6,7 +6,6 @@
; (set nvim.g.conjure#eval#result_register "*") ; (set nvim.g.conjure#eval#result_register "*")
; (set nvim.g.conjure#log#botright true) ; (set nvim.g.conjure#log#botright true)
(set nvim.g.conjure#mapping#doc_word "gk") (set nvim.g.conjure#mapping#doc_word "gk")
(set nvim.g.conjure#client#clojure#nrepl#mapping#session_clone :sC)
(set nvim.g.conjure#extract#tree_sitter#enabled true) (set nvim.g.conjure#extract#tree_sitter#enabled true)
(conjure-config.assoc-in [:filetypes] (a.concat (conjure-config.filetypes) [:markdown] )) (conjure-config.assoc-in [:filetypes] (a.concat (conjure-config.filetypes) [:markdown] ))

View File

@@ -1,9 +0,0 @@
(module dotfiles.plugin.fugitive
{autoload {nvim aniseed.nvim
nu aniseed.nvim.util
core aniseed.core
util dotfiles.util}})
(nvim.ex.autocmd :FileType :fugitive :nmap :<buffer> :<leader>gp ":Git pull<CR>")
;; Determine load time of fugitive
(nvim.ex.autocmd :FileType :fugitive :nmap :<buffer> :<leader>gP ":Git push<CR>" )

View File

@@ -1,2 +0,0 @@
(module dotfiles.plugin.headlines
{autoload {headlines headlines}})

View File

@@ -3,7 +3,9 @@
{a aniseed.core {a aniseed.core
u dotfiles.util u dotfiles.util
nvim aniseed.nvim nvim aniseed.nvim
nu aniseed.nvim.util}}) nu aniseed.nvim.util
}
})
(defn bufmap [mode from to] (defn bufmap [mode from to]
(u.noremap mode from to {:local? true})) (u.noremap mode from to {:local? true}))
@@ -44,8 +46,7 @@
:<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 :<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.formatting_sync()" :<leader>fa "lua vim.lsp.buf.formatting_sync()"
@@ -63,57 +64,12 @@
}) })
(def client-command-lnmappings
{:clojure_lsp
{:ai [:add-import-to-namespace ["input('Namespace name: ')"]]
:am [:add-missing-libspec []]
:as [:add-require-suggestion ["input('Namespace name: ')" "input('Namespace as: ')" "input('Namespace name: ')"]]
:cc [:cycle-coll []]
:cn [:clean-ns []]
:cp [:cycle-privacy []]
:ct [:create-test []]
:df [:demote-fn []]
:db [:drag-backward []]
:df [:drag-forward []]
:dk [:destructure-keys []]
:ed [:extract-to-def ["input('Definition name: ')"]]
:ef [:extract-function ["input('Function name: ')"]]
:el [:expand-let []]
:fe [:create-function []]
:il [:introduce-let ["input('Binding name: ')"]]
:is [:inline-symbol []]
:ma [:resolve-macro-as []]
:mf [:move-form ["input('File name: ')"]]
:ml [:move-to-let ["input('Binding name: ')"]]
:pf [:promote-fn ["input('Function name: ')"]]
:sc [:change-collection ["input('Collection type: ')"]]
:sm [:sort-map []]
:tf [:thread-first-all []]
:tF [:thread-first []]
:tl [:thread-last-all []]
:tL [:thread-last []]
:ua [:unwind-all []]
:uw [:unwind-thread []]
}
})
(defn bind-client-mappings [client] (defn bind-client-mappings [client]
(let [client-name (a.get client :name) (let [client-name (a.get client :name)
mappings (a.get client-nmappings client-name) mappings (a.get client-nmappings client-name)]
command-lnmappings (a.get client-command-lnmappings client-name)]
(when mappings (when mappings
(each [mapping cmd (pairs mappings)] (each [mapping cmd (pairs mappings)]
(nbufmap mapping cmd))) (nbufmap mapping cmd)))))
(when command-lnmappings
(each [lnmapping command-mapping (pairs command-lnmappings)]
(let [lsp-cmd (a.first command-mapping)
opts-str (accumulate [s ""
i opt (ipairs (a.second command-mapping))]
(.. s ", " opt))
mapping (.. :<leader> lnmapping)
cmd (.. "call LspExecuteCommand('" lsp-cmd "'" opts-str ")")]
(nbufmap mapping cmd))))))
(defn on_attach [client bufnr] (defn on_attach [client bufnr]
(each [mapping cmd (pairs core-nmappings)] (each [mapping cmd (pairs core-nmappings)]
@@ -176,3 +132,64 @@
(nu.fn-bridge :LspExecuteCommand :dotfiles.plugin.lspconfig :lsp-execute-command {:return false}) (nu.fn-bridge :LspExecuteCommand :dotfiles.plugin.lspconfig :lsp-execute-command {:return false})
(u.nnoremap :<leader>li "LspInfo"))) (u.nnoremap :<leader>li "LspInfo")))
;; (let [eval (require :conjure.eval)
;; client (require :conjure.client)
;; ts-utils (require :nvim-treesitter.ts_utils)
;; parsers (require :nvim-treesitter.parsers)
;; ]
;;
;; ; client["with-filetype"]("fennel", eval["eval-str"], {
;; ; origin = "my-awesome-plugin",
;; ; code = "(+ 10 20)",
;; ; ["passive?"] = true,
;; ; ["on-result"] = function (r)
;; ; print("RESULT:", r)
;; ; end
;; ; })
;;
;; (defn ts-node-descendent-of? [node ancestor-type]
;; (print node)
;; (if (= nil node)
;; false
;; (let [node-type (node:type)]
;; (print node-type)
;; (if (= ancestor-type node-type)
;; true
;; (ts-node-descendent-of? (node:parent) ancestor-type)))))
;;
;; (defn in-fenced-code-block? []
;; (let [cursor (vim.api.nvim_win_get_cursor 0)
;; lnum (a.first cursor)
;; col (a.second cursor)
;; root_lang_tree (parsers.get_parser)
;; range [ lnum - 1 col lnum - 1 col ]
;; (node root lang-tree) (ts-utils.get_root_for_position (- lnum 1) col root_lang_tree) ]
;; (a.pr "language" (a.get lang-tree :_lang :err))
;; )
;; (let [node-at-cursor (ts-utils.get_node_at_cursor)]
;; (print "node at cursor" node-at-cursor)
;; (a.pr "root for node at cursor " (ts-utils.get_root_for_node node-at-cursor))
;; (print (ts-node-descendent-of? node-at-cursor :fenced_code_block))))
;;
;; (defn markdown-code-to-repl []
;; ; (let [buf-uri (vim.uri_from_bufnr 0)
;; ; cursor (vim.api.nvim_win_get_cursor 0)
;; ; r (- (a.first cursor) 1)
;; ; c (a.second cursor)
;; ; opts [buf-uri r c]
;; ; args (a.concat opts [...])]
;; ; (vim.lsp.buf.execute_command {:command cmd
;; ; :arguments args}))
;; )
;;
;; (nu.fn-bridge :MarkdownCodeToRepl :dotfiles.plugin.lspconfig :markdown-code-to-repl {:return false})
;;
;; (nu.fn-bridge :IsInFencedCodeBlock :dotfiles.plugin.lspconfig :in-fenced-code-block? {:return false})
;;
;; ;; If file type is Markdown
;; ;(u.nnoremap :<leader>ee "call MarkdownCodeToRepl")
;;
;; )
;;

View File

@@ -1,3 +0,0 @@
(module dotfiles.plugin.orgbullets
{autoload {org-bullets org-bullets}})

View File

@@ -1,8 +0,0 @@
(module dotfiles.plugin.orgmode
{autoload {orgmode orgmode}})
(orgmode.setup_ts_grammar)
(orgmode.setup
{:org_agenda_files ["~/Dropbox/org/*" "~/my-orgs/**/*"]
:org_default_notes_file "~/Dropbox/org/refile.org" })

View File

@@ -1,15 +1,9 @@
(module dotfiles.plugin.treesitter (module dotfiles.plugin.treesitter
{autoload {treesitter nvim-treesitter {autoload {treesitter nvim-treesitter.configs}})
ts_utils nvim-treesitter.ts_utils
treesitter-configs nvim-treesitter.configs}})
(treesitter-configs.setup (treesitter.setup
{:highlight {:enable true {:highlight {:enable true
;; :additional_vim_regex_highlighting false :additional_vim_regex_highlighting false}
:additional_vim_regex_highlighting [:org]
}
:ensure_installed :all ; [:org]
:rainbow {:enable true :rainbow {:enable true
:extended_mode true ; Also highlight non-bracket delimiters like html tags, boolean or table: lang -> boolean :extended_mode true ; Also highlight non-bracket delimiters like html tags, boolean or table: lang -> boolean
@@ -24,4 +18,5 @@
:#6c71c4 ; violet / brmagenta :#6c71c4 ; violet / brmagenta
] ; table of hex strings ] ; table of hex strings
} }
:playground {:enable true}
}) })

View File

@@ -2,7 +2,9 @@
{autoload {nvim aniseed.nvim {autoload {nvim aniseed.nvim
a aniseed.core a aniseed.core
;; util dotfiles.util ;; util dotfiles.util
packer packer} packer packer
}
;; require {minpac minpac} ;; require {minpac minpac}
}) })
@@ -31,15 +33,11 @@
:Olical/fennel.vim {} ; Fennel :Olical/fennel.vim {} ; Fennel
:airblade/vim-gitgutter {} ; Git :airblade/vim-gitgutter {} ; Git
:airblade/vim-gitgutter {} ; Git :airblade/vim-gitgutter {} ; Git
:akinsho/org-bullets.nvim {:mod :orgbullets}
:clojure-vim/vim-jack-in {} ; Conjure support - jack-in with nrepl dependencies :clojure-vim/vim-jack-in {} ; Conjure support - jack-in with nrepl dependencies
:dhruvasagar/vim-table-mode {} ; table creation and formatting
:folke/lsp-colors.nvim {} :folke/lsp-colors.nvim {}
:hashivim/vim-terraform {} ; Terraform :hashivim/vim-terraform {} ; Terraform
:hrsh7th/nvim-cmp {:requires [:hrsh7th/cmp-buffer :hrsh7th/nvim-cmp {:requires [:hrsh7th/cmp-buffer
:hrsh7th/cmp-emoji
:hrsh7th/cmp-nvim-lsp :hrsh7th/cmp-nvim-lsp
:hrsh7th/cmp-nvim-lua
:hrsh7th/cmp-vsnip :hrsh7th/cmp-vsnip
:hrsh7th/vim-vsnip-integ :hrsh7th/vim-vsnip-integ
:PaterJason/cmp-conjure] :PaterJason/cmp-conjure]
@@ -52,13 +50,10 @@
:kovisoft/paredit {} :kovisoft/paredit {}
:kristijanhusak/vim-dadbod-completion {} :kristijanhusak/vim-dadbod-completion {}
:kristijanhusak/vim-dadbod-ui {} :kristijanhusak/vim-dadbod-ui {}
:lukas-reineke/headlines.nvim {:mod :headlines}
; :michaelb/sniprun {:run "bash ./install.sh" :mod :sniprun}
:neovim/nvim-lspconfig {:mod :lspconfig} ; NeoVim lsp config :neovim/nvim-lspconfig {:mod :lspconfig} ; NeoVim lsp config
:norcalli/nvim-colorizer.lua {:mod :colorizer} :norcalli/nvim-colorizer.lua {:mode :colorizer}
:nvim-orgmode/orgmode { :mod :orgmode }
:nvim-telescope/telescope.nvim {:requires [[:nvim-lua/popup.nvim] [:nvim-lua/plenary.nvim]] :mod :telescope} :nvim-telescope/telescope.nvim {:requires [[:nvim-lua/popup.nvim] [:nvim-lua/plenary.nvim]] :mod :telescope}
:nvim-treesitter/nvim-treesitter {:run ":TSUpdate" :mod :treesitter} :nvim-treesitter/nvim-treesitter {:run ":TSUpdate" :mod :treesitter :requires [:nvim-treesitter/playground]}
:nvim-treesitter/playground {} :nvim-treesitter/playground {}
:p00f/nvim-ts-rainbow {} :p00f/nvim-ts-rainbow {}
:radenling/vim-dispatch-neovim {} ; Clojure :radenling/vim-dispatch-neovim {} ; Clojure
@@ -66,7 +61,7 @@
:tpope/vim-classpath {} :tpope/vim-classpath {}
:tpope/vim-dadbod {} :tpope/vim-dadbod {}
:tpope/vim-dispatch {} ; Conjure support - jack-in with nrepl dependencies :tpope/vim-dispatch {} ; Conjure support - jack-in with nrepl dependencies
:tpope/vim-fugitive {:mod :fugitive} ; Git :tpope/vim-fugitive {} ; Git
:tpope/vim-git {} ; Git Commit Message :tpope/vim-git {} ; Git Commit Message
:tpope/vim-pathogen {} :tpope/vim-pathogen {}
:tpope/vim-rails {} :tpope/vim-rails {}

View File

@@ -34,7 +34,7 @@ setw -g mouse off
# set -g default-terminal "xterm-256:color" # set -g default-terminal "xterm-256:color"
# set -g default-terminal "${TERM}" # set -g default-terminal "${TERM}"
set -s default-terminal "tmux-256color" set -s default-terminal "tmux-256color"
set -g history-limit 15000 set -g history-limit 6000
set -g window-status-style dim set -g window-status-style dim
set -g window-status-current-style bright set -g window-status-current-style bright
@@ -46,9 +46,8 @@ set -g status-right '#(~/dotfiles/bin/tmux_battery_charge_indicator.sh) #[bg=whi
set -g update-environment "DISPLAY SSH_ASKPASS SSH_AGENT_PID SSH_CONNECTION WINDOWID XAUTHORITY" set -g update-environment "DISPLAY SSH_ASKPASS SSH_AGENT_PID SSH_CONNECTION WINDOWID XAUTHORITY"
set-environment -g 'SSH_AUTH_SOCK' ~/.ssh/ssh_auth_sock set-environment -g 'SSH_AUTH_SOCK' ~/.ssh/ssh_auth_sock
# set -as terminal-overrides ',xterm-256color:RGB' # set -as terminal-overrides ',xterm-257color:RGB'
set -as terminal-features ',xterm-256color:RGB' set -as terminal-features ',xterm-256color:RGB'
set-option -sa terminal-overrides ',xterm-256color:RGB'
# Undercurl # Undercurl
set -as terminal-overrides ',*:Smulx=\E[4::%p1%dm' # undercurl support set -as terminal-overrides ',*:Smulx=\E[4::%p1%dm' # undercurl support