mirror of
https://github.com/stevenproctor/dotfiles.git
synced 2026-11-22 15:08:25 -06:00
Compare commits
129
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
da79188cd7 | ||
|
|
181bb98015 | ||
|
|
812a3b7b11 | ||
|
|
d79264dede | ||
|
|
34c9c6301f | ||
|
|
8467be3c43 | ||
|
|
8cade13a72 | ||
|
|
9a29dd8433 | ||
|
|
1e32c6293a | ||
|
|
6fd4baa9fe | ||
|
|
4e79e2da69 | ||
|
|
89a9823459 | ||
|
|
bdc89102ae | ||
|
|
3e9ae79508 | ||
|
|
ce9847370c | ||
|
|
329c9fe07f | ||
|
|
644e8c26d3 | ||
|
|
a96c155f43 | ||
|
|
c328151670 | ||
|
|
f2dbbdf779 | ||
|
|
f9510ce4c4 | ||
|
|
8c50aa8c60 | ||
|
|
e596dbe71b | ||
|
|
ed89606f4e | ||
|
|
240abfc7f6 | ||
|
|
d08ce2685e | ||
|
|
0903f1234f | ||
|
|
dcdca7d9e9 | ||
|
|
f2c0cd2992 | ||
|
|
5174167c99 | ||
|
|
07eb5d3b94 | ||
|
|
8186744af8 | ||
|
|
acdba51080 | ||
|
|
9a79203170 | ||
|
|
24116f8264 | ||
|
|
d3ebe7aef0 | ||
|
|
c5c7d851dd | ||
|
|
4d3dc61c77 | ||
|
|
bdb1fbdfd5 | ||
|
|
e72ece36b1 | ||
|
|
7d4c4ae332 | ||
|
|
ae35f5455e | ||
|
|
7444d89fad | ||
|
|
69e1b233d1 | ||
|
|
19930e36d5 | ||
|
|
5e5f6ffe49 | ||
|
|
e89869917a | ||
|
|
80a417fec8 | ||
|
|
42dc9244be | ||
|
|
f30097325b | ||
|
|
88200beefa | ||
|
|
ea8112cf35 | ||
|
|
cf9ef0b5e0 | ||
|
|
1200d06efc | ||
|
|
c20fef8542 | ||
|
|
4d0512b9aa | ||
|
|
c2d5402d28 | ||
|
|
f4369a98ff | ||
|
|
037ad7d879 | ||
|
|
948c8b4345 | ||
|
|
9c7237c7e1 | ||
|
|
ce6dca9733 | ||
|
|
6c0639068d | ||
|
|
df8d793467 | ||
|
|
0d22d7fa46 | ||
|
|
fa7904e131 | ||
|
|
9a302cb6c2 | ||
|
|
1a6c628b38 | ||
|
|
2b623f6eee | ||
|
|
07a92bb66c | ||
|
|
d40878f48d | ||
|
|
a23c581746 | ||
|
|
04bf501caa | ||
|
|
b31ae70a7d | ||
|
|
04ffc88e9a | ||
|
|
a47e5ab7a8 | ||
|
|
e2bd2b2497 | ||
|
|
b005718a80 | ||
|
|
5c2859dac6 | ||
|
|
f58001e2ec | ||
|
|
2f2e7fb72d | ||
|
|
618d305a05 | ||
|
|
3c9383a552 | ||
|
|
a61ba60adb | ||
|
|
b762400ea9 | ||
|
|
5a77fa58e6 | ||
|
|
f0fdde8b8b | ||
|
|
94c07708b6 | ||
|
|
1829789ed0 | ||
|
|
f8c419314b | ||
|
|
b504520573 | ||
|
|
44c4e29ebd | ||
|
|
b08bb34014 | ||
|
|
7aee69c6cc | ||
|
|
00f9835648 | ||
|
|
ada07b55ef | ||
|
|
1d0c8f99c0 | ||
|
|
40e12613f3 | ||
|
|
9aed0652fd | ||
|
|
ceac258332 | ||
|
|
da12dab7f0 | ||
|
|
b580f52a16 | ||
|
|
aa59abdc63 | ||
|
|
3bb3989d39 | ||
|
|
2ea5230362 | ||
|
|
022744ff0d | ||
|
|
76feada900 | ||
|
|
563b26b4c2 | ||
|
|
a64a75a550 | ||
|
|
6b95c42f3d | ||
|
|
267192615f | ||
|
|
139181de24 | ||
|
|
c304417d6c | ||
|
|
953cb4414b | ||
|
|
005efec7f6 | ||
|
|
f434ee8946 | ||
|
|
d3d37c51c9 | ||
|
|
8c98d8cfd7 | ||
|
|
6e7f3533aa | ||
|
|
86ce07739a | ||
|
|
2d1d92d8a9 | ||
|
|
e09e7cf7a5 | ||
|
|
aa91648164 | ||
|
|
e4ac85922e | ||
|
|
629463b335 | ||
|
|
954340c183 | ||
|
|
86d29e0624 | ||
|
|
1b5e02d9b8 | ||
|
|
10c0d5b9e0 |
No files matched your search
+21
-18
@@ -1,10 +1,13 @@
|
||||
shopt -s globstar
|
||||
|
||||
[[ -f ~/.bashrc ]] && . ~/.bashrc
|
||||
|
||||
PATH="${ASDF_DATA_DIR:-$HOME/.asdf}/shims:$PATH"
|
||||
PATH=/usr/local/sbin:/usr/local/bin:~/bin:/usr/local/share/npm/bin:$PATH
|
||||
PATH=$PATH:$HOME
|
||||
export PATH=$PATH:$HOME
|
||||
MANPATH=$MANPATH:/usr/local/opt/erlang/lib/erlang/man
|
||||
|
||||
export XDG_CONFIG_HOME=$HOME/.config
|
||||
export LC_ALL=en_US.UTF-8
|
||||
|
||||
set -o vi
|
||||
export EDITOR='nvim'
|
||||
|
||||
@@ -15,14 +18,13 @@ if which brew 2>/dev/null && [[ -f $(brew --prefix)/etc/bash_completion ]]; then
|
||||
fi
|
||||
|
||||
# came from Aaron Lasseigne (AaronLasseigne on GitHub)
|
||||
battery_status()
|
||||
{
|
||||
battery_status() {
|
||||
HEART='♥ '
|
||||
|
||||
NON='\[\e[0m\]'
|
||||
RED='\[\e[0;31m\]'
|
||||
|
||||
battery_info=`ioreg -rc AppleSmartBattery`
|
||||
battery_info=$(ioreg -rc AppleSmartBattery)
|
||||
current_charge=$(echo $battery_info | grep -o '"CurrentCapacity" = [0-9]\+' | cut -d ' ' -f 3)
|
||||
total_charge=$(echo $battery_info | grep -o '"MaxCapacity" = [0-9]\+' | cut -d ' ' -f 3)
|
||||
|
||||
@@ -32,11 +34,11 @@ battery_status()
|
||||
fi
|
||||
|
||||
echo -n "${RED}"
|
||||
for i in `seq 1 $charged_slots`; do echo -n "$HEART"; done
|
||||
for i in $(seq 1 $charged_slots); do echo -n "$HEART"; done
|
||||
echo -n "${NON}"
|
||||
|
||||
if [[ $charged_slots -lt 10 ]]; then
|
||||
for i in `seq 1 $(echo "10-$charged_slots" | bc)`; do echo -n "$HEART"; done
|
||||
for i in $(seq 1 $(echo "10-$charged_slots" | bc)); do echo -n "$HEART"; done
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -51,16 +53,15 @@ safesource ~/.bash/aliases
|
||||
safesource ~/.bash_local
|
||||
|
||||
### Added by the Heroku Toolbelt
|
||||
export PATH="/usr/local/heroku/bin:$PATH"
|
||||
#export PATH="/usr/local/heroku/bin:$PATH"
|
||||
|
||||
function repeat() {
|
||||
local count=$1;
|
||||
shift;
|
||||
local count=$1
|
||||
shift
|
||||
|
||||
echo "running '$@' for $count times"
|
||||
|
||||
for i in $(eval echo "{1..$count}")
|
||||
do
|
||||
for i in $(eval echo "{1..$count}"); do
|
||||
$@ || break
|
||||
done
|
||||
}
|
||||
@@ -86,13 +87,11 @@ function my_git_user_name() {
|
||||
git config --get user.name
|
||||
}
|
||||
|
||||
function my_commits_for_this_past_year()
|
||||
{
|
||||
function my_commits_for_this_past_year() {
|
||||
git log --author="$(my_git_user_name)" --after="$(end_of_last_year)" origin/master
|
||||
}
|
||||
|
||||
function truncate_logs()
|
||||
{
|
||||
function truncate_logs() {
|
||||
find log -type f -name "*.log" | xargs -I {} bash -c 'echo "" > {}'
|
||||
}
|
||||
|
||||
@@ -110,4 +109,8 @@ export LESS_TERMCAP_us=$'\e'"[1;32m"
|
||||
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
|
||||
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
|
||||
|
||||
[ -s ".config/broot/launcher/bash/br" ] && source /Users/sproctor/.config/broot/launcher/bash/br
|
||||
[ -s "$HOME/.config/broot/launcher/bash/br" ] && source "$HOME/.config/broot/launcher/bash/br"
|
||||
|
||||
# source /Users/proctor/.config/broot/launcher/bash/br
|
||||
#
|
||||
[[ -f ~/.bashrc ]] && . ~/.bashrc
|
||||
@@ -6,16 +6,14 @@ if [[ $- != *i* ]] ; then
|
||||
return
|
||||
fi
|
||||
|
||||
|
||||
# came from Aaron Lasseigne (AaronLasseigne on GitHub)
|
||||
battery_status()
|
||||
{
|
||||
battery_status() {
|
||||
HEART='♥ '
|
||||
|
||||
NON='\[\e[0m\]'
|
||||
RED='\[\e[0;31m\]'
|
||||
|
||||
battery_info=`ioreg -rc AppleSmartBattery`
|
||||
battery_info=$(ioreg -rc AppleSmartBattery)
|
||||
current_charge=$(echo $battery_info | grep -o '"CurrentCapacity" = [0-9]\+' | cut -d ' ' -f 3)
|
||||
total_charge=$(echo $battery_info | grep -o '"MaxCapacity" = [0-9]\+' | cut -d ' ' -f 3)
|
||||
|
||||
@@ -25,11 +23,11 @@ battery_status()
|
||||
fi
|
||||
|
||||
echo -n "${RED}"
|
||||
for i in `seq 1 $charged_slots`; do echo -n "$HEART"; done
|
||||
for i in $(seq 1 $charged_slots); do echo -n "$HEART"; done
|
||||
echo -n "${NON}"
|
||||
|
||||
if [[ $charged_slots -lt 10 ]]; then
|
||||
for i in `seq 1 $(echo "10-$charged_slots" | bc)`; do echo -n "$HEART"; done
|
||||
for i in $(seq 1 $(echo "10-$charged_slots" | bc)); do echo -n "$HEART"; done
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -39,3 +37,9 @@ export XML_CATALOG_FILES=/usr/local/etc/xml/catalog
|
||||
|
||||
# Add RVM to PATH for scripting. Make sure this is the last PATH variable change.
|
||||
export PATH="$PATH:$HOME/.rvm/bin"
|
||||
|
||||
# source ~/.config/broot/launcher/bash/br
|
||||
|
||||
if which direnv 2>/dev/null; then
|
||||
eval "$(direnv hook bash)"
|
||||
fi
|
||||
Whitespace-only changes.
+5
-1
@@ -4,11 +4,14 @@ alias ll='ls -l'
|
||||
alias la='ls -a'
|
||||
alias lhal='ls -hal'
|
||||
|
||||
#curl
|
||||
alias curltime="curl -w \"@$HOME/utils/curl-time-format.txt\" -o /dev/null -s "
|
||||
|
||||
#git aliases
|
||||
alias ?='git status'
|
||||
alias ga='git add'
|
||||
alias gaa='git add .'
|
||||
alias gbc="git branch -vv | grep -e '[origin/[^:]*: gone]' | awk '{print \$1}' | xargs git branch -D"
|
||||
alias gbc="git branch -vv | grep -e '[origin/[^:]*: gone]' | awk '{print \$1}' | xargs --no-run-if-empty git branch -D"
|
||||
alias gbd='git branch -d'
|
||||
alias gc='git commit'
|
||||
alias gcb='git branch --show-current'
|
||||
@@ -19,6 +22,7 @@ alias gmerge='git merge --ff-only'
|
||||
alias gpull='git pull --rebase'
|
||||
alias gpush='git push'
|
||||
alias gpush!='git push -u origin `git rev-parse --abbrev-ref HEAD`'
|
||||
alias gr='cd $(git rev-parse --show-toplevel)'
|
||||
alias master!='git checkout master'
|
||||
alias main!='git checkout main'
|
||||
alias merged?='git branch --merged'
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
[user]
|
||||
name = Proctor
|
||||
email = steven.proctor@gmail.com
|
||||
[core]
|
||||
editor = nvim
|
||||
excludesFile = ~/.gitignore.global
|
||||
[color]
|
||||
ui = true
|
||||
[pull]
|
||||
ff = only
|
||||
[filter "media"]
|
||||
clean = git-media-clean %f
|
||||
smudge = git-media-smudge %f
|
||||
[init]
|
||||
defaultBranch = main
|
||||
[alias] ; Command aliases for the git[1] command wrapper
|
||||
last = cat-file commit HEAD
|
||||
[diff]
|
||||
algorithm = histogram
|
||||
colorMoved = zebra # plain
|
||||
mnemonicPrefix = true
|
||||
renames = true
|
||||
[branch]
|
||||
autoSetupRebase = always
|
||||
[checkout]
|
||||
defaultRemote = origin
|
||||
[gpg]
|
||||
format = ssh
|
||||
[commit]
|
||||
gpgsign = true
|
||||
[fetch]
|
||||
all = true
|
||||
prune = true
|
||||
pruneTags = true
|
||||
[tag]
|
||||
gpgsign = true
|
||||
sort = version:refname
|
||||
[gpg "ssh"]
|
||||
allowedSignersFile = ~/.ssh/allowed_signers
|
||||
[help]
|
||||
autocorrect = prompt
|
||||
[merge]
|
||||
conflitstyle = zdiff3
|
||||
ff = only
|
||||
[push]
|
||||
default = current
|
||||
autoSetupRemote = true
|
||||
followTags = true
|
||||
[rerere]
|
||||
enabled = true
|
||||
autoupdate = 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
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1 @@
|
||||
{}
|
||||
@@ -0,0 +1,14 @@
|
||||
(comment
|
||||
(local config (require :nfnl.config))
|
||||
(let [{:fennel-path fennel-path
|
||||
:fennel-macro-path macro-path}
|
||||
(config.default
|
||||
{:root-dir "."
|
||||
:rtp-patterns ["."]})]
|
||||
{:extra-globals "vim"
|
||||
:lua-version "lua5.1"
|
||||
: fennel-path
|
||||
: macro-path}))
|
||||
|
||||
{:extra-globals "vim"
|
||||
:lua-version "lua5.1"}
|
||||
@@ -0,0 +1,3 @@
|
||||
-- [nfnl] flsproject.fnl
|
||||
--[[ (local config (require "nfnl.config")) (let [{:fennel-macro-path macro-path :fennel-path fennel-path} (config.default {:root-dir "." :rtp-patterns ["."]})] {:extra-globals "vim" :fennel-path fennel-path :lua-version "lua5.1" :macro-path macro-path}) ]]
|
||||
return {["extra-globals"] = "vim", ["lua-version"] = "lua5.1"}
|
||||
@@ -0,0 +1,14 @@
|
||||
;; [nfnl-macro]
|
||||
|
||||
(fn tx [& args]
|
||||
"Mixed sequential and associative tables at compile time. Because the Neovim ecosystem loves them but Fennel has no neat way to express them (which I think is fine, I don't like the idea of them in general)."
|
||||
(let [to-merge (when (table? (. args (length args)))
|
||||
(table.remove args))]
|
||||
(if to-merge
|
||||
(do
|
||||
(each [key value (pairs to-merge)]
|
||||
(tset args key value))
|
||||
args)
|
||||
args)))
|
||||
|
||||
{: tx}
|
||||
@@ -1,26 +1,24 @@
|
||||
(module dotfiles.conceal
|
||||
{autoload {nvim aniseed.nvim
|
||||
nu aniseed.nvim.util
|
||||
u dotfiles.util}})
|
||||
(local u (require :dotfiles.util))
|
||||
|
||||
|
||||
(def conceals {:defn :𝑓
|
||||
(local conceals {:defn "𝑓"
|
||||
;; :defn- :
|
||||
:fn :λ
|
||||
:lambda :λ
|
||||
:and :∧
|
||||
:&& :∧
|
||||
:or :∨
|
||||
:|| :∨
|
||||
:not :¬
|
||||
:! :¬
|
||||
:for :∀
|
||||
:in :∈
|
||||
:fn "λ"
|
||||
:lambda "λ"
|
||||
:and "∧"
|
||||
:&& "∧"
|
||||
:or "∨"
|
||||
:|| "∨"
|
||||
:not "¬"
|
||||
:! "¬"
|
||||
:for "∀"
|
||||
:in "∈"
|
||||
; "\\<not\\> \\<in\\>" :∉
|
||||
:true :⊤
|
||||
:false :⊥
|
||||
:true "⊤"
|
||||
:false "⊥"
|
||||
;; and
|
||||
;; or
|
||||
;; if-not
|
||||
;; when-not
|
||||
;; (not
|
||||
;; None | ∅
|
||||
;; true, false | ⊤, ⊥ (top and bottom from logic)
|
||||
@@ -30,32 +28,31 @@
|
||||
;; not in | ∉
|
||||
})
|
||||
|
||||
|
||||
(defn setup-conceals []
|
||||
(nvim.fn.clearmatches)
|
||||
(fn setup-conceals []
|
||||
(vim.fn.clearmatches)
|
||||
(each [the-match replacement (pairs conceals)]
|
||||
(let [the-match (.. "\\<" the-match "\\>")]
|
||||
(nvim.fn.matchadd :Conceal the-match 0 -1 {:conceal replacement})))
|
||||
(vim.fn.matchadd :Conceal the-match 0 -1 {:conceal replacement})))
|
||||
(set vim.wo.conceallevel 2)
|
||||
(set vim.wo.concealcursor :nvc))
|
||||
|
||||
(set nvim.wo.conceallevel 2)
|
||||
(set nvim.wo.concealcursor :nvc))
|
||||
|
||||
|
||||
(defn toggle-conceal []
|
||||
( if (= 0 nvim.wo.conceallevel)
|
||||
(set nvim.wo.conceallevel 2)
|
||||
(set nvim.wo.conceallevel 0)))
|
||||
(fn toggle-conceal []
|
||||
(if (= 0 vim.wo.conceallevel)
|
||||
(set vim.wo.conceallevel 2)
|
||||
(set vim.wo.conceallevel 0)))
|
||||
|
||||
;(setup-conceals)
|
||||
;(toggle-conceal)
|
||||
;(if true true false)
|
||||
|
||||
(vim.api.nvim_create_user_command :ToggleConceal toggle-conceal {})
|
||||
(vim.api.nvim_create_user_command :SetupConceals setup-conceals {})
|
||||
(u.nnoremap :<leader>ts "call ToggleConceal()")
|
||||
|
||||
(nu.fn-bridge :ToggleConceal :dotfiles.conceal :toggle-conceal {:return false})
|
||||
(nu.fn-bridge :SetupConceals :dotfiles.conceal :setup-conceals {:return false})
|
||||
(u.nnoremap :<leader>ct "call ToggleConceal()")
|
||||
(local pretty-filetypes [:fennel :clojure])
|
||||
|
||||
(def pretty-filetypes [:fennel
|
||||
:clojure])
|
||||
(each [_ ftype (pairs pretty-filetypes)]
|
||||
(vim.api.nvim_create_autocmd [:FileType]
|
||||
{:pattern ftype :callback setup-conceals}))
|
||||
|
||||
; (each [_ ftype (pairs pretty-filetypes)]
|
||||
; (nvim.ex.autocmd :FileType ftype :call "SetupConceals()"))
|
||||
;
|
||||
{: setup-conceals}
|
||||
@@ -1,43 +1,37 @@
|
||||
(module dotfiles.core
|
||||
{autoload
|
||||
{a aniseed.core}
|
||||
require
|
||||
{anenv aniseed.env
|
||||
nvim aniseed.nvim
|
||||
nu aniseed.nvim.util
|
||||
u dotfiles.util
|
||||
}})
|
||||
(local a (require :nfnl.core))
|
||||
(local u (require :dotfiles.util))
|
||||
|
||||
(vim.cmd.set :shortmess+=c)
|
||||
|
||||
(nvim.ex.set "shortmess+=c") ; don't give |ins-completion-menu| messages.
|
||||
(nvim.ex.set "path+=**")
|
||||
(nvim.ex.set "wildignore+=*.o,*.obj,.git,*.rbc,*.class,.svn,vendor/gems/*")
|
||||
; don't give |ins-completion-menu| messages.
|
||||
(vim.cmd.set :path+=**)
|
||||
(vim.cmd.set "wildignore+=*.o,*.obj,.git,*.rbc,*.class,.svn,vendor/gems/*")
|
||||
|
||||
(defn- safe-source
|
||||
[filename]
|
||||
(let [glob (nvim.fn.glob filename)]
|
||||
(fn safe-source [filename]
|
||||
(let [glob (vim.fn.glob filename)]
|
||||
(if (not (a.empty? glob))
|
||||
(nvim.ex.source filename))))
|
||||
(vim.fn.source filename))))
|
||||
|
||||
(a.map safe-source ["~/.vimrc" "~/.vimrc.local"])
|
||||
; (a.map safe-source ["~/.vimrc" "~/.vimrc.local"])
|
||||
|
||||
(local backup-dir (.. (vim.fn.glob :$HOME) :/.vim/backup))
|
||||
(local undo-dir (.. (vim.fn.glob :$HOME) :/.vim/backup))
|
||||
|
||||
(def- backup-dir (.. (nvim.fn.glob "$HOME") "/.vim/backup"))
|
||||
(def- undo-dir (.. (nvim.fn.glob "$HOME") "/.vim/backup"))
|
||||
|
||||
(def- on-opts [
|
||||
:autoindent
|
||||
(local on-opts [:autoindent
|
||||
:autoread
|
||||
:expandtab
|
||||
:exrc ; allow project level (neo)vim files
|
||||
:exrc
|
||||
; allow project level (neo)vim files
|
||||
:hlsearch
|
||||
:ignorecase
|
||||
:incsearch
|
||||
:number
|
||||
:ruler
|
||||
:secure
|
||||
:shiftround ; When at 3 spaces and I hit >>, go to 4, not 5.
|
||||
:showcmd ; shows (parital) command in the status line
|
||||
:shiftround
|
||||
; When at 3 spaces and I hit >>, go to 4, not 5.
|
||||
:showcmd
|
||||
; shows (parital) command in the status line
|
||||
:showmatch
|
||||
:smartcase
|
||||
:splitbelow
|
||||
@@ -45,77 +39,81 @@
|
||||
:termguicolors
|
||||
:title
|
||||
:undofile
|
||||
:wildmenu
|
||||
])
|
||||
:wildmenu])
|
||||
|
||||
|
||||
(def- val-based-opts
|
||||
{
|
||||
; :t_Co 256
|
||||
(local val-based-opts {; :t_Co 256
|
||||
:laststatus 2
|
||||
:encoding "utf-8"
|
||||
:encoding :utf-8
|
||||
:history 500
|
||||
:redrawtime 5000
|
||||
:scrolloff 3
|
||||
:guifont "Hasklig"
|
||||
:background "dark"
|
||||
:guifont :Hasklig
|
||||
:guifontwide :Hasklig
|
||||
:background :dark
|
||||
:backupdir backup-dir
|
||||
:directory backup-dir ;Don't clutter my dirs up with swp and tmp files
|
||||
:grepprg "ag" ; Use Silver Searcher instead of grep
|
||||
:tags "tags"
|
||||
:updatetime 300 ; per coc.vim for diagnostic messages
|
||||
:directory backup-dir
|
||||
;Don't clutter my dirs up with swp and tmp files
|
||||
:grepprg "ag --vimgrep"
|
||||
; Use Silver Searcher instead of grep
|
||||
:tags :tags
|
||||
:updatetime 300
|
||||
; per coc.vim for diagnostic messages
|
||||
:signcolumn "auto:1-3"
|
||||
:cmdheight 2 ; Better display for messages
|
||||
:colorcolumn [81 100]
|
||||
:cmdheight 2
|
||||
; Better display for messages
|
||||
:undodir undo-dir
|
||||
:undolevels 1000
|
||||
:undoreload 10000
|
||||
:foldmethod "expr"
|
||||
:foldmethod :expr
|
||||
:foldexpr "nvim_treesitter#foldexpr()"
|
||||
:foldlevelstart 100
|
||||
:foldlevel 99
|
||||
:tabstop 2
|
||||
:shiftwidth 2
|
||||
:softtabstop 2
|
||||
:mouse ""
|
||||
:list true
|
||||
:listchars "tab:➥\\ ,trail:·"
|
||||
:backspace "indent,eol,start" ;allow backspacing over everything in insert mode
|
||||
:listchars "tab:➥\\ ,trail:·,nbsp:■"
|
||||
:backspace "indent,eol,start"
|
||||
;allow backspacing over everything in insert mode
|
||||
:wildmode "list:longest,list:full"
|
||||
:wrap false
|
||||
})
|
||||
:wrap false})
|
||||
|
||||
(defn- set-opt
|
||||
[[opt val]]
|
||||
(tset vim.opt (a.str opt) val))
|
||||
(local append-val-opts {:diffopt "algorithm:patience"})
|
||||
|
||||
(defn- set-opt-on
|
||||
[opt]
|
||||
(set-opt [opt true]))
|
||||
(fn set-opt [[opt val]] (tset vim.opt (a.str opt) val))
|
||||
|
||||
(fn set-opt+ [[opt val]]
|
||||
(let [existing-opt-val (a.get vim.o opt)]
|
||||
(tset vim.opt (a.str opt) (a.str existing-opt-val "," val))))
|
||||
|
||||
(fn set-opt-on [opt] (set-opt [opt true]))
|
||||
|
||||
(a.map set-opt-on on-opts)
|
||||
|
||||
(a.map-indexed set-opt val-based-opts)
|
||||
|
||||
(nvim.ex.syntax "on")
|
||||
(nvim.ex.colorscheme :soluarized)
|
||||
(a.map-indexed set-opt+ append-val-opts)
|
||||
|
||||
(vim.cmd.syntax :on)
|
||||
;; (nvim.ex.colorscheme :soluarized)
|
||||
(vim.cmd.colorscheme :solarized8)
|
||||
|
||||
;; (nvim.ex.autocmd "vimenter" "*" "++nested" "colorscheme" "soluarized")
|
||||
|
||||
(vim.api.nvim_create_autocmd [:vimenter]
|
||||
{:pattern "*"
|
||||
:command "colorscheme solarized8"
|
||||
:nested true})
|
||||
|
||||
(nvim.ex.autocmd "vimenter" "*" "++nested" "colorscheme" "solarized8")
|
||||
;(nvim.ex.autocmd "vimenter" "*" "luafile" "treesitter.lua")
|
||||
;
|
||||
; (nvim.fn.glob "~/.vimrc.local")
|
||||
|
||||
(defn make-fennel-scratch
|
||||
[]
|
||||
(nvim.command "new | setlocal bt=nofile bh=wipe nobl noswapfile nu filetype=fennel"))
|
||||
(fn make-fennel-scratch []
|
||||
(vim.cmd "new | setlocal bt=nofile bh=wipe nobl noswapfile nu filetype=fennel"))
|
||||
|
||||
(vim.api.nvim_create_user_command :FennelScratchBuffer make-fennel-scratch {})
|
||||
|
||||
(nu.fn-bridge :FennelScratchBuffer :dotfiles.core :make-fennel-scratch {:return false})
|
||||
(u.nnoremap :<leader>fsb ":call FennelScratchBuffer ()<CR>")
|
||||
|
||||
(defn compile-fnl []
|
||||
(print :recompiling)
|
||||
(anenv.init
|
||||
{:force true
|
||||
:init :dotfiles.init}))
|
||||
|
||||
(nu.fn-bridge :AniseedCompile :dotfiles.core :compile-fnl {:return false})
|
||||
@@ -1,15 +1,22 @@
|
||||
(module dotfiles.init
|
||||
{autoload
|
||||
{a aniseed.core}
|
||||
require
|
||||
{nvim aniseed.nvim}})
|
||||
(local a (require :nfnl.core))
|
||||
(local str (require :nfnl.string))
|
||||
(local fs (require :nfnl.fs))
|
||||
|
||||
(fn require-all []
|
||||
(let [require-exclusions (a.->set [:init])]
|
||||
(->> (fs.relglob :fnl/dotfiles :*.fnl)
|
||||
(a.map #(a.first (str.split $ :.fnl)))
|
||||
(a.filter #(not (a.contains? require-exclusions $)))
|
||||
(a.map #(.. :dotfiles. $))
|
||||
;(a.map #(require $))
|
||||
)))
|
||||
|
||||
(require :dotfiles.plugins)
|
||||
;; (require-all)
|
||||
(require :dotfiles.core)
|
||||
;; (require :dotfiles.plugins)
|
||||
(require :dotfiles.mapping)
|
||||
(require :dotfiles.conceal)
|
||||
(require :dotfiles.zoom-toggle)
|
||||
|
||||
;(nvim.ex.source "~/.vimrc")
|
||||
|
||||
(a.println "(re)loaded")
|
||||
@@ -1,39 +1,43 @@
|
||||
(module dotfiles.mapping
|
||||
{autoload {nvim aniseed.nvim
|
||||
nu aniseed.nvim.util
|
||||
core aniseed.core}})
|
||||
(local util (require :dotfiles.util))
|
||||
(local nfnl (require :nfnl.api))
|
||||
|
||||
(defn- noremap [mode from to]
|
||||
|
||||
(fn noremap [mode from to]
|
||||
"Sets a mapping with {:noremap true}."
|
||||
(nvim.set_keymap mode from to {:noremap true}))
|
||||
(vim.keymap.set mode from to {:noremap true}))
|
||||
|
||||
; (set nvim.g.mapleader "\\")
|
||||
|
||||
(noremap :n "<leader>`" ":source ~/.config/nvim/init.lua<CR>")
|
||||
(noremap :n "<leader>!" ":call AniseedCompile()<CR>")
|
||||
(vim.keymap.set :n "<leader>`"
|
||||
(fn []
|
||||
(nfnl.compile-all-files (vim.fn.stdpath :config))
|
||||
(vim.cmd.source (.. (vim.fn.stdpath :config) :/init.lua))))
|
||||
|
||||
; (noremap :n "<leader>`" ":source ~/.config/nvim/init.lua<CR>")
|
||||
|
||||
(noremap :n :<Enter> ":nohlsearch<Enter>/<BS>")
|
||||
|
||||
;; Correct to first spelling suggestion.
|
||||
(noremap :n :<leader>zz ":normal! 1z=<cr>")
|
||||
|
||||
|
||||
;; nice paste from clipboard in insert mode
|
||||
(noremap :i :<C-V><C-O> ":set paste<CR><C-R><C-R>+<C-O>:set nopaste<CR>")
|
||||
|
||||
|
||||
; Insert Date
|
||||
(noremap :n :<F5> "\"=strftime(\"%F\")<CR>p")
|
||||
(noremap :i :<F5> "<C-R>=strftime(\"%F\")<CR>")
|
||||
(noremap :n :<M-5> "\"=trim(system('date -u'))<CR>p")
|
||||
(noremap :i :<M-5> "<C-R>=trim(system('date -u'))<CR>")
|
||||
|
||||
; Make markdown link with empty url
|
||||
;map <Leader>ah S<a href="" target="_blank" rel="noopener noreferrer"><CR>
|
||||
(noremap :v :<leader>ah "S<a href=\"\" target=\"_blank\" rel=\"nopener noreferrer\"><CR>")
|
||||
(noremap :v :<leader>ah
|
||||
"S<a href=\"\" target=\"_blank\" rel=\"nopener noreferrer\"><CR>")
|
||||
|
||||
(noremap :v :<leader>ml "xi[<c-r>\"]()<esc>")
|
||||
|
||||
|
||||
(noremap :n :<C-e> "3<C-e>")
|
||||
(noremap :n :<C-y> "3<C-y>")
|
||||
(noremap :n :<C-e> :3<C-e>)
|
||||
(noremap :n :<C-y> :3<C-y>)
|
||||
|
||||
; Unimpaired configuration
|
||||
; Bubble single lines
|
||||
@@ -54,8 +58,57 @@
|
||||
(noremap :n :gsh ":GitGutterStageHunk<CR>")
|
||||
|
||||
; Open file in Marked 2 (markdown viewer)
|
||||
(noremap :n :<leader>mv ":AsyncRun -mode=bang open -a Marked\\ 2.app \'%:p\'<cr>")
|
||||
(noremap :n :<leader>mv ":AsyncRun -mode=bang open -a Marked\\ 2.app '%:p'<cr>")
|
||||
|
||||
; Run current statement in DadBod-UI
|
||||
(nvim.ex.autocmd :FileType :sql :nmap :<leader>s "vap<leader>S")
|
||||
;; (nvim.ex.autocmd :FileType :sql :nmap :<leader>s :vap<leader>S)
|
||||
(vim.api.nvim_create_autocmd [:FileType]
|
||||
{:pattern :sql
|
||||
:command "nmap <leader>s vap<leader>S"})
|
||||
|
||||
(noremap :n :Q ":.!bash <CR>")
|
||||
|
||||
; Ruby old hash syntax to new hash syntax
|
||||
;(util/lvnoremap :uhs "<C-U>s/\\([a-z][^ \\t]*\\) =>/\\1:/ge" )
|
||||
;(util/lnnoremap :uhs "<C-U>s/\\([a-z][^ \\t]*\\) =>/\\1:/ge" )
|
||||
|
||||
; Trim trailing Whitespace in visual selection
|
||||
(util.lvnoremap :tw "<C-U>s/\\s\\+$//ge<CR>:nohlsearch<Enter>/<BS>")
|
||||
|
||||
; Trim trailing Whitespace in current line
|
||||
(util.lnnoremap :tw "<C-U>.s/\\s\\+$//ge<CR>:nohlsearch<Enter>/<BS>")
|
||||
|
||||
;; <Leader><C-l> in terminal to clear scrollback buffer
|
||||
;; nmap <silent> <leader><C-l> :set scrollback=1 \| set scrollback=100000<cr>
|
||||
(util.lnnoremap :<C-k> ":set scrollback=1 | :set scrollback 100000<cr>"
|
||||
{:silent true})
|
||||
|
||||
;; tmap <silent> <leader><C-l> <C-\><C-n><leader><C-l>i
|
||||
(util.ltnoremap :<C-k> "<C-\\><C-n><leader><C-l>i" {:silent true})
|
||||
|
||||
;; (noremap :n :<C-A-l> ":echo \"test\"\n")
|
||||
; Window switching
|
||||
; ˙ -> alt-h
|
||||
; ∆ -> alt-j
|
||||
; ˚ -> alt-k
|
||||
; ¬ -> alt-l
|
||||
;; Terminal mode
|
||||
;; (noremap :t "˙" "<c-\\><c-n><c-w>h")
|
||||
;; (noremap :t "∆" "<c-\\><c-n><c-w>j")
|
||||
;; (noremap :t "˚" "<c-\\><c-n><c-w>k")
|
||||
;; (noremap :t "¬" "<c-\\><c-n><c-w>l")
|
||||
;; ;; Insert mode:
|
||||
;; (noremap :i "˙" :<Esc><c-w>h)
|
||||
;; (noremap :i "∆" :<Esc><c-w>j)
|
||||
;; (noremap :i "˚" :<Esc><c-w>k)
|
||||
;; (noremap :i "¬" :<Esc><c-w>l)
|
||||
;; ;; Visual mode:
|
||||
;; (noremap :v "˙" :<Esc><c-w>h)
|
||||
;; (noremap :v "∆" :<Esc><c-w>j)
|
||||
;; (noremap :v "˚" :<Esc><c-w>k)
|
||||
;; (noremap :v "¬" :<Esc><c-w>l)
|
||||
;; ;; Normal mode:
|
||||
;; (noremap :n "˙" :<c-w>h)
|
||||
;; (noremap :n "∆" :<c-w>j)
|
||||
;; (noremap :n "˚" :<c-w>k)
|
||||
;; (noremap :n "¬" :<c-w>l)
|
||||
@@ -1,27 +1,24 @@
|
||||
(module dotfiles.plugin.cmp
|
||||
{autoload {nvim aniseed.nvim}})
|
||||
(local cmp (require :cmp))
|
||||
(local luasnip (require :luasnip))
|
||||
|
||||
(local cmp-src-menu-items {:buffer :buff :conjure :conj :nvim_lsp :lsp})
|
||||
|
||||
(module config.plugin.cmp
|
||||
{autoload {nvim aniseed.nvim
|
||||
cmp cmp}})
|
||||
|
||||
(def- cmp-src-menu-items
|
||||
{:buffer "buff"
|
||||
:conjure "conj"
|
||||
:nvim_lsp "lsp"})
|
||||
|
||||
(def- cmp-srcs
|
||||
[{:name :nvim_lsp}
|
||||
(local cmp-srcs [{:name :nvim_lsp}
|
||||
{:name :nvim_lua}
|
||||
{:name :luasnip}
|
||||
{:name :vsnip}
|
||||
{:name :conjure}
|
||||
{:name :buffer}])
|
||||
{:name :buffer}
|
||||
{:name :orgmode}
|
||||
{:name :emoji :max_item_count 8}])
|
||||
|
||||
;; Setup cmp with desired settings
|
||||
(let [cmp (require :cmp)]
|
||||
(cmp.setup {:formatting
|
||||
{:format (fn [entry item]
|
||||
(set item.menu (or (. cmp-src-menu-items entry.source.name) ""))
|
||||
(cmp.setup {:formatting {:format (fn [entry item]
|
||||
(set item.menu
|
||||
(or (. cmp-src-menu-items
|
||||
entry.source.name)
|
||||
""))
|
||||
item)}
|
||||
:mapping {:<C-p> (cmp.mapping.select_prev_item)
|
||||
:<C-n> (cmp.mapping.select_next_item)
|
||||
@@ -29,14 +26,13 @@
|
||||
:<C-f> (cmp.mapping.scroll_docs 4)
|
||||
:<C-Space> (cmp.mapping.complete)
|
||||
:<C-e> (cmp.mapping.close)
|
||||
:<CR> (cmp.mapping.confirm {:behavior cmp.ConfirmBehavior.Insert
|
||||
:<C-y> (cmp.mapping.confirm {;; :behavior cmp.ConfirmBehavior.Insert
|
||||
:select true})}
|
||||
|
||||
:snippet {:expand (fn [args]
|
||||
(nvim.fn.vsnip#anonymous args.body))}
|
||||
(if args
|
||||
(luasnip.lsp_expand args.body)))}
|
||||
:sources cmp-srcs}))
|
||||
|
||||
|
||||
;;; imap <expr> <C-j> vsnip#available(1) ? '<Plug>(vsnip-expand)' : '<C-j>'
|
||||
;;; imap <expr> <C-l> vsnip#available(1) ? '<Plug>(vsnip-expand-or-jump)' : '<C-l>'
|
||||
;;; smap <expr> <C-l> vsnip#available(1) ? '<Plug>(vsnip-expand-or-jump)' : '<C-l>'
|
||||
@@ -1,13 +1,18 @@
|
||||
(module dotfiles.plugin.colorizer
|
||||
{autoload {colorizer colorizer}})
|
||||
|
||||
(colorizer.setup {"*" {}}
|
||||
{:RGB true ; #RGB hex codes, like #F00
|
||||
:RRGGBB true ; #RRGGBB hex codes, like #00FF00
|
||||
:names true ; "Name" codes like Blue
|
||||
:RRGGBBAA true ; #RRGGBBAA hex codes
|
||||
:rgb_fn true ; CSS rgb() and rgba() functions
|
||||
:hsl_fn true ; CSS hsl() and hsla() functions
|
||||
:css true ; Enable all CSS features: rgb_fn, hsl_fn, names, RGB, RRGGBB
|
||||
:css_fn true ; Enable all CSS *functions*: rgb_fn, hsl_fn
|
||||
})
|
||||
(let [colorizer (require :colorizer)]
|
||||
(colorizer.setup ["*"] {:RGB true
|
||||
; #RGB hex codes, like #F00
|
||||
:RRGGBB true
|
||||
; #RRGGBB hex codes, like #00FF00
|
||||
:names true
|
||||
; "Name" codes like Blue
|
||||
:RRGGBBAA true
|
||||
; #RRGGBBAA hex codes
|
||||
:rgb_fn true
|
||||
; CSS rgb() and rgba() functions
|
||||
:hsl_fn true
|
||||
; CSS hsl() and hsla() functions
|
||||
:css true
|
||||
; Enable all CSS features: rgb_fn, hsl_fn, names, RGB, RRGGBB
|
||||
:css_fn true
|
||||
; Enable all CSS *functions*: rgb_fn, hsl_fn
|
||||
}))
|
||||
@@ -1,35 +0,0 @@
|
||||
(module dotfiles.plugin.compe
|
||||
{autoload {nvim aniseed.nvim}})
|
||||
|
||||
(set nvim.o.completeopt "menuone,noselect")
|
||||
|
||||
(let [compe (require :compe)]
|
||||
(when compe
|
||||
(compe.setup
|
||||
{:enabled true
|
||||
:autocomplete true
|
||||
:debug false
|
||||
:min_length 1
|
||||
:preselect "enable"
|
||||
:throttle_time 80
|
||||
:source_timeout 200
|
||||
:incomplete_delay 400
|
||||
:max_abbr_width 100
|
||||
:max_kind_width 100
|
||||
:max_menu_width 100
|
||||
:documentation true
|
||||
:source {:path true
|
||||
:buffer true
|
||||
:calc true
|
||||
:emoji true
|
||||
:nvim_lsp true
|
||||
:nvim_lua true
|
||||
:conjure true
|
||||
:vsnip true
|
||||
:vim_dadbod_completion true}})))
|
||||
|
||||
(nvim.ex.inoremap "<silent><expr> <C-Space> compe#complete()")
|
||||
(nvim.ex.inoremap "<silent><expr> <CR> compe#confirm('<CR>')")
|
||||
(nvim.ex.inoremap "<silent><expr> <C-e> compe#close('<C-e>')")
|
||||
(nvim.ex.inoremap "<silent><expr> <C-f> compe#scroll({ 'delta': +4 })")
|
||||
(nvim.ex.inoremap "<silent><expr> <C-d> compe#scroll({ 'delta': -4 })")
|
||||
@@ -1,12 +1,13 @@
|
||||
(module dotfiles.plugin.conjure
|
||||
{autoload {a aniseed.core
|
||||
conjure-config conjure.config
|
||||
nvim aniseed.nvim}})
|
||||
(local core (require :nfnl.core))
|
||||
(local conjure-config (require :conjure.config))
|
||||
|
||||
; (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)
|
||||
(set vim.g.conjure#mapping#doc_word :gk)
|
||||
(set vim.g.conjure#client#clojure#nrepl#mapping#session_clone :sC)
|
||||
(set vim.g.conjure#extract#tree_sitter#enabled true)
|
||||
|
||||
(conjure-config.assoc-in [:filetypes] (a.concat (conjure-config.filetypes) [:markdown] ))
|
||||
(conjure-config.assoc-in [:filetype :markdown] "conjure.client.clojure.nrepl")
|
||||
(conjure-config.assoc-in [:filetypes]
|
||||
(core.concat (conjure-config.filetypes) [:markdown]))
|
||||
|
||||
(conjure-config.assoc-in [:filetype :markdown] :conjure.client.clojure.nrepl)
|
||||
@@ -1,4 +0,0 @@
|
||||
(module dotfiles.plugin.dadbodui
|
||||
{autoload { nvim aniseed.nvim }})
|
||||
|
||||
|
||||
@@ -1,5 +1,2 @@
|
||||
(module dotfiles.plugin.easyalign
|
||||
{autoload {nvim aniseed.nvim
|
||||
util dotfiles.util }})
|
||||
|
||||
(util.noremap :v :<leader><bslash> "EasyAlign*<Bar>")
|
||||
(let [util (require :dotfiles.util)]
|
||||
(util.noremap :v :<leader><bslash> :EasyAlign*<Bar>))
|
||||
@@ -0,0 +1,13 @@
|
||||
(local util (require :dotfiles.util))
|
||||
;; Determine load time of fugitive
|
||||
;; (vim.api.nvim_create_autocmd [:FileType] {:pattern ftype :callback setup-conceals})
|
||||
|
||||
(fn bufmap [mode from to] (util.noremap mode from to {:local? true}))
|
||||
|
||||
(fn map-fugitive-keys []
|
||||
(bufmap :n :<leader>gp ":Git pull<CR>")
|
||||
(bufmap :n :<leader>gP ":Git push<CR>")
|
||||
(bufmap :n :<leader>gF ":Git push -f<CR>"))
|
||||
|
||||
(vim.api.nvim_create_autocmd [:FileType]
|
||||
{:pattern :fugitive :callback map-fugitive-keys})
|
||||
@@ -0,0 +1 @@
|
||||
(local headlines (require :headlines))
|
||||
@@ -0,0 +1,3 @@
|
||||
(let [hex (require :hex)]
|
||||
(when hex
|
||||
(hex.setup)))
|
||||
@@ -1,84 +1,133 @@
|
||||
(module dotfiles.plugin.lspconfig
|
||||
{autoload
|
||||
{a aniseed.core
|
||||
u dotfiles.util
|
||||
nvim aniseed.nvim
|
||||
nu aniseed.nvim.util
|
||||
}
|
||||
})
|
||||
(local a (require :nfnl.core))
|
||||
(local u (require :dotfiles.util))
|
||||
(local lsp (require :vim.lsp))
|
||||
(local lspconfig (require :lspconfig))
|
||||
(local cmp_nvim_lsp (require :cmp_nvim_lsp))
|
||||
|
||||
(defn bufmap [mode from to]
|
||||
(u.noremap mode from to {:local? true}))
|
||||
(fn bufmap [mode from to opts]
|
||||
(u.noremap mode from to (a.merge {:local? true} opts)))
|
||||
|
||||
(defn nbufmap [from to]
|
||||
(bufmap :n from to))
|
||||
(fn nbufmap [from to opts] (bufmap :n from to opts))
|
||||
|
||||
(defn xbufmap [from to]
|
||||
(bufmap :x from to))
|
||||
(fn xbufmap [from to opts] (bufmap :x from to opts))
|
||||
|
||||
(fn lsp-execute-command [client cmd ...]
|
||||
(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 [...])]
|
||||
;;(client.exec_cmd {:command cmd :arguments args} {:bufnr 0})
|
||||
(client.request_sync :workspace/executeCommand
|
||||
{:command cmd :arguments args} nil 0)))
|
||||
|
||||
(defn define-sign [level sign]
|
||||
(let [sign-level (.. "DiagnosticSign" level)]
|
||||
(nvim.fn.sign_define sign-level
|
||||
{:texthl sign-level
|
||||
:text sign
|
||||
:numhl sign-level})))
|
||||
(vim.diagnostic.config {:signs {:text {vim.diagnostic.severity.ERROR "☢️"
|
||||
vim.diagnostic.severity.WARN "⚠️"
|
||||
vim.diagnostic.severity.INFO "ℹ️"
|
||||
vim.diagnostic.severity.HINT "🔎"}
|
||||
;; :linehl {vim.diagnostic.severity.ERROR :ErrorMsg}
|
||||
;; :numhl {vim.diagnostic.severity.WARN :WarningMsg}
|
||||
}})
|
||||
|
||||
; (define-sign :Error "☢️")
|
||||
; (define-sign :Warn "⚠️")
|
||||
; (define-sign :SignHint "🔎")
|
||||
; (define-sign :Info "ℹ️")
|
||||
(define-sign :Error "X")
|
||||
(define-sign :Warn "!")
|
||||
(define-sign :SignHint "?")
|
||||
(define-sign :Info "i")
|
||||
|
||||
(def core-nmappings
|
||||
{
|
||||
:gd "lua vim.lsp.buf.definition()"
|
||||
(local 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.diagnostic.goto_prev()"
|
||||
"]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>cl "lua vim.lsp.codelens.run()"
|
||||
:<leader>ic "lua vim.lsp.buf.incoming_calls()"
|
||||
:<leader>oc "lua vim.lsp.buf.outgoing_calls()"
|
||||
;; TODO: think of new mapping; conficts with org mode
|
||||
;; :<leader>oc "lua vim.lsp.buf.outgoing_calls()"
|
||||
:<leader>sld "lua vim.diagnostic.open_float(nil, {source = 'always'})"
|
||||
:<leader>rn "lua vim.lsp.buf.rename()"
|
||||
:<leader>fa "lua vim.lsp.buf.formatting_sync()"
|
||||
})
|
||||
:<leader>fa "lua vim.lsp.buf.format()"})
|
||||
|
||||
(def client-nmappings
|
||||
{:clojure_lsp
|
||||
{
|
||||
:<leader>cn "call LspExecuteCommand('clean-ns')"
|
||||
:<leader>ref "call LspExecuteCommand('extract-function', input('Function name: '))"
|
||||
:<leader>id "call LspExecuteCommand('inline-symbol')"
|
||||
:<leader>il "call LspExecuteCommand('introduce-let', input('Binding name: '))"
|
||||
:<leader>m2l "call LspExecuteCommand('move-to-let', input('Binding name: '))"
|
||||
}
|
||||
})
|
||||
(local client-nmappings {:clojure_lsp {;;:<leader>cn "call LspExecuteCommand('clean-ns')"
|
||||
;; :<leader>ref "call LspExecuteCommand('extract-function', input('Function name: '))"
|
||||
;; :<leader>id "call LspExecuteCommand('inline-symbol')"
|
||||
;; :<leader>il "call LspExecuteCommand('introduce-let', input('Binding name: '))"
|
||||
;;:<leader>m2l "call LspExecuteCommand('move-to-let', input('Binding name: '))"
|
||||
}})
|
||||
|
||||
;;(vim.fn.input "foo: ")
|
||||
|
||||
(defn bind-client-mappings [client]
|
||||
(local client-command-lnmappings
|
||||
{:clojure_lsp {:ai [:add-import-to-namespace
|
||||
[(lambda [] (vim.fn.input "Namespace name: "))]]
|
||||
:am [:add-missing-libspec []]
|
||||
:as [:add-require-suggestion
|
||||
[(lambda [] (vim.fn.input "Namespace name: "))
|
||||
(lambda [] (vim.fn.input "Namespace as: "))
|
||||
(lambda [] (vim.fn.input "Namespace name: "))]]
|
||||
:cc [:cycle-coll []]
|
||||
:cn [:clean-ns []]
|
||||
:cp [:cycle-privacy []]
|
||||
:ct [:create-test []]
|
||||
:df [:drag-forward []]
|
||||
:db [:drag-backward []]
|
||||
:df [:drag-forward []]
|
||||
:dk [:destructure-keys []]
|
||||
:ed [:extract-to-def
|
||||
[(lambda [] (vim.fn.input "Definition name: "))]]
|
||||
:ref [:extract-function
|
||||
[(lambda [] (vim.fn.input "Function name: "))]]
|
||||
:el [:expand-let []]
|
||||
:fe [:create-function []]
|
||||
:il [:introduce-let
|
||||
[(lambda [] (vim.fn.input "Binding name: "))]]
|
||||
:is [:inline-symbol []]
|
||||
:ma [:resolve-macro-as []]
|
||||
:mf [:move-form
|
||||
[(lambda [] (vim.fn.input "File name: "))]]
|
||||
:ml [:move-to-let
|
||||
[(lambda [] (vim.fn.input "Binding name: "))]]
|
||||
:pf [:promote-fn
|
||||
[(lambda [] (vim.fn.input "Function name: "))]]
|
||||
:sc [:change-collection
|
||||
[(lambda [] (vim.fn.input ""))
|
||||
"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 []]}})
|
||||
|
||||
(local server-specific-opts {})
|
||||
|
||||
(fn bind-client-mappings [client]
|
||||
(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
|
||||
(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)
|
||||
;;lsp-cmd (.. client-name "." (a.first command-mapping))
|
||||
;;opts (a.second command-mapping)
|
||||
mapping (.. :<leader> lnmapping)
|
||||
cmd (lambda []
|
||||
(let [opts (accumulate [s "" _i opt (ipairs (a.second command-mapping))]
|
||||
(.. s
|
||||
(if (= :function (type opt))
|
||||
(opt)
|
||||
opt)))]
|
||||
(lsp-execute-command client lsp-cmd opts)))]
|
||||
(nbufmap mapping cmd {:desc (.. "LSP command `" lsp-cmd "`")}))))))
|
||||
|
||||
(defn on_attach [client bufnr]
|
||||
(fn on_attach [client bufnr]
|
||||
(each [mapping cmd (pairs core-nmappings)]
|
||||
(nbufmap mapping cmd))
|
||||
|
||||
; x mode mappings
|
||||
(xbufmap :<leader>fa "lua vim.lsp.buf.formatting_sync()")
|
||||
|
||||
; -- buf_set_keymap('n', 'gs', '<Cmd>lua vim.lsp.buf.document_symbol()<CR>', opts)
|
||||
(nbufmap mapping cmd {})) ; x mode mappings
|
||||
(xbufmap :<leader>fa "lua vim.lsp.buf.format()" {:desc "Format buffer"}) ; -- 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)
|
||||
@@ -87,109 +136,57 @@
|
||||
; -- 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)
|
||||
|
||||
(nvim.buf_set_option 0 :omnifunc "v:lua.vim.lsp.omnifunc")
|
||||
|
||||
(vim.api.nvim_set_option_value :omnifunc "v:lua.vim.lsp.omnifunc" {:buf 0})
|
||||
(bind-client-mappings client)
|
||||
(nvim.ex.autocmd :BufWritePre :<buffer> :lua "vim.lsp.buf.formatting_sync()")
|
||||
; (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'})]]
|
||||
|
||||
(when client.server_capabilities.documentHighlightProvider
|
||||
(each [hlgroup base-group (pairs {:LspReferenceRead :SpecialKey
|
||||
:LspReferenceText :SpecialKey
|
||||
:LspReferenceWrite :SpecialKey})]
|
||||
(vim.api.nvim_set_hl 0 hlgroup
|
||||
(a.merge (vim.api.nvim_get_hl_by_name base-group
|
||||
true)
|
||||
{:italic true
|
||||
:foreground "#6c71c4"
|
||||
:background :NONE})))
|
||||
(let [group (vim.api.nvim_create_augroup :LspDocumentHighlight
|
||||
{:clear true})]
|
||||
(vim.api.nvim_create_autocmd [:CursorHold :CursorHoldI]
|
||||
{: group
|
||||
:pattern :<buffer>
|
||||
:callback (lambda []
|
||||
(vim.lsp.buf.document_highlight))})
|
||||
(vim.api.nvim_create_autocmd [:CursorMoved]
|
||||
{: group
|
||||
:pattern :<buffer>
|
||||
:callback (lambda []
|
||||
(vim.lsp.buf.clear_references))})))
|
||||
(if client.server_capabilities.documentFormattingProvider
|
||||
(vim.api.nvim_create_autocmd [:BufWritePre]
|
||||
{:pattern :<buffer>
|
||||
:callback (lambda [] (vim.lsp.buf.format))}))
|
||||
(print "LSP Client Attached."))
|
||||
|
||||
(let [lspi (require :nvim-lsp-installer)]
|
||||
(when lspi
|
||||
(local base-server-opts
|
||||
(let [capabilities (cmp_nvim_lsp.default_capabilities (lsp.protocol.make_client_capabilities))]
|
||||
{: on_attach : capabilities :flags {:debounce_text_changes 150}}))
|
||||
|
||||
(defn lsp-execute-command [cmd ...]
|
||||
(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})))
|
||||
(fn default-server-handler [server-name]
|
||||
(let [specific-opts (a.get server-specific-opts server-name {})
|
||||
server-opts (a.merge base-server-opts specific-opts)]
|
||||
(vim.lsp.config server-name server-opts)))
|
||||
|
||||
(defn setup-servers []
|
||||
(lspi.on_server_ready (fn [server]
|
||||
(let [opts {:on_attach on_attach :flags {:debounce_text_changes 150} }]
|
||||
(server:setup opts))))
|
||||
;; (let [lspconfig (require :lspconfig)
|
||||
;; servers (lspi.get_installed_servers)]
|
||||
;; (each [_ server (pairs servers)]
|
||||
;; (server.setup {:on_attach on_attach :flags {:debounce_text_changes 150} })))
|
||||
)
|
||||
(fn setup-handlers [language_servers]
|
||||
(each [_ server-name (pairs language_servers)]
|
||||
(default-server-handler server-name)))
|
||||
|
||||
(defn on-post-install []
|
||||
(setup-servers)
|
||||
(nvim.ex.bufdo :e))
|
||||
(u.nnoremap :<leader>li :LspInfo)
|
||||
|
||||
(setup-servers)
|
||||
(vim.api.nvim_create_user_command :LspExecuteCommand lsp-execute-command
|
||||
{:nargs "+"})
|
||||
|
||||
(set lspi.post_install_hook on-post-install)
|
||||
(nu.fn-bridge :LspExecuteCommand :dotfiles.plugin.lspconfig :lsp-execute-command {:return false})
|
||||
; (let [mason-lspconfig (require :mason-lspconfig)]
|
||||
; (when mason-lspconfig
|
||||
; (mason-lspconfig.setup)
|
||||
; (mason-lspconfig.setup_handlers [default-server-handler])))
|
||||
|
||||
(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")
|
||||
;;
|
||||
;; )
|
||||
;;
|
||||
{: on_attach : default-server-handler : setup-handlers}
|
||||
@@ -0,0 +1,17 @@
|
||||
(let [luasnip (require :luasnip)
|
||||
select_choice (require :luasnip.extras.select_choice)]
|
||||
(when luasnip
|
||||
(vim.keymap.set [:i :s] :<C-k>
|
||||
(fn []
|
||||
(if (luasnip.expand_or_jumpable)
|
||||
(luasnip.expand_or_jump)))
|
||||
{:silent true})
|
||||
(vim.keymap.set [:i :s] :<C-j>
|
||||
(fn []
|
||||
(if (luasnip.jumpable -1)
|
||||
(luasnip.jump -1))) {:silent true})
|
||||
(vim.keymap.set :i :<C-l>
|
||||
(fn []
|
||||
(if (luasnip.choice_active)
|
||||
(luasnip.choice 1))))
|
||||
(vim.keymap.set :i :<C-u> select_choice)))
|
||||
@@ -0,0 +1,16 @@
|
||||
(local mason (require :mason))
|
||||
(local mason-lspconf (require :mason-lspconfig))
|
||||
(local lspconfig (require :dotfiles.plugin.lspconfig))
|
||||
|
||||
(fn setup []
|
||||
(mason.setup {:ui {:icons {:package_installed "✓"}}})
|
||||
(when mason-lspconf
|
||||
(mason-lspconf.setup {:ensure_installed [:lua_ls] :automatic_enable true})
|
||||
(lspconfig.setup-handlers (mason-lspconf.get_installed_servers))))
|
||||
|
||||
(setup)
|
||||
;; (mason.setup)
|
||||
;;
|
||||
;; (when-let [mason-lspconfig (require :mason-lspconfig)]
|
||||
;; (mason-lspconfig.setup)
|
||||
;; (mason-lspconfig.setup_handlers {1 default-server-handler}))
|
||||
@@ -0,0 +1,2 @@
|
||||
(local nfnl (require :nfnl))
|
||||
(nfnl.setup {:compile_on_write true})
|
||||
@@ -0,0 +1,8 @@
|
||||
(let [null-ls (require :null-ls)
|
||||
lspconfig (require :dotfiles.plugin.lspconfig)]
|
||||
(when null-ls
|
||||
(local null-ls-server-options
|
||||
{:sources [null-ls.builtins.formatting.stylua
|
||||
null-ls.builtins.formatting.fnlfmt]
|
||||
:on_attach lspconfig.on_attach})
|
||||
(null-ls.setup null-ls-server-options)))
|
||||
@@ -0,0 +1,45 @@
|
||||
(local core (require :nfnl.core))
|
||||
(local conceal (require :dotfiles.conceal))
|
||||
(local ts-utils (require :dotfiles.ts-utils))
|
||||
(local stars ["◉" "⦾" "○" "✸" "✿" "✶" "•" "‣"])
|
||||
|
||||
(local stars-query "(headline (stars) @stars)")
|
||||
|
||||
(fn star-index [heading-level]
|
||||
(let [star-count (core.count stars)
|
||||
idx (math.fmod heading-level star-count)]
|
||||
(if (< 0 idx)
|
||||
idx
|
||||
star-count)))
|
||||
|
||||
(local extmark-namespace (vim.api.nvim_create_namespace :HeaderStars))
|
||||
|
||||
(local star-captures (ts-utils.make-query :org stars-query))
|
||||
|
||||
(fn gen-star-extmarks []
|
||||
(when (= :org vim.bo.filetype)
|
||||
(let [bufnr (vim.api.nvim_get_current_buf)
|
||||
star-count (core.count stars)]
|
||||
(vim.api.nvim_buf_clear_namespace bufnr extmark-namespace 0 -1)
|
||||
(each [id node metadata (star-captures bufnr)]
|
||||
(let [[start-line start-col end-row end-col] [(node:range)]
|
||||
heading-level (if (= start-line end-row)
|
||||
(- end-col start-col))
|
||||
star (core.get stars (star-index heading-level))
|
||||
replacement (string.format (core.str "%" (+ 2 heading-level) :s)
|
||||
star)]
|
||||
(vim.api.nvim_buf_set_extmark bufnr extmark-namespace start-line
|
||||
start-col
|
||||
{:end_col end-col
|
||||
:end_row end-row
|
||||
:virt_text [[replacement []]]
|
||||
:virt_text_pos :overlay
|
||||
:hl_mode :combine}))))))
|
||||
|
||||
(let [group (vim.api.nvim_create_augroup :HeaderStars {:clear true})]
|
||||
(vim.api.nvim_create_autocmd [:FileChangedShellPost
|
||||
:Syntax
|
||||
:TextChanged
|
||||
:InsertLeave
|
||||
:WinScrolled]
|
||||
{: group :callback conceal.setup-conceals}))
|
||||
@@ -0,0 +1,6 @@
|
||||
(let [orgmode (require :orgmode)]
|
||||
;;(orgmode.setup_ts_grammar)
|
||||
(orgmode.setup {:org_agenda_files ["~/Dropbox/org/*" "~/my-orgs/**/*"]
|
||||
:org_default_notes_file "~/Dropbox/org/refile.org"
|
||||
:mappings {:org {:org_toggle_checkbox :<C-.>}}})
|
||||
(require :dotfiles.plugin.orgbullets))
|
||||
@@ -1,8 +1,4 @@
|
||||
(module dotfiles.plugin.packer
|
||||
{autoload
|
||||
{u dotfiles.util}
|
||||
require
|
||||
{nvim aniseed.nvim}})
|
||||
(local u (require :dotfiles.util))
|
||||
|
||||
(u.nnoremap :<leader>pi :PackerInstall)
|
||||
(u.nnoremap :<leader>pu :PackerUpdate)
|
||||
@@ -0,0 +1,77 @@
|
||||
(local a (require :nfnl.core))
|
||||
;; (local treesitter (require :dotfiles.plugin.treesitter))
|
||||
(local ts-parsers (require :nvim-treesitter.parsers))
|
||||
(local ts-utils (require :nvim-treesitter.ts_utils))
|
||||
(local languagetree (require :vim.treesitter.languagetree))
|
||||
|
||||
(set vim.g.paredit_smartjump 1)
|
||||
|
||||
(fn list-member? [xs x]
|
||||
(a.some #(= x $1) (a.vals xs)))
|
||||
|
||||
(fn bool->int [bool] (if bool 1 0))
|
||||
|
||||
(fn int->bool [x] (if (= 0 x) false true))
|
||||
|
||||
(fn toggle-global! [x]
|
||||
(->> (a.get vim.g x)
|
||||
(int->bool)
|
||||
(not)
|
||||
(bool->int)
|
||||
(tset vim.g x)))
|
||||
|
||||
(fn language-at-cursor []
|
||||
(let [parser (ts-parsers.get_parser)
|
||||
current-node (ts-utils.get_node_at_cursor)
|
||||
range (if current-node [(current-node:range)])
|
||||
lang (if range
|
||||
(languagetree.language_for_range parser range))]
|
||||
(if lang
|
||||
(lang:lang))))
|
||||
|
||||
(fn parser-language []
|
||||
(let [parser (ts-parsers.get_parser)]
|
||||
(when parser
|
||||
(parser:lang))))
|
||||
|
||||
(local paredit-langs [:clojure
|
||||
:fennel
|
||||
:hy
|
||||
:janet
|
||||
:julia
|
||||
:lfe
|
||||
:lisp
|
||||
:racket
|
||||
:scheme
|
||||
:shen])
|
||||
|
||||
(local paredit-host-langs [:org :markdown :asciidoc])
|
||||
|
||||
(fn host-lang-in? [langs] (list-member? langs (parser-language)))
|
||||
|
||||
(fn paredit-lang? [lang] (list-member? paredit-langs lang))
|
||||
|
||||
(fn TreeSitterLangParedit []
|
||||
(when (host-lang-in? paredit-host-langs)
|
||||
(let [cursor-lang (language-at-cursor)]
|
||||
(when cursor-lang
|
||||
(->> cursor-lang
|
||||
(paredit-lang?)
|
||||
(bool->int)
|
||||
(set vim.g.paredit_mode))
|
||||
(vim.fn.PareditInitBuffer)))))
|
||||
|
||||
(vim.api.nvim_create_autocmd [:FileType]
|
||||
{:pattern :ruby
|
||||
:callback (lambda []
|
||||
(vim.fn.PareditInitBalancingAllBracketsBuffer))})
|
||||
|
||||
(vim.api.nvim_create_autocmd [:FileType]
|
||||
{:pattern :javascript
|
||||
:callback (lambda []
|
||||
(vim.fn.PareditInitBalancingAllBracketsBuffer))})
|
||||
|
||||
(vim.api.nvim_create_autocmd [:FileType]
|
||||
{:pattern :terraform
|
||||
:callback (lambda []
|
||||
(vim.fn.PareditInitBalancingAllBracketsBuffer))})
|
||||
@@ -0,0 +1,19 @@
|
||||
(let [smart-splits (require :smart-splits)]
|
||||
(when smart-splits
|
||||
(smart-splits.setup)
|
||||
;; recommended mappings
|
||||
;; resizing splits
|
||||
;; these keymaps will also accept a range,
|
||||
;; for example `10<A-h>` will `resize_left` by `(10 * config.default_amount)`
|
||||
(vim.keymap.set :n :<M-S-h> smart-splits.resize_left)
|
||||
(vim.keymap.set :n :<M-S-j> smart-splits.resize_down)
|
||||
(vim.keymap.set :n :<M-S-k> smart-splits.resize_up)
|
||||
(vim.keymap.set :n :<M-S-l> smart-splits.resize_right) ; ; moving between splits
|
||||
(vim.keymap.set :n :<M-h> smart-splits.move_cursor_left)
|
||||
(vim.keymap.set :n :<M-j> smart-splits.move_cursor_down)
|
||||
(vim.keymap.set :n :<M-k> smart-splits.move_cursor_up)
|
||||
(vim.keymap.set :n :<M-l> smart-splits.move_cursor_right) ; ; swapping buffers between windows
|
||||
(vim.keymap.set :n :<leader><leader>h smart-splits.swap_buf_left)
|
||||
(vim.keymap.set :n :<leader><leader>j smart-splits.swap_buf_down)
|
||||
(vim.keymap.set :n :<leader><leader>k smart-splits.swap_buf_up)
|
||||
(vim.keymap.set :n :<leader><leader>l smart-splits.swap_buf_right)))
|
||||
@@ -1,33 +1,45 @@
|
||||
(module dotfiles.plugin.telescope
|
||||
{autoload {nvim aniseed.nvim
|
||||
util dotfiles.util
|
||||
telescope telescope}})
|
||||
(local util (require :dotfiles.util))
|
||||
(local telescope (require :telescope))
|
||||
|
||||
(telescope.setup
|
||||
{:defaults
|
||||
{:vimgrep_arguments ["ag" "--nocolor" "--noheading"
|
||||
"--number" "--column" "--nobreak"
|
||||
"--smart-case" "--hidden" "--follow" ; "--skip-vcs-ignores"
|
||||
(local vimgrep_arguments [:ag
|
||||
:--nocolor
|
||||
:--noheading
|
||||
:--number
|
||||
:--column
|
||||
:--nobreak
|
||||
:--smart-case
|
||||
:--hidden
|
||||
; "--skip-vcs-ignores"
|
||||
; "-g" "!.git/"
|
||||
]}})
|
||||
:--ignore
|
||||
:.git
|
||||
:--follow])
|
||||
|
||||
(telescope.load_extension :projects)
|
||||
(telescope.load_extension :yank_history)
|
||||
|
||||
(telescope.setup {;; :defaults {: vimgrep_arguments}
|
||||
:pickers {:buffers {:mappings {:n {:d :delete_buffer}}}}
|
||||
:extensions {:projects {:projects {}}}})
|
||||
|
||||
(util.lnnoremap :ff "Telescope git_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 :ff "Telescope git_files hidden=true")
|
||||
(util.lnnoremap :f- "Telescope find_files")
|
||||
(util.lnnoremap :fg "Telescope live_grep")
|
||||
(util.lnnoremap "*" "Telescope grep_string")
|
||||
(util.lnnoremap :fb "Telescope buffers")
|
||||
(util.lnnoremap :fd "Telescope diagnostics")
|
||||
(util.lnnoremap :fH "Telescope help_tags")
|
||||
(util.lnnoremap :fh "Telescope oldfiles")
|
||||
(util.lnnoremap :fp "Telescope projects")
|
||||
(util.lnnoremap :fm "Telescope keymaps")
|
||||
(util.lnnoremap :fM "Telescope marks")
|
||||
(util.lnnoremap :ft "Telescope filetypes")
|
||||
(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")
|
||||
(util.lnnoremap :fy "Telescope yank_history")
|
||||
@@ -0,0 +1,27 @@
|
||||
(local toggleterm (require :toggleterm))
|
||||
|
||||
(toggleterm.setup {:open_mapping "<c-\\>"
|
||||
:start_in_insert true
|
||||
:insert_mappings true
|
||||
;; whether or not the open mapping applies in insert mode
|
||||
:terminal_mappings true
|
||||
;; whether or not the open mapping applies in the opened terminals
|
||||
:persist_size true
|
||||
:persist_mode true
|
||||
;; if set to true (default) the previous terminal mode will be remembered
|
||||
:autochdir true})
|
||||
|
||||
(fn set-terminal-keymaps []
|
||||
(vim.keymap.set :t :<esc> "<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-j> "<Cmd>wincmd j<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-w> "<C-\\><C-n><C-w>"))
|
||||
|
||||
(vim.api.nvim_create_user_command :SetTerminalKeymaps set-terminal-keymaps {})
|
||||
|
||||
(vim.api.nvim_create_autocmd [:TermOpen]
|
||||
{:pattern "term://*"
|
||||
:callback set-terminal-keymaps})
|
||||
@@ -1,22 +1,33 @@
|
||||
(module dotfiles.plugin.treesitter
|
||||
{autoload {treesitter nvim-treesitter.configs}})
|
||||
(local treesitter-configs (require :nvim-treesitter.configs))
|
||||
|
||||
(treesitter.setup
|
||||
{:highlight {:enable true
|
||||
:additional_vim_regex_highlighting false}
|
||||
(treesitter-configs.setup {:highlight {:enable true
|
||||
;; :additional_vim_regex_highlighting false
|
||||
:additional_vim_regex_highlighting [:org]}
|
||||
:ensure_installed :all
|
||||
; [:org]
|
||||
; :rainbow {:enable true
|
||||
; :extended_mode true
|
||||
; ; Also highlight non-bracket delimiters like html tags, boolean or table: lang -> boolean
|
||||
; :max_file_lines 10000
|
||||
; ; Do not enable for files with more than 1000 lines, int
|
||||
; :colors ["#dc322f"
|
||||
; ; red
|
||||
; "#b58900"
|
||||
; ; yellow
|
||||
; "#d33682"
|
||||
; ; magenta
|
||||
; "#859900"
|
||||
; ; green
|
||||
; "#2aa198"
|
||||
; ; cyan
|
||||
; "#268bd2"
|
||||
; ; blue
|
||||
; "#6c71c4"
|
||||
; ; violet / brmagenta
|
||||
; ]
|
||||
; ; table of hex strings
|
||||
; }
|
||||
|
||||
:rainbow {:enable true
|
||||
:extended_mode true ; Also highlight non-bracket delimiters like html tags, boolean or table: lang -> boolean
|
||||
:max_file_lines 10000 ; Do not enable for files with more than 1000 lines, int
|
||||
:colors [
|
||||
:#dc322f ; red
|
||||
:#b58900 ; yellow
|
||||
:#d33682 ; magenta
|
||||
:#859900 ; green
|
||||
:#2aa198 ; cyan
|
||||
:#268bd2 ; blue
|
||||
:#6c71c4 ; violet / brmagenta
|
||||
] ; table of hex strings
|
||||
}
|
||||
:playground {:enable true}
|
||||
})
|
||||
|
||||
; lua print(require('nvim-treesitter.parsers').get_parser():language_for_range({ require('nvim-treesitter.ts_utils').get_node_at_cursor():range() }):lang())
|
||||
@@ -0,0 +1,3 @@
|
||||
(let [which-key (require :which-key)]
|
||||
(when which-key
|
||||
(which-key.setup {})))
|
||||
@@ -0,0 +1,32 @@
|
||||
(local yanky (require :yanky))
|
||||
|
||||
(yanky.setup {:ring {:history_length 100
|
||||
:storage :shada
|
||||
:sync_with_numbered_registers true
|
||||
:cancel_event :update}
|
||||
:system_clipboard {:sync_with_ring true}})
|
||||
|
||||
(vim.keymap.set :n :p "<Plug>(YankyPutAfter)")
|
||||
(vim.keymap.set :n :P "<Plug>(YankyPutBefore)")
|
||||
(vim.keymap.set :n :gp "<Plug>(YankyGPutAfter)")
|
||||
(vim.keymap.set :n :gP "<Plug>(YankyGPutBefore)")
|
||||
(vim.keymap.set :n :<c-n> "<Plug>(YankyCycleForward)")
|
||||
(vim.keymap.set :n :<c-p> "<Plug>(YankyCycleBackward)")
|
||||
|
||||
(vim.keymap.set :n "]p" "<Plug>(YankyPutIndentAfterLinewise)")
|
||||
(vim.keymap.set :n "[p" "<Plug>(YankyPutIndentBeforeLinewise)")
|
||||
(vim.keymap.set :n "]P" "<Plug>(YankyPutIndentAfterLinewise)")
|
||||
(vim.keymap.set :n "[P" "<Plug>(YankyPutIndentBeforeLinewise)")
|
||||
|
||||
(vim.keymap.set :n :>p "<Plug>(YankyPutIndentAfterShiftRight)")
|
||||
(vim.keymap.set :n :<p "<Plug>(YankyPutIndentAfterShiftLeft)")
|
||||
(vim.keymap.set :n :>P "<Plug>(YankyPutIndentBeforeShiftRight)")
|
||||
(vim.keymap.set :n :<P "<Plug>(YankyPutIndentBeforeShiftLeft)")
|
||||
|
||||
(vim.keymap.set :n :=p "<Plug>(YankyPutAfterFilter)")
|
||||
(vim.keymap.set :n :=P "<Plug>(YankyPutBeforeFilter)")
|
||||
|
||||
(vim.keymap.set :x :p "<Plug>(YankyPutAfter)")
|
||||
(vim.keymap.set :x :P "<Plug>(YankyPutBefore)")
|
||||
(vim.keymap.set :x :gp "<Plug>(YankyGPutAfter)")
|
||||
(vim.keymap.set :x :gP "<Plug>(YankyGPutBefore)")
|
||||
@@ -1,123 +1,105 @@
|
||||
(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
|
||||
{
|
||||
:Olical/aniseed {}
|
||||
:Olical/conjure { :mod :conjure } ; Clojure
|
||||
:Olical/fennel.vim {} ; Fennel
|
||||
:airblade/vim-gitgutter {} ; Git
|
||||
:airblade/vim-gitgutter {} ; Git
|
||||
:clojure-vim/vim-jack-in {} ; Conjure support - jack-in with nrepl dependencies
|
||||
:folke/lsp-colors.nvim {}
|
||||
:hashivim/vim-terraform {} ; Terraform
|
||||
:hrsh7th/nvim-cmp {:requires [:hrsh7th/cmp-buffer
|
||||
:hrsh7th/cmp-nvim-lsp
|
||||
:hrsh7th/cmp-vsnip
|
||||
:hrsh7th/vim-vsnip-integ
|
||||
:PaterJason/cmp-conjure]
|
||||
:mod :cmp} ; autocomplete
|
||||
:hrsh7th/vim-vsnip {}
|
||||
:hrsh7th/vim-vsnip-integ {}
|
||||
:Iron-E/nvim-soluarized {}
|
||||
:jiangmiao/auto-pairs {} ; backets, parens, and quotes in pairs
|
||||
:junegunn/vim-easy-align {:mod :easyalign}
|
||||
:kovisoft/paredit {}
|
||||
:kristijanhusak/vim-dadbod-completion {}
|
||||
:kristijanhusak/vim-dadbod-ui {}
|
||||
:neovim/nvim-lspconfig {:mod :lspconfig} ; NeoVim lsp config
|
||||
:norcalli/nvim-colorizer.lua {:mode :colorizer}
|
||||
:nvim-telescope/telescope.nvim {:requires [[:nvim-lua/popup.nvim] [:nvim-lua/plenary.nvim]] :mod :telescope}
|
||||
:nvim-treesitter/nvim-treesitter {:run ":TSUpdate" :mod :treesitter :requires [:nvim-treesitter/playground]}
|
||||
:nvim-treesitter/playground {}
|
||||
:p00f/nvim-ts-rainbow {}
|
||||
:radenling/vim-dispatch-neovim {} ; Clojure
|
||||
:skywind3000/asyncrun.vim {} ; :AsyncRun
|
||||
:tpope/vim-classpath {}
|
||||
:tpope/vim-dadbod {}
|
||||
:tpope/vim-dispatch {} ; Conjure support - jack-in with nrepl dependencies
|
||||
:tpope/vim-fugitive {} ; Git
|
||||
:tpope/vim-git {} ; Git Commit Message
|
||||
:tpope/vim-pathogen {}
|
||||
:tpope/vim-rails {}
|
||||
:tpope/vim-repeat {}
|
||||
:tpope/vim-surround {}
|
||||
:tpope/vim-unimpaired {}
|
||||
:tpope/vim-vinegar {}
|
||||
:wbthomason/packer.nvim {:mod :packer}
|
||||
:williamboman/nvim-lsp-installer {} ; NeoVim lsp server installs
|
||||
|
||||
; :luochen1990/rainbow {}
|
||||
; :thecontinium/asyncomplete-conjure.vim {}
|
||||
}
|
||||
|
||||
; :tpope/vim-fireplace {} ; Clojure
|
||||
; :tpope/vim-sexp-mappings-for-regular-people {}
|
||||
)
|
||||
|
||||
(use packages)
|
||||
|
||||
|
||||
;; 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
|
||||
;; (local packer (require :packer))
|
||||
;; (local core (require :nfnl.core))
|
||||
;;
|
||||
|
||||
;; " 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
|
||||
;; (fn safe-require-plugin-config [name]
|
||||
;; (let [(ok? val-or-err) (pcall require (.. :dotfiles.plugin. name))]
|
||||
;; (when (not ok?)
|
||||
;; (print (.. "dotfiles error: " val-or-err)))))
|
||||
;;
|
||||
;; (fn 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 (core.assoc opts 1 name))))))
|
||||
;;
|
||||
;; (local packages {
|
||||
;; :ahmedkhalf/project.nvim {}
|
||||
;; :akinsho/toggleterm.nvim {:mod :toggleterm}
|
||||
;; :clojure-vim/vim-jack-in {}
|
||||
;; :christianrondeau/vim-base64 {}
|
||||
;; :dhruvasagar/vim-table-mode {}
|
||||
;; :folke/lsp-colors.nvim {}
|
||||
;; :gbprod/yanky.nvim {:mod :yanky}
|
||||
;; :hashivim/vim-terraform {}
|
||||
;; :hrsh7th/vim-vsnip {}
|
||||
;; :hrsh7th/vim-vsnip-integ {}
|
||||
;; :Iron-E/nvim-soluarized {}
|
||||
;; :jiangmiao/auto-pairs {}
|
||||
;; :nvimtools/none-ls.nvim {:mod :null-ls
|
||||
;; :requires [:nvim-lua/plenary.nvim]}
|
||||
;; :junegunn/vim-easy-align {:mod :easyalign}
|
||||
;; :kristijanhusak/vim-dadbod-completion {}
|
||||
;; :kristijanhusak/vim-dadbod-ui {}
|
||||
;; :L3MON4D3/LuaSnip {:mod :luasnip}
|
||||
;; :lifepillar/vim-solarized8 {}
|
||||
;; :lukas-reineke/headlines.nvim {:mod :headlines}
|
||||
;; ; :michaelb/sniprun {:run "bash ./install.sh" :mod :sniprun}
|
||||
;; :mechatroner/rainbow_csv {}
|
||||
;; :neovim/nvim-lspconfig {:mod :lspconfig}
|
||||
;; :norcalli/nvim-colorizer.lua {:mod :colorizer}
|
||||
;; :nvim-orgmode/orgmode {:mod :orgmode}
|
||||
;; :nvim-tree/nvim-web-devicons {}
|
||||
;; :nvim-treesitter/nvim-treesitter {:run ":TSUpdate"
|
||||
;; :mod :treesitter}
|
||||
;; :nvim-treesitter/playground {}
|
||||
;; :radenling/vim-dispatch-neovim {}
|
||||
;; :RaafatTurki/hex.nvim {:mod :hex}
|
||||
;; :rafamadriz/friendly-snippets {}
|
||||
;; :skywind3000/asyncrun.vim {}
|
||||
;; ;; :tjdevries/sg.nvim {:run "cargo build --workspace"
|
||||
;; ;; :dependencies [:nvim-lua/plenary.nvim]}
|
||||
;; ;; :tpope/vim-classpath {}
|
||||
;; ;; :williamboman/nvim-lsp-installbuilder {}
|
||||
;; ; NeoVim lsp server installs
|
||||
;; ; :p00f/nvim-ts-rainbow {}
|
||||
;; ; :luochen1990/rainbow {}
|
||||
;; ; :thecontinium/asyncomplete-conjure.vim {}
|
||||
;; ; :jose-elias-alvarez/null-ls.nvim {:mod :null-ls
|
||||
;; ; :requires [:nvim-lua/plenary.nvim]}
|
||||
;; }
|
||||
;; ; :tpope/vim-fireplace {} ; Clojure ; :tpope/vim-sexp-mappings-for-regular-people {}
|
||||
;; )
|
||||
;;
|
||||
;; (use packages)
|
||||
;;
|
||||
;; ;; 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
|
||||
@@ -0,0 +1,14 @@
|
||||
(fn append-to-buf [bufno lines]
|
||||
(when lines
|
||||
(vim.aip.nvim_buf_set_lines bufno -1 -1 false lines)))
|
||||
|
||||
(var tf-log-bufno nil)
|
||||
|
||||
;; (fn terraform-import []
|
||||
;; (vim.fn.jobstart [:terraform :import :-no-color address id]
|
||||
;; {:stdout_buffered true
|
||||
;; :on_stdout (fn [_ data]
|
||||
;; (append-to-buf tf-log-bufno data))}))
|
||||
;;
|
||||
; (nu.fn-bridge :ZoomToggle :dotfiles.zoom-toggle :zoom-toggle {:return false})
|
||||
; (u.nnoremap :<C-W>z ":call ZoomToggle()<CR>")
|
||||
@@ -0,0 +1,15 @@
|
||||
(local core (require :nfnl.core))
|
||||
|
||||
(fn root [bufnr lang]
|
||||
(let [parser (vim.treesitter.get_parser bufnr lang {})
|
||||
tree (core.first (: parser :parse))]
|
||||
(: tree :root)))
|
||||
|
||||
(fn make-query [lang query-string]
|
||||
(let [query (vim.treesitter.query.parse lang "(headline (stars) @stars)")]
|
||||
(fn [bufnr]
|
||||
(let [root-node (root bufnr lang)
|
||||
iter-captures (query.iter_captures query root-node bufnr 0 -1)]
|
||||
iter-captures))))
|
||||
|
||||
{: root : make-query}
|
||||
@@ -1,21 +1,40 @@
|
||||
(module dotfiles.util
|
||||
{autoload
|
||||
{a aniseed.core}
|
||||
require
|
||||
{nvim aniseed.nvim}})
|
||||
(local a (require :nfnl.core))
|
||||
|
||||
(fn fn? [x]
|
||||
(= :function (type x)))
|
||||
|
||||
(defn noremap [mode from to opts]
|
||||
(let [map-opts {:noremap true :silent true}
|
||||
to (.. ":" to "<cr>")
|
||||
(fn noremap [mode from to opts]
|
||||
(let [local? (a.get opts :local?)
|
||||
opts (a.assoc opts :local? nil)
|
||||
map-opts (a.merge opts {:noremap true :silent true})
|
||||
to (if (fn? to)
|
||||
to
|
||||
(.. ":" to :<cr>))
|
||||
buff-num (a.get opts :buff-num)]
|
||||
(if (or local? buff-num)
|
||||
(vim.keymap.set mode from to
|
||||
(a.merge map-opts {:buffer (or buff-num 0)}))
|
||||
(vim.keymap.set mode from to map-opts))))
|
||||
|
||||
(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))))
|
||||
(fn nnoremap [from to opts] (noremap :n from to opts))
|
||||
|
||||
(defn nnoremap [from to opts]
|
||||
(noremap :n from to opts))
|
||||
(fn tnoremap [from to opts] (noremap :t from to opts))
|
||||
|
||||
(defn lnnoremap [from to]
|
||||
(nnoremap (.. "<leader>" from) to))
|
||||
(fn inoremap [from to opts] (noremap :i from to opts))
|
||||
|
||||
(fn vnoremap [from to opts] (noremap :v from to opts))
|
||||
|
||||
(fn lnnoremap [from to opts] (nnoremap (.. :<leader> from) to opts))
|
||||
|
||||
(fn ltnoremap [from to opts] (noremap :v (.. :<leader> from) to opts))
|
||||
|
||||
(fn lvnoremap [from to opts] (noremap :t (.. :<leader> from) to opts))
|
||||
|
||||
{: noremap
|
||||
: nnoremap
|
||||
: tnoremap
|
||||
: inoremap
|
||||
: vnoremap
|
||||
: lnnoremap
|
||||
: ltnoremap
|
||||
: lvnoremap}
|
||||
@@ -1,24 +1,28 @@
|
||||
(module dotfiles.zoom-toggle
|
||||
{autoload
|
||||
{a aniseed.core}
|
||||
require
|
||||
{anenv aniseed.env
|
||||
nvim aniseed.nvim
|
||||
nu aniseed.nvim.util
|
||||
u dotfiles.util}})
|
||||
(import-macros {: tx} :config.macros)
|
||||
|
||||
(local u (require :dotfiles.util))
|
||||
|
||||
(var unzoom! nil)
|
||||
|
||||
(defn zoom-toggle []
|
||||
(fn zoom-toggle []
|
||||
(if unzoom!
|
||||
(do
|
||||
(nvim.command unzoom!)
|
||||
(vim.cmd unzoom!)
|
||||
(set unzoom! nil))
|
||||
(do
|
||||
(set unzoom! (nvim.fn.winrestcmd))
|
||||
(nvim.ex.resize)
|
||||
(nvim.ex.vertical :resize))))
|
||||
(set unzoom! (vim.fn.winrestcmd))
|
||||
(vim.cmd.resize)
|
||||
(vim.cmd.resize {:mods {:vertical true}}))))
|
||||
|
||||
|
||||
(nu.fn-bridge :ZoomToggle :dotfiles.zoom-toggle :zoom-toggle {:return false})
|
||||
(u.nnoremap :<C-W>z ":call ZoomToggle()<CR>")
|
||||
(vim.api.nvim_create_user_command :ZoomToggle zoom-toggle {})
|
||||
|
||||
;; (u.nnoremap :<M-z> ":call ZoomToggle()<CR>")
|
||||
;; (u.tnoremap :<M-z> "<c-\\><c-n>:call ZoomToggle()<CR>")
|
||||
|
||||
(let [wk (require :which-key)]
|
||||
(wk.add [[(tx :<M-z> zoom-toggle
|
||||
{:desc "Toggle zoom of buffer window"})]
|
||||
[(tx :<M-z> zoom-toggle
|
||||
{:desc "Toggle zoom of buffer window"
|
||||
:mode [:n :t] })]] ))
|
||||
@@ -0,0 +1,3 @@
|
||||
(import-macros {: tx} :config.macros)
|
||||
|
||||
(tx :skywind3000/asyncrun.vim {})
|
||||
@@ -0,0 +1,5 @@
|
||||
(import-macros {: tx} :config.macros)
|
||||
|
||||
(tx "windwp/nvim-autopairs"
|
||||
{:event "InsertEnter"
|
||||
:config true })
|
||||
@@ -0,0 +1,60 @@
|
||||
(import-macros {: tx} :config.macros)
|
||||
|
||||
(tx "hrsh7th/nvim-cmp"
|
||||
{:event "VeryLazy"
|
||||
:main "cmp"
|
||||
:dependencies ["hrsh7th/cmp-nvim-lsp"
|
||||
"hrsh7th/cmp-buffer"
|
||||
"hrsh7th/cmp-path"
|
||||
"hrsh7th/cmp-cmdline"
|
||||
:hrsh7th/vim-vsnip
|
||||
:hrsh7th/vim-vsnip-integ
|
||||
"PaterJason/cmp-conjure"
|
||||
"Olical/conjure"
|
||||
"nvim-lua/plenary.nvim"]
|
||||
|
||||
:config
|
||||
(fn []
|
||||
(let [cmp (require :cmp)]
|
||||
(cmp.setup
|
||||
{:sources (cmp.config.sources
|
||||
[{:name "nvim_lsp" :group_index 2}
|
||||
{:name "nvim_lua" :group_index 2}
|
||||
{:name "vsnip" :group_index 2}
|
||||
{:name "conjure" :group_index 2}
|
||||
{:name "buffer" :group_index 2}
|
||||
{:name :orgmode :group_index 2}
|
||||
{:name :emoji :group_index 2 :max_item_count 8}])
|
||||
:sorting {:priority_weight 2
|
||||
:comparators [;; Below is the default comparator list and order for nvim-cmp
|
||||
cmp.config.compare.offset
|
||||
;; cmp.config.compare.scopes --this is commented in nvim-cmp too
|
||||
cmp.config.compare.exact
|
||||
cmp.config.compare.score
|
||||
cmp.config.compare.recently_used
|
||||
cmp.config.compare.locality
|
||||
cmp.config.compare.kind
|
||||
cmp.config.compare.sort_text
|
||||
cmp.config.compare.length
|
||||
cmp.config.compare.order]}
|
||||
:window {:completion (cmp.config.window.bordered)
|
||||
:documentation (cmp.config.window.bordered)}
|
||||
:mapping (cmp.mapping.preset.insert
|
||||
{:<C-p> (cmp.mapping.select_prev_item)
|
||||
:<C-n> (cmp.mapping.select_next_item)
|
||||
"<C-b>" (cmp.mapping.scroll_docs -4)
|
||||
"<C-f>" (cmp.mapping.scroll_docs 4)
|
||||
"<C-Space>" (cmp.mapping.complete)
|
||||
"<C-e>" (cmp.mapping.abort)
|
||||
"<C-y>" (cmp.mapping.confirm {:select true})})})
|
||||
|
||||
; (cmp.setup.cmdline
|
||||
; ["/" "?"]
|
||||
; {:mapping (cmp.mapping.preset.cmdline)
|
||||
; :sources [{:name "buffer"}]})
|
||||
|
||||
(cmp.setup.cmdline
|
||||
":"
|
||||
{:mapping (cmp.mapping.preset.cmdline)
|
||||
:sources (cmp.config.sources [{:name "path"} {:name "cmdline"}])
|
||||
:matching {:disallow_symbol_nonprefix_matching false}})))})
|
||||
@@ -0,0 +1,3 @@
|
||||
(import-macros {: tx} :config.macros)
|
||||
|
||||
(tx "https://codeberg.org/lifepillar/vim-solarized8/" {:branch "neovim"})
|
||||
@@ -0,0 +1,37 @@
|
||||
(import-macros {: tx} :config.macros)
|
||||
|
||||
;; (local conjure-config (require :conjure.config))
|
||||
|
||||
; (set nvim.g.conjure#eval#result_register "*")
|
||||
; (set nvim.g.conjure#log#botright true)
|
||||
(set vim.g.conjure#mapping#doc_word :gk)
|
||||
(set vim.g.conjure#log#linked_to_client_state true)
|
||||
(set vim.g.conjure#client#clojure#nrepl#mapping#session_clone :sC)
|
||||
(set vim.g.conjure#extract#tree_sitter#enabled true)
|
||||
(set vim.g.conjure#filetype#fennel :conjure.client.fennel.nfnl)
|
||||
(set vim.g.conjure#log#trim#at 1000000)
|
||||
|
||||
;; (conjure-config.assoc-in [:filetypes]
|
||||
;; (core.concat (conjure-config.filetypes) [:markdown]))
|
||||
|
||||
;; (conjure-config.assoc-in [:filetype :markdown] :conjure.client.clojure.nrepl)
|
||||
|
||||
(tx :Olical/conjure
|
||||
{:event :VeryLazy
|
||||
:dependencies [:NeogitOrg/neogit]
|
||||
:config (lambda []
|
||||
(let [a (require :nfnl.core)
|
||||
group (vim.api.nvim_create_augroup :ConjureSetClientStateOnGitBranchCheckout
|
||||
{:clear true})]
|
||||
(vim.api.nvim_create_autocmd [:User]
|
||||
{: group
|
||||
:pattern :NeogitBranchCheckout
|
||||
:callback (lambda [e]
|
||||
(let [branch (a.get-in e
|
||||
[:data
|
||||
:branch_name])
|
||||
feature (a.first (icollect [s (string.gmatch branch
|
||||
"[^/]*")]
|
||||
s))]
|
||||
(vim.cmd.ConjureClientState feature)
|
||||
false))})))})
|
||||
@@ -0,0 +1,45 @@
|
||||
(import-macros {: tx} :config.macros)
|
||||
|
||||
[(tx "mfussenegger/nvim-dap"
|
||||
{:config
|
||||
(fn []
|
||||
(let [dap (require :dap)]
|
||||
(set dap.adapters.clojure
|
||||
{:type "executable"
|
||||
:command "clojure"
|
||||
:args ["-Sdeps"
|
||||
"{:deps {uk.me.oli/clojure-dap {:mvn/version \"RELEASE\"}}}"
|
||||
"-X" "clojure-dap.main/run"]})
|
||||
|
||||
(set dap.configurations.clojure
|
||||
[{:name "Attach to nREPL"
|
||||
:type "clojure"
|
||||
:request "attach"}])))
|
||||
|
||||
:keys [(tx "<leader>db" (fn [] ((. (require :dap) :toggle_breakpoint))) {:desc "Toggle breakpoint"})
|
||||
(tx "<F9>" (fn [] ((. (require :dap) :toggle_breakpoint))) {:desc "Toggle breakpoint"})
|
||||
(tx "<leader>dc" (fn [] ((. (require :dap) :continue))) {:desc "Continue / Start debug"})
|
||||
(tx "<F5>dc" (fn [] ((. (require :dap) :continue))) {:desc "Continue / Start debug"})
|
||||
(tx "<leader>dn" (fn [] ((. (require :dap) :step_over))) {:desc "Step over"})
|
||||
(tx "<F10>" (fn [] ((. (require :dap) :step_over))) {:desc "Step over"})
|
||||
(tx "<leader>di" (fn [] ((. (require :dap) :step_into))) {:desc "Step into"})
|
||||
(tx "<F11>" (fn [] ((. (require :dap) :step_into))) {:desc "Step into"})
|
||||
(tx "<leader>do" (fn [] ((. (require :dap) :step_out))) {:desc "Step out"})
|
||||
(tx "<F12>" (fn [] ((. (require :dap) :step_out))) {:desc "Step out"})
|
||||
(tx "<leader>dr" (fn [] ((. (require :dap) :repl :open))) {:desc "Open REPL"})
|
||||
(tx "<leader>dl" (fn [] ((. (require :dap) :run_last))) {:desc "Run last"})
|
||||
(tx "<leader>dx" (fn [] ((. (require :dap) :terminate))) {:desc "Terminate"})
|
||||
(tx "<leader>du" (fn [] ((. (require :dapui) :toggle))) {:desc "Toggle DAP UI"})]})
|
||||
|
||||
(tx "rcarriga/nvim-dap-ui"
|
||||
{:dependencies ["mfussenegger/nvim-dap" "nvim-neotest/nvim-nio"]
|
||||
:config (fn []
|
||||
(let [dapui (require :dapui)
|
||||
dap (require :dap)]
|
||||
(dapui.setup)
|
||||
(tset dap.listeners.after.event_initialized :dapui
|
||||
(fn [] (dapui.open)))
|
||||
(tset dap.listeners.before.event_terminated :dapui
|
||||
(fn [] (dapui.close)))
|
||||
(tset dap.listeners.before.event_exited :dapui
|
||||
(fn [] (dapui.close)))))})]
|
||||
@@ -0,0 +1,3 @@
|
||||
(import-macros {: tx} :config.macros)
|
||||
|
||||
(tx "micampe/fennel.vim")
|
||||
@@ -0,0 +1,20 @@
|
||||
(import-macros {: tx} :config.macros)
|
||||
|
||||
(tx :NeogitOrg/neogit
|
||||
{:lazy true
|
||||
:dependencies [;; Only one of these is needed.
|
||||
:esmuellert/codediff.nvim
|
||||
; -- optional
|
||||
;"sindrets/diffview.nvim"; -- optional
|
||||
;; For a custom log pager
|
||||
:m00qek/baleia.nvim
|
||||
; -- optional
|
||||
;; Only one of these is needed.
|
||||
:nvim-telescope/telescope.nvim
|
||||
; -- optional
|
||||
; "ibhagwan/fzf-lua"; -- optional
|
||||
; "nvim-mini/mini.pick"; -- optional
|
||||
; "folke/snacks.nvim"; -- optional
|
||||
]
|
||||
:cmd :Neogit
|
||||
:keys [(tx :<leader>gg :<cmd>Neogit<cr> {:desc "Show Neogit UI"})]})
|
||||
@@ -0,0 +1,3 @@
|
||||
(import-macros {: tx} :config.macros)
|
||||
|
||||
(tx :airblade/vim-gitgutter {})
|
||||
@@ -0,0 +1,334 @@
|
||||
(import-macros {: tx} :config.macros)
|
||||
;
|
||||
;
|
||||
|
||||
(vim.diagnostic.config {:signs {:text {vim.diagnostic.severity.ERROR "☢️"
|
||||
vim.diagnostic.severity.WARN "⚠️"
|
||||
vim.diagnostic.severity.INFO "ℹ️"
|
||||
vim.diagnostic.severity.HINT "🔎"}
|
||||
;; :linehl {vim.diagnostic.severity.ERROR :ErrorMsg}
|
||||
;; :numhl {vim.diagnostic.severity.WARN :WarningMsg}
|
||||
}})
|
||||
|
||||
(local client-nmappings {:clojure_lsp {;;:<leader>cn "call LspExecuteCommand('clean-ns')"
|
||||
;; :<leader>ref "call LspExecuteCommand('extract-function', input('Function name: '))"
|
||||
;; :<leader>id "call LspExecuteCommand('inline-symbol')"
|
||||
;; :<leader>il "call LspExecuteCommand('introduce-let', input('Binding name: '))"
|
||||
;;:<leader>m2l "call LspExecuteCommand('move-to-let', input('Binding name: '))"
|
||||
}})
|
||||
|
||||
(local client-command-lnmappings
|
||||
{:clojure_lsp {:ai [:add-import-to-namespace
|
||||
[(lambda [] (vim.fn.input "Namespace name: "))]]
|
||||
:am [:add-missing-libspec []]
|
||||
:as [:add-require-suggestion
|
||||
[(lambda [] (vim.fn.input "Namespace name: "))
|
||||
(lambda [] (vim.fn.input "Namespace as: "))
|
||||
(lambda [] (vim.fn.input "Namespace name: "))]]
|
||||
:cc [:cycle-coll []]
|
||||
:cn [:clean-ns []]
|
||||
:cp [:cycle-privacy []]
|
||||
:ct [:create-test []]
|
||||
:df [:drag-forward []]
|
||||
:db [:drag-backward []]
|
||||
:df [:drag-forward []]
|
||||
:dk [:destructure-keys []]
|
||||
:ed [:extract-to-def
|
||||
[(lambda [] (vim.fn.input "Definition name: "))]]
|
||||
:ref [:extract-function
|
||||
[(lambda [] (vim.fn.input "Function name: "))]]
|
||||
:el [:expand-let []]
|
||||
:fe [:create-function []]
|
||||
:il [:introduce-let
|
||||
[(lambda [] (vim.fn.input "Binding name: "))]]
|
||||
:is [:inline-symbol []]
|
||||
:ma [:resolve-macro-as []]
|
||||
:mf [:move-form
|
||||
[(lambda [] (vim.fn.input "File name: "))]]
|
||||
:ml [:move-to-let
|
||||
[(lambda [] (vim.fn.input "Binding name: "))]]
|
||||
:pf [:promote-fn
|
||||
[(lambda [] (vim.fn.input "Function name: "))]]
|
||||
:sc [:change-coll
|
||||
[(lambda []
|
||||
(let [coll-types [:map :list :set :vector]
|
||||
a (require :nfnl.core)
|
||||
choice (vim.fn.inputlist (a.concat ["Collection Type:"]
|
||||
(a.map-indexed (fn [[k
|
||||
v]]
|
||||
(.. (tostring k)
|
||||
". "
|
||||
v))
|
||||
coll-types)))]
|
||||
(a.get coll-types choice)))]]
|
||||
:sm [:sort-map []]
|
||||
:tf [:thread-first-all []]
|
||||
:tF [:thread-first []]
|
||||
:tl [:thread-last-all []]
|
||||
:tL [:thread-last []]
|
||||
:ua [:unwind-all []]
|
||||
:uw [:unwind-thread []]}})
|
||||
|
||||
;
|
||||
; (local server-specific-opts {})
|
||||
;
|
||||
; (local base-server-opts
|
||||
; (let [capabilities (cmp_nvim_lsp.default_capabilities (lsp.protocol.make_client_capabilities))]
|
||||
; {: on_attach : capabilities :flags {:debounce_text_changes 150}}))
|
||||
|
||||
; (vim.api.nvim_create_user_command :LspExecuteCommand lsp-execute-command
|
||||
; {:nargs "+"})
|
||||
|
||||
(local vim _G.vim)
|
||||
|
||||
(local lsps [:clojure_lsp
|
||||
; "fennel_ls"
|
||||
:lua_ls
|
||||
:jsonls
|
||||
:yamlls
|
||||
:marksman
|
||||
:html
|
||||
; :basedpyright
|
||||
; :ts_ls
|
||||
:terraformls
|
||||
; "tailwindcss"
|
||||
:dockerls
|
||||
:docker_compose_language_service
|
||||
:bashls
|
||||
; :taplo
|
||||
:sqlls])
|
||||
|
||||
(local filetype->formatters
|
||||
{:lua [:stylua]
|
||||
:sh [:shfmt]
|
||||
:python [:ruff_organize_imports :ruff_format]
|
||||
:rust [:rustfmt]
|
||||
:toml [:taplo]
|
||||
; :clojure [:cljfmt]
|
||||
:json [:prettierd]
|
||||
:javascript [:prettierd]
|
||||
:typescript [:prettierd]
|
||||
:jsx [:prettierd]
|
||||
:html [:prettierd]
|
||||
:css [:prettierd]
|
||||
:yaml [:prettierd]
|
||||
:markdown [:prettierd]
|
||||
:fennel [:fnlfmt]
|
||||
:sql [:sqlfmt]
|
||||
:gleam [:gleam]
|
||||
:_ {:lsp_format :prefer}
|
||||
:* [:trim_whitespace :trim_newlines]})
|
||||
|
||||
(local formatter->package {:ruff_organize_imports :ruff :ruff_format :ruff})
|
||||
|
||||
(local disable-formatter-on-save
|
||||
;; These mess with the buffer, so we keep them available for manual invocation but never automatic.
|
||||
{:fennel true :sql true})
|
||||
|
||||
(local disable-formatter-auto-install
|
||||
;; These need to be installed outside of Mason.
|
||||
{:cljfmt true
|
||||
:fnlfmt true
|
||||
:rustfmt true
|
||||
:trim_whitespace true
|
||||
:trim_newlines true
|
||||
:gleam true})
|
||||
|
||||
(each [_ lsp-lang (pairs [:clojure :fennel-ls :typedclojure])]
|
||||
(vim.lsp.enable lsp-lang))
|
||||
|
||||
[(tx :folke/lsp-colors.nvim {})
|
||||
(tx :williamboman/mason.nvim {:tag :v1.11.0 :opts {}})
|
||||
(tx :stevearc/conform.nvim
|
||||
{:dependencies [:rcarriga/nvim-notify]
|
||||
:opts {;;:default_format_opts {:lsp_format :fallback}
|
||||
:formatters_by_ft filetype->formatters
|
||||
:format_on_save (fn [_buf]
|
||||
(when (and vim.g.dotfiles_format_on_save
|
||||
(or (= nil
|
||||
vim.b.dotfiles_format_on_save)
|
||||
vim.b.dotfiles_format_on_save)
|
||||
(not (. disable-formatter-on-save
|
||||
vim.bo.filetype)))
|
||||
{:timeout_ms 500 :lsp_format :fallback}))}
|
||||
:config (fn [_ opts]
|
||||
(let [conform (require :conform)
|
||||
registry (require :mason-registry)
|
||||
formatters-for-mason {}]
|
||||
(set conform.formatters.shfmt {:prepend_args [:-i :2 :-ci]})
|
||||
(vim.schedule (fn []
|
||||
(each [_ft formatters (pairs filetype->formatters)]
|
||||
(each [_idx formatter (ipairs formatters)]
|
||||
(when (not (. disable-formatter-auto-install
|
||||
formatter))
|
||||
(tset formatters-for-mason
|
||||
(or (. formatter->package
|
||||
formatter)
|
||||
formatter)
|
||||
true))))
|
||||
(each [formatter _true (pairs formatters-for-mason)]
|
||||
(let [pkg (registry.get_package formatter)]
|
||||
(when (not (pkg:is_installed))
|
||||
(vim.notify (.. "Automatically installing "
|
||||
formatter " with Mason."))
|
||||
(pkg:install))))))
|
||||
(set vim.g.dotfiles_format_on_save true)
|
||||
(conform.setup opts)
|
||||
(set vim.o.formatexpr "v:lua.require'conform'.formatexpr()")))
|
||||
:keys [(tx :<leader>tbf
|
||||
(fn []
|
||||
(set vim.b.dotfiles_format_on_save
|
||||
(if (= nil vim.b.dotfiles_format_on_save) false
|
||||
(not vim.b.dotfiles_format_on_save)))
|
||||
(vim.notify (.. "Set vim.b.dotfiles_format_on_save to "
|
||||
(tostring vim.b.dotfiles_format_on_save))))
|
||||
{:desc "Toggle buffer formatting"})
|
||||
(tx :<leader>tgf
|
||||
(fn []
|
||||
(set vim.g.dotfiles_format_on_save
|
||||
(not vim.g.dotfiles_format_on_save))
|
||||
(vim.notify (.. "Set vim.g.dotfiles_format_on_save to "
|
||||
(tostring vim.g.dotfiles_format_on_save))))
|
||||
{:desc "Toggle global formatting"})]})
|
||||
(tx :williamboman/mason-lspconfig.nvim
|
||||
{:tag :v1.32.0
|
||||
:dependencies [:williamboman/mason.nvim]
|
||||
:opts {:ensure_installed lsps :automatic_installation true}})
|
||||
(tx :neovim/nvim-lspconfig
|
||||
{:lazy false
|
||||
:dependencies [:williamboman/mason-lspconfig.nvim
|
||||
:hrsh7th/cmp-nvim-lsp
|
||||
:stevearc/conform.nvim
|
||||
:Olical/nfnl]
|
||||
:keys [(tx :<leader>ca #(vim.lsp.buf.code_action)
|
||||
{:desc "Invoke code_action, prompting for an action to take at the cursor"})
|
||||
(tx :<leader>fa ; vim.lsp.buf.format
|
||||
(fn []
|
||||
((. (require :conform) :format)))
|
||||
{:desc "LSP format"})
|
||||
(tx :<leader>rn vim.lsp.buf.rename {:desc "LSP rename"})
|
||||
(tx :gd vim.lsp.buf.definition {:desc "Go to Definition"})
|
||||
(tx :gD vim.lsp.buf.declaration {:desc "Go to Declaration"})
|
||||
(tx :gi vim.lsp.buf.implementation {:desc "Go to Implementation"})
|
||||
(tx :gr vim.lsp.buf.references {:desc "Show References"})
|
||||
(tx :K vim.lsp.buf.hover {:desc "LSP Hover"})
|
||||
(tx "[g" vim.lsp.diagnostic.goto_prev
|
||||
{:desc "Previous Diagnostic"})
|
||||
(tx "]g" vim.lsp.diagnostic.goto_next {:desc "Next Diagnostic"})
|
||||
(tx :<c-k> vim.lsp.buf.signature_help {:desc "Signature Help"})
|
||||
; :<leader>cl "lua vim.lsp.codelens.run()"
|
||||
; :<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>sld "lua vim.diagnostic.open_float(nil, {source = 'always'})"
|
||||
; :<leader>rn "lua vim.lsp.buf.rename()"
|
||||
; :<leader>fa "lua vim.lsp.buf.format()"}
|
||||
]
|
||||
:config (fn []
|
||||
(let [caps ((. (require :cmp_nvim_lsp) :default_capabilities))
|
||||
mlsp (require :mason-lspconfig)
|
||||
a (require :nfnl.core)
|
||||
u (require :dotfiles.util)
|
||||
lsp (require :vim.lsp)
|
||||
cmp_nvim_lsp (require :cmp_nvim_lsp)]
|
||||
(fn bufmap [mode from to opts]
|
||||
(u.noremap mode from to (a.merge {:local? true} opts)))
|
||||
|
||||
(fn nbufmap [from to opts] (bufmap :n from to opts))
|
||||
|
||||
(fn xbufmap [from to opts] (bufmap :x from to opts))
|
||||
|
||||
(u.nnoremap :<leader>li :LspInfo)
|
||||
|
||||
(fn lsp-execute-command [client cmd ...]
|
||||
(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 [...])]
|
||||
;;(client.exec_cmd {:command cmd :arguments args} {:bufnr 0})
|
||||
(client.request_sync :workspace/executeCommand
|
||||
{:command cmd :arguments args} nil 0)))
|
||||
|
||||
(fn bind-client-mappings [client]
|
||||
(let [client-name (a.get client :name)
|
||||
mappings (a.get client-nmappings client-name)
|
||||
command-lnmappings (a.get client-command-lnmappings
|
||||
client-name)]
|
||||
(when mappings
|
||||
(each [mapping cmd (pairs mappings)]
|
||||
(nbufmap mapping cmd {})))
|
||||
(when command-lnmappings
|
||||
(each [lnmapping command-mapping (pairs command-lnmappings)]
|
||||
(let [lsp-cmd (a.first command-mapping)
|
||||
;;lsp-cmd (.. client-name "." (a.first command-mapping))
|
||||
;;opts (a.second command-mapping)
|
||||
mapping (.. :<leader> lnmapping)
|
||||
cmd (lambda []
|
||||
(let [opts (accumulate [s "" _i opt (ipairs (a.second command-mapping))]
|
||||
(.. s
|
||||
(if (= :function
|
||||
(type opt))
|
||||
(opt)
|
||||
opt)))]
|
||||
(lsp-execute-command client lsp-cmd
|
||||
opts)))]
|
||||
(nbufmap mapping cmd
|
||||
{:desc (.. "LSP command `" lsp-cmd "`")}))))))
|
||||
|
||||
(fn on_attach [client bufnr]
|
||||
;(each [mapping cmd (pairs core-nmappings)] ; (nbufmap mapping cmd {})) ; x mode mappings
|
||||
;(xbufmap :<leader>fa "lua vim.lsp.buf.format()" ; {:desc "Format buffer"}) ; -- 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)
|
||||
(vim.api.nvim_set_option_value :omnifunc
|
||||
"v:lua.vim.lsp.omnifunc"
|
||||
{:buf 0})
|
||||
(bind-client-mappings client)
|
||||
(when client.server_capabilities.documentHighlightProvider
|
||||
(each [hlgroup base-group (pairs {:LspReferenceRead :SpecialKey
|
||||
:LspReferenceText :SpecialKey
|
||||
:LspReferenceWrite :SpecialKey})]
|
||||
(vim.api.nvim_set_hl 0 hlgroup
|
||||
(a.merge (vim.api.nvim_get_hl_by_name base-group
|
||||
true)
|
||||
{:italic true
|
||||
:foreground "#6c71c4"
|
||||
:background :NONE})))
|
||||
(let [group (vim.api.nvim_create_augroup :LspDocumentHighlight
|
||||
{:clear true})]
|
||||
(vim.api.nvim_create_autocmd [:CursorHold :CursorHoldI]
|
||||
{: group
|
||||
:pattern :<buffer>
|
||||
:callback (lambda []
|
||||
(vim.lsp.buf.document_highlight))})
|
||||
(vim.api.nvim_create_autocmd [:CursorMoved]
|
||||
{: group
|
||||
:pattern :<buffer>
|
||||
:callback (lambda []
|
||||
(vim.lsp.buf.clear_references))})))
|
||||
(if client.server_capabilities.documentFormattingProvider
|
||||
(vim.api.nvim_create_autocmd [:BufWritePre]
|
||||
{:pattern :<buffer>
|
||||
:callback (fn []
|
||||
((. (require :conform)
|
||||
:format)))}))
|
||||
(print "LSP Client Attached."))
|
||||
|
||||
(mlsp.setup_handlers (tx (fn [server-name]
|
||||
(vim.lsp.config server-name
|
||||
{:capabilities caps
|
||||
: on_attach})
|
||||
(vim.lsp.enable server-name))))))})
|
||||
(tx :RubixDev/mason-update-all {:cmd :MasonUpdateAll
|
||||
:dependencies [:williamboman/mason.nvim
|
||||
:Olical/nfnl]
|
||||
:main :mason-update-all
|
||||
:opts {}})]
|
||||
@@ -0,0 +1,5 @@
|
||||
(import-macros {: tx} :config.macros)
|
||||
|
||||
(tx "Olical/nfnl" {:lazy false
|
||||
;;:ft "fennel"
|
||||
})
|
||||
@@ -0,0 +1,10 @@
|
||||
(import-macros {: tx} :config.macros)
|
||||
|
||||
(tx :nvim-neo-tree/neo-tree.nvim
|
||||
{:branch :v3.x
|
||||
:dependencies [:nvim-tree/nvim-web-devicons
|
||||
; not strictly required, but recommended
|
||||
:MunifTanjim/nui.nvim
|
||||
; :3rd/image.nvim, ; Optional image support in preview window: See `# Preview Mode` for more information
|
||||
]
|
||||
:lazy false})
|
||||
@@ -0,0 +1,88 @@
|
||||
(import-macros {: tx} :config.macros)
|
||||
|
||||
(set vim.g.paredit_smartjump 1)
|
||||
|
||||
(fn list-member? [xs x]
|
||||
(a.some #(= x $1) (a.vals xs)))
|
||||
|
||||
(fn bool->int [bool] (if bool 1 0))
|
||||
|
||||
(fn int->bool [x] (if (= 0 x) false true))
|
||||
|
||||
(fn toggle-global! [x]
|
||||
(->> (a.get vim.g x)
|
||||
(int->bool)
|
||||
(not)
|
||||
(bool->int)
|
||||
(tset vim.g x)))
|
||||
|
||||
(local paredit-langs [:clojure
|
||||
:fennel
|
||||
:hy
|
||||
:janet
|
||||
:julia
|
||||
:lfe
|
||||
:lisp
|
||||
:racket
|
||||
:scheme
|
||||
:shen])
|
||||
|
||||
(local paredit-host-langs [:org :markdown :asciidoc])
|
||||
|
||||
(fn paredit-lang? [lang] (list-member? paredit-langs lang))
|
||||
|
||||
|
||||
(vim.api.nvim_create_autocmd [:FileType]
|
||||
{:pattern :ruby
|
||||
:callback (lambda []
|
||||
(vim.fn.PareditInitBalancingAllBracketsBuffer))})
|
||||
|
||||
(vim.api.nvim_create_autocmd [:FileType]
|
||||
{:pattern :javascript
|
||||
:callback (lambda []
|
||||
(vim.fn.PareditInitBalancingAllBracketsBuffer))})
|
||||
|
||||
(vim.api.nvim_create_autocmd [:FileType]
|
||||
{:pattern :terraform
|
||||
:callback (lambda []
|
||||
(vim.fn.PareditInitBalancingAllBracketsBuffer))})
|
||||
|
||||
|
||||
|
||||
(tx :kovisoft/paredit
|
||||
{:dependencies [:nvim-treesitter/nvim-treesitter]
|
||||
:config (fn []
|
||||
(let [a (require :nfnl.core)
|
||||
;; treesitter (require :dotfiles.plugin.treesitter)
|
||||
ts-parsers (require :nvim-treesitter.parsers)
|
||||
;; ts-utils (require :nvim-treesitter.utils)
|
||||
languagetree (require :vim.treesitter.languagetree)]
|
||||
|
||||
(fn language-at-cursor []
|
||||
(let [parser (ts-parsers.get_parser)
|
||||
current-node (vim.treesitter.get_node {:bufnr 0})
|
||||
range (if current-node [(current-node:range)])
|
||||
lang (if range
|
||||
(languagetree.language_for_range parser range))]
|
||||
(if lang
|
||||
(lang:lang))))
|
||||
|
||||
(fn parser-language []
|
||||
(let [parser (ts-parsers.get_parser)]
|
||||
(when parser
|
||||
(parser:lang))))
|
||||
|
||||
(fn host-lang-in? [langs] (list-member? langs (parser-language)))
|
||||
|
||||
|
||||
(fn TreeSitterLangParedit []
|
||||
(when (host-lang-in? paredit-host-langs)
|
||||
(let [cursor-lang (language-at-cursor)]
|
||||
(when cursor-lang
|
||||
(->> cursor-lang
|
||||
(paredit-lang?)
|
||||
(bool->int)
|
||||
(set vim.g.paredit_mode))
|
||||
(vim.fn.PareditInitBuffer)))))
|
||||
|
||||
))})
|
||||
@@ -0,0 +1,3 @@
|
||||
(import-macros {: tx} :config.macros)
|
||||
|
||||
(tx :nvim-lua/plenary.nvim {})
|
||||
@@ -0,0 +1,3 @@
|
||||
(import-macros {: tx} :config.macros)
|
||||
|
||||
(tx :HiPhish/rainbow-delimiters.nvim {:verion "*"})
|
||||
@@ -0,0 +1,27 @@
|
||||
(import-macros {: tx} :config.macros)
|
||||
|
||||
(tx :mrjones2014/smart-splits.nvim
|
||||
{:lazy false
|
||||
:config (fn []
|
||||
(let [smart-splits (require :smart-splits)]
|
||||
(when smart-splits
|
||||
;; recommended mappings
|
||||
;; resizing splits
|
||||
;; these keymaps will also accept a range,
|
||||
;; for example `10<A-h>` will `resize_left` by `(10 * config.default_amount)`
|
||||
(vim.keymap.set :n :<M-S-h> smart-splits.resize_left)
|
||||
(vim.keymap.set :n :<M-S-j> smart-splits.resize_down)
|
||||
(vim.keymap.set :n :<M-S-k> smart-splits.resize_up)
|
||||
(vim.keymap.set :n :<M-S-l> smart-splits.resize_right) ; ; moving between splits
|
||||
(vim.keymap.set :n :<M-h> smart-splits.move_cursor_left)
|
||||
(vim.keymap.set :n :<M-j> smart-splits.move_cursor_down)
|
||||
(vim.keymap.set :n :<M-k> smart-splits.move_cursor_up)
|
||||
(vim.keymap.set :n :<M-l> smart-splits.move_cursor_right) ; ; swapping buffers between windows
|
||||
(vim.keymap.set :n :<leader><leader>h
|
||||
smart-splits.swap_buf_left)
|
||||
(vim.keymap.set :n :<leader><leader>j
|
||||
smart-splits.swap_buf_down)
|
||||
(vim.keymap.set :n :<leader><leader>k
|
||||
smart-splits.swap_buf_up)
|
||||
(vim.keymap.set :n :<leader><leader>l
|
||||
smart-splits.swap_buf_right))))})
|
||||
@@ -0,0 +1,51 @@
|
||||
(import-macros {: tx} :config.macros)
|
||||
|
||||
(local util (require :dotfiles.util))
|
||||
(local vimgrep_arguments [:ag
|
||||
:--nocolor
|
||||
:--noheading
|
||||
:--number
|
||||
:--column
|
||||
:--nobreak
|
||||
:--smart-case
|
||||
:--hidden
|
||||
; "--skip-vcs-ignores"
|
||||
; "-g" "!.git/"
|
||||
:--ignore
|
||||
:.git
|
||||
:--follow])
|
||||
|
||||
|
||||
(util.lnnoremap :fc "Telescope commands")
|
||||
(util.lnnoremap :fC "Telescope command_history")
|
||||
(util.lnnoremap :ff "Telescope git_files hidden=true")
|
||||
(util.lnnoremap :f- "Telescope find_files")
|
||||
(util.lnnoremap :fg "Telescope live_grep")
|
||||
(util.lnnoremap "*" "Telescope grep_string")
|
||||
(util.lnnoremap :fb "Telescope buffers")
|
||||
(util.lnnoremap :fd "Telescope diagnostics")
|
||||
(util.lnnoremap :fH "Telescope help_tags")
|
||||
(util.lnnoremap :fh "Telescope oldfiles")
|
||||
(util.lnnoremap :fp "Telescope projects")
|
||||
(util.lnnoremap :fm "Telescope keymaps")
|
||||
(util.lnnoremap :fM "Telescope marks")
|
||||
(util.lnnoremap :ft "TodoTelescope")
|
||||
(util.lnnoremap :fT "Telescope filetypes")
|
||||
(util.lnnoremap :fq "Telescope quickfix")
|
||||
(util.lnnoremap :fl "Telescope loclist")
|
||||
(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")
|
||||
(util.lnnoremap :fy "Telescope yank_history")
|
||||
|
||||
(tx :nvim-telescope/telescope.nvim
|
||||
{
|
||||
"version" "*"
|
||||
:dependencies [[:nvim-lua/popup.nvim]
|
||||
[:nvim-lua/plenary.nvim]]
|
||||
|
||||
:pickers {:buffers {:mappings {:n {:d :delete_buffer}}}}
|
||||
:extensions {:projects {:projects {}}
|
||||
:yank_history {}}})
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
(import-macros {: tx} :config.macros)
|
||||
|
||||
(tx :folke/todo-comments.nvim
|
||||
{:dependencies [:nvim-lua/plenary.nvim] :opts {:lazy false}})
|
||||
@@ -0,0 +1,29 @@
|
||||
(import-macros {: tx} :config.macros)
|
||||
|
||||
(fn set-terminal-keymaps []
|
||||
(vim.keymap.set :t :<esc> "<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-j> "<Cmd>wincmd j<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-w> "<C-\\><C-n><C-w>"))
|
||||
|
||||
(vim.api.nvim_create_user_command :SetTerminalKeymaps set-terminal-keymaps {})
|
||||
|
||||
(vim.api.nvim_create_autocmd [:TermOpen]
|
||||
{:pattern "term://*"
|
||||
:callback set-terminal-keymaps})
|
||||
|
||||
(tx :akinsho/toggleterm.nvim {:lazy false
|
||||
:opts {:open_mapping "<c-\\>"
|
||||
:start_in_insert true
|
||||
:insert_mappings true
|
||||
;; whether or not the open mapping applies in insert mode
|
||||
:terminal_mappings true
|
||||
;; whether or not the open mapping applies in the opened terminals
|
||||
:persist_size true
|
||||
:persist_mode true
|
||||
;; if set to true (default) the previous terminal mode will be remembered
|
||||
:autochdir true}
|
||||
:keys []})
|
||||
@@ -0,0 +1,28 @@
|
||||
(import-macros {: tx} :config.macros)
|
||||
|
||||
(local util (require :dotfiles.util))
|
||||
;; Determine load time of fugitive
|
||||
;; (vim.api.nvim_create_autocmd [:FileType] {:pattern ftype :callback setup-conceals})
|
||||
|
||||
(fn bufmap [mode from to] (util.noremap mode from to {:local? true}))
|
||||
|
||||
; (fn map-fugitive-keys []
|
||||
; (bufmap :n :<leader>gp ":Git pull<CR>")
|
||||
; (bufmap :n :<leader>gP ":Git push<CR>")
|
||||
; (bufmap :n :<leader>gF ":Git push -f<CR>"))
|
||||
|
||||
; (vim.api.nvim_create_autocmd [:FileType]
|
||||
; {:pattern :fugitive :callback map-fugitive-keys})
|
||||
|
||||
[(tx :tpope/vim-dadbod {})
|
||||
(tx :tpope/vim-dispatch {})
|
||||
; (tx :tpope/vim-fugitive {})
|
||||
(tx :tpope/vim-git {:lazy false})
|
||||
(tx :tpope/vim-pathogen {})
|
||||
(tx :tpope/vim-rails {})
|
||||
(tx :tpope/vim-repeat {})
|
||||
(tx :tpope/vim-rhubarb {})
|
||||
(tx :tpope/vim-surround {})
|
||||
(tx :tpope/vim-unimpaired {})
|
||||
(tx :tpope/vim-vinegar {:lazy false})]
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
(import-macros {: tx} :config.macros)
|
||||
|
||||
(vim.api.nvim_create_autocmd :FileType
|
||||
{:pattern ["*"]
|
||||
:callback #(vim.schedule #(pcall #(vim.treesitter.start)))})
|
||||
|
||||
(tx :nvim-treesitter/nvim-treesitter
|
||||
{:branch :main
|
||||
:build ":TSUpdate"
|
||||
:opts {:indent {:enable true}
|
||||
:highlight {:enable true}
|
||||
:folds {:enable true}
|
||||
:ensure_installed [:bash
|
||||
:clojure
|
||||
:diff
|
||||
:elm
|
||||
:fennel
|
||||
:html
|
||||
:javascript
|
||||
:jsdoc
|
||||
:json
|
||||
:lua
|
||||
:luadoc
|
||||
:luap
|
||||
:markdown
|
||||
:markdown_inline
|
||||
:regex
|
||||
:ruby
|
||||
:toml
|
||||
:vim
|
||||
:vimdoc
|
||||
:xml
|
||||
:yaml]}})
|
||||
@@ -0,0 +1,3 @@
|
||||
(import-macros {: tx} :config.macros)
|
||||
|
||||
(tx :folke/which-key.nvim {:event "VeryLazy"})
|
||||
+21
-16
@@ -1,24 +1,29 @@
|
||||
local execute = vim.api.nvim_command
|
||||
local fn = vim.fn
|
||||
|
||||
local pack_path = fn.stdpath("data") .. "/site/pack"
|
||||
local fmt = string.format
|
||||
require("config.lazy")
|
||||
|
||||
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
|
||||
-- local pack_path = fn.stdpath("data") .. "/site/pack"
|
||||
-- local fmt = string.format
|
||||
|
||||
-- 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
|
||||
|
||||
-- Bootstrap essential plugins required for installing and loading the rest.
|
||||
ensure("wbthomason", "packer.nvim")
|
||||
ensure("Olical", "aniseed")
|
||||
-- ensure("wbthomason", "packer.nvim")
|
||||
-- ensure("Olical", "aniseed")
|
||||
-- ensure("lifepillar", "vim-solarized8")
|
||||
|
||||
-- Enable Aniseed's automatic compilation and loading of Fennel source code.
|
||||
vim.g["aniseed#env"] = {
|
||||
module = "dotfiles.init",
|
||||
compile = true
|
||||
}
|
||||
-- vim.g["aniseed#env"] = {
|
||||
-- module = "dotfiles.init",
|
||||
-- compile = true
|
||||
-- }
|
||||
--
|
||||
require("dotfiles.init")
|
||||
@@ -0,0 +1,54 @@
|
||||
{
|
||||
"asyncrun.vim": { "branch": "master", "commit": "98d3c0fdeb983f0ef62fe3a49da440f6d2c045ce" },
|
||||
"baleia.nvim": { "branch": "main", "commit": "710537ff5cd669c5a76c5f5b6a9169fd9b913d18" },
|
||||
"cmp-buffer": { "branch": "main", "commit": "b74fab3656eea9de20a9b8116afa3cfc4ec09657" },
|
||||
"cmp-cmdline": { "branch": "main", "commit": "d126061b624e0af6c3a556428712dd4d4194ec6d" },
|
||||
"cmp-conjure": { "branch": "master", "commit": "8c9a88efedc0e5bf3165baa6af8a407afe29daf6" },
|
||||
"cmp-nvim-lsp": { "branch": "main", "commit": "cbc7b02bb99fae35cb42f514762b89b5126651ef" },
|
||||
"cmp-path": { "branch": "main", "commit": "c642487086dbd9a93160e1679a1327be111cbc25" },
|
||||
"codediff.nvim": { "branch": "main", "commit": "7608f3b436ce1f84a4888f75e53079caa981a2e9" },
|
||||
"conform.nvim": { "branch": "master", "commit": "619363c30309d29ffa631e67c8183f2a72caa373" },
|
||||
"conjure": { "branch": "main", "commit": "16b436c0124dae26250986fd4e660529d6bb14f0" },
|
||||
"fennel.vim": { "branch": "main", "commit": "0a5c89e7f31d2721a36f7043ee98e24e22e6325e" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "306a05526ada86a7b30af95c5cc81ffba93fef97" },
|
||||
"lsp-colors.nvim": { "branch": "main", "commit": "2bbe7541747fd339bdd8923fc45631a09bb4f1e5" },
|
||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "1a31f824b9cd5bc6f342fc29e9a53b60d74af245" },
|
||||
"mason-update-all": { "branch": "main", "commit": "332aa2586295f93a32643eb2b580f899458215a1" },
|
||||
"mason.nvim": { "branch": "main", "commit": "fc98833b6da5de5a9c5b1446ac541577059555be" },
|
||||
"neo-tree.nvim": { "branch": "v3.x", "commit": "ebd66767191714e008ce73b769518a763ff31bdc" },
|
||||
"neogit": { "branch": "master", "commit": "5d1b65d6215928e941e1a6a4e76e02fd45ada31f" },
|
||||
"nfnl": { "branch": "main", "commit": "ac0177c5549df7abba7a19554c18a7765386c894" },
|
||||
"nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" },
|
||||
"nvim-autopairs": { "branch": "master", "commit": "7b9923abad60b903ece7c52940e1321d39eccc79" },
|
||||
"nvim-cmp": { "branch": "main", "commit": "a1d504892f2bc56c2e79b65c6faded2fd21f3eca" },
|
||||
"nvim-dap": { "branch": "master", "commit": "531771530d4f82ad2d21e436e3cc052d68d7aebb" },
|
||||
"nvim-dap-ui": { "branch": "master", "commit": "1a66cabaa4a4da0be107d5eda6d57242f0fe7e49" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "a683e0ddf0cf64c6cd689e18ffb480ade3c162b7" },
|
||||
"nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" },
|
||||
"nvim-notify": { "branch": "master", "commit": "8701bece920b38ea289b457f902e2ad184131a5d" },
|
||||
"nvim-treesitter": { "branch": "main", "commit": "4916d6592ede8c07973490d9322f187e07dfefac" },
|
||||
"nvim-web-devicons": { "branch": "master", "commit": "dfbfaa967a6f7ec50789bead7ef87e336c1fa63c" },
|
||||
"paredit": { "branch": "master", "commit": "60203e50698ed2211b4434a66ab2258a1a6ac3b5" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "74b06c6c75e4eeb3108ec01852001636d85a932b" },
|
||||
"popup.nvim": { "branch": "master", "commit": "b7404d35d5d3548a82149238289fa71f7f6de4ac" },
|
||||
"rainbow-delimiters.nvim": { "branch": "master", "commit": "a798325b7f36acc62741d1029930a7b96d4dd4bf" },
|
||||
"smart-splits.nvim": { "branch": "master", "commit": "2aad9808f289f5d65cfa77840a04b8590e5e34e9" },
|
||||
"telescope.nvim": { "branch": "master", "commit": "5255aa27c422de944791318024167ad5d40aad20" },
|
||||
"todo-comments.nvim": { "branch": "main", "commit": "31e3c38ce9b29781e4422fc0322eb0a21f4e8668" },
|
||||
"toggleterm.nvim": { "branch": "main", "commit": "9a88eae817ef395952e08650b3283726786fb5fb" },
|
||||
"vim-dadbod": { "branch": "master", "commit": "6d1d41da4873a445c5605f2005ad2c68c99d8770" },
|
||||
"vim-dispatch": { "branch": "master", "commit": "a2ff28abdb2d89725192db5b8562977d392a4d3f" },
|
||||
"vim-git": { "branch": "master", "commit": "485e38f29494e46a9998100e707c755d114155f1" },
|
||||
"vim-gitgutter": { "branch": "main", "commit": "21c977e8597c468c7dc76001389b0b430d46a4b0" },
|
||||
"vim-pathogen": { "branch": "master", "commit": "ac4dd9494fa9008754e49dff85bff1b5746c89b4" },
|
||||
"vim-rails": { "branch": "master", "commit": "b0a5c76f86ea214ade36ab0b811e730c3f0add67" },
|
||||
"vim-repeat": { "branch": "master", "commit": "65846025c15494983dafe5e3b46c8f88ab2e9635" },
|
||||
"vim-rhubarb": { "branch": "master", "commit": "5496d7c94581c4c9ad7430357449bb57fc59f501" },
|
||||
"vim-solarized8": { "branch": "neovim", "commit": "4ef98a611553a8093ae9e5af078ef6f94071e886" },
|
||||
"vim-surround": { "branch": "master", "commit": "3d188ed2113431cf8dac77be61b842acb64433d9" },
|
||||
"vim-unimpaired": { "branch": "master", "commit": "db65482581a28e4ccf355be297f1864a4e66985c" },
|
||||
"vim-vinegar": { "branch": "master", "commit": "bb1bcddf43cfebe05eb565a84ab069b357d0b3d6" },
|
||||
"vim-vsnip": { "branch": "master", "commit": "9bcfabea653abdcdac584283b5097c3f8760abaa" },
|
||||
"vim-vsnip-integ": { "branch": "master", "commit": "c7c93934dece8315db3649bdc6898b76358a8b8d" },
|
||||
"which-key.nvim": { "branch": "main", "commit": "3aab2147e74890957785941f0c1ad87d0a44c15a" }
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
-- Bootstrap lazy.nvim
|
||||
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||
if not (vim.uv or vim.loop).fs_stat(lazypath) then
|
||||
local lazyrepo = "https://github.com/folke/lazy.nvim.git"
|
||||
local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
|
||||
if vim.v.shell_error ~= 0 then
|
||||
vim.api.nvim_echo({
|
||||
{ "Failed to clone lazy.nvim:\n", "ErrorMsg" },
|
||||
{ out, "WarningMsg" },
|
||||
{ "\nPress any key to exit..." },
|
||||
}, true, {})
|
||||
vim.fn.getchar()
|
||||
os.exit(1)
|
||||
end
|
||||
end
|
||||
vim.opt.rtp:prepend(lazypath)
|
||||
|
||||
-- Setup lazy.nvim
|
||||
require("lazy").setup({
|
||||
spec = {
|
||||
-- import your plugins
|
||||
{ import = "plugins" },
|
||||
},
|
||||
change_detection = {
|
||||
notify = false,
|
||||
},
|
||||
-- Configure any other settings here. See the documentation for more details.
|
||||
-- colorscheme that will be used when installing plugins.
|
||||
install = { colorscheme = { "solarized8" } },
|
||||
-- automatically check for plugin updates
|
||||
checker = { enabled = true },
|
||||
})
|
||||
@@ -0,0 +1,30 @@
|
||||
-- [nfnl] fnl/dotfiles/conceal.fnl
|
||||
local u = require("dotfiles.util")
|
||||
local conceals = {defn = "\240\157\145\147", fn = "\206\187", lambda = "\206\187", ["and"] = "\226\136\167", ["&&"] = "\226\136\167", ["or"] = "\226\136\168", ["||"] = "\226\136\168", ["not"] = "\194\172", ["!"] = "\194\172", ["for"] = "\226\136\128", ["in"] = "\226\136\136", ["true"] = "\226\138\164", ["false"] = "\226\138\165"}
|
||||
local function setup_conceals()
|
||||
vim.fn.clearmatches()
|
||||
for the_match, replacement in pairs(conceals) do
|
||||
local the_match0 = ("\\<" .. the_match .. "\\>")
|
||||
vim.fn.matchadd("Conceal", the_match0, 0, -1, {conceal = replacement})
|
||||
end
|
||||
vim.wo.conceallevel = 2
|
||||
vim.wo.concealcursor = "nvc"
|
||||
return nil
|
||||
end
|
||||
local function toggle_conceal()
|
||||
if (0 == vim.wo.conceallevel) then
|
||||
vim.wo.conceallevel = 2
|
||||
return nil
|
||||
else
|
||||
vim.wo.conceallevel = 0
|
||||
return nil
|
||||
end
|
||||
end
|
||||
vim.api.nvim_create_user_command("ToggleConceal", toggle_conceal, {})
|
||||
vim.api.nvim_create_user_command("SetupConceals", setup_conceals, {})
|
||||
u.nnoremap("<leader>ts", "call ToggleConceal()")
|
||||
local pretty_filetypes = {"fennel", "clojure"}
|
||||
for _, ftype in pairs(pretty_filetypes) do
|
||||
vim.api.nvim_create_autocmd({"FileType"}, {pattern = ftype, callback = setup_conceals})
|
||||
end
|
||||
return {["setup-conceals"] = setup_conceals}
|
||||
@@ -0,0 +1,46 @@
|
||||
-- [nfnl] fnl/dotfiles/core.fnl
|
||||
local a = require("nfnl.core")
|
||||
local u = require("dotfiles.util")
|
||||
vim.cmd.set("shortmess+=c")
|
||||
vim.cmd.set("path+=**")
|
||||
vim.cmd.set("wildignore+=*.o,*.obj,.git,*.rbc,*.class,.svn,vendor/gems/*")
|
||||
local function safe_source(filename)
|
||||
local glob = vim.fn.glob(filename)
|
||||
if not a["empty?"](glob) then
|
||||
return vim.fn.source(filename)
|
||||
else
|
||||
return nil
|
||||
end
|
||||
end
|
||||
local backup_dir = (vim.fn.glob("$HOME") .. "/.vim/backup")
|
||||
local undo_dir = (vim.fn.glob("$HOME") .. "/.vim/backup")
|
||||
local on_opts = {"autoindent", "autoread", "expandtab", "exrc", "hlsearch", "ignorecase", "incsearch", "number", "ruler", "secure", "shiftround", "showcmd", "showmatch", "smartcase", "splitbelow", "splitright", "termguicolors", "title", "undofile", "wildmenu"}
|
||||
local val_based_opts = {laststatus = 2, encoding = "utf-8", history = 500, redrawtime = 5000, scrolloff = 3, guifont = "Hasklig", guifontwide = "Hasklig", background = "dark", backupdir = backup_dir, directory = backup_dir, grepprg = "ag --vimgrep", tags = "tags", updatetime = 300, signcolumn = "auto:1-3", colorcolumn = {81, 100}, cmdheight = 2, undodir = undo_dir, undolevels = 1000, undoreload = 10000, foldmethod = "expr", foldexpr = "nvim_treesitter#foldexpr()", foldlevelstart = 100, foldlevel = 99, tabstop = 2, shiftwidth = 2, softtabstop = 2, mouse = "", list = true, listchars = "tab:\226\158\165\\ ,trail:\194\183,nbsp:\226\150\160", backspace = "indent,eol,start", wildmode = "list:longest,list:full", wrap = false}
|
||||
local append_val_opts = {diffopt = "algorithm:patience"}
|
||||
local function set_opt(_2_)
|
||||
local opt = _2_[1]
|
||||
local val = _2_[2]
|
||||
vim.opt[a.str(opt)] = val
|
||||
return nil
|
||||
end
|
||||
local function set_opt_2b(_3_)
|
||||
local opt = _3_[1]
|
||||
local val = _3_[2]
|
||||
local existing_opt_val = a.get(vim.o, opt)
|
||||
vim.opt[a.str(opt)] = a.str(existing_opt_val, ",", val)
|
||||
return nil
|
||||
end
|
||||
local function set_opt_on(opt)
|
||||
return set_opt({opt, true})
|
||||
end
|
||||
a.map(set_opt_on, on_opts)
|
||||
a["map-indexed"](set_opt, val_based_opts)
|
||||
a["map-indexed"](set_opt_2b, append_val_opts)
|
||||
vim.cmd.syntax("on")
|
||||
vim.cmd.colorscheme("solarized8")
|
||||
vim.api.nvim_create_autocmd({"vimenter"}, {pattern = "*", command = "colorscheme solarized8", nested = true})
|
||||
local function make_fennel_scratch()
|
||||
return vim.cmd("new | setlocal bt=nofile bh=wipe nobl noswapfile nu filetype=fennel")
|
||||
end
|
||||
vim.api.nvim_create_user_command("FennelScratchBuffer", make_fennel_scratch, {})
|
||||
return u.nnoremap("<leader>fsb", ":call FennelScratchBuffer ()<CR>")
|
||||
@@ -0,0 +1,22 @@
|
||||
-- [nfnl] fnl/dotfiles/init.fnl
|
||||
local a = require("nfnl.core")
|
||||
local str = require("nfnl.string")
|
||||
local fs = require("nfnl.fs")
|
||||
local function require_all()
|
||||
local require_exclusions = a["->set"]({"init"})
|
||||
local function _1_(_241)
|
||||
return ("dotfiles." .. _241)
|
||||
end
|
||||
local function _2_(_241)
|
||||
return not a["contains?"](require_exclusions, _241)
|
||||
end
|
||||
local function _3_(_241)
|
||||
return a.first(str.split(_241, ".fnl"))
|
||||
end
|
||||
return a.map(_1_, a.filter(_2_, a.map(_3_, fs.relglob("fnl/dotfiles", "*.fnl"))))
|
||||
end
|
||||
require("dotfiles.core")
|
||||
require("dotfiles.mapping")
|
||||
require("dotfiles.conceal")
|
||||
require("dotfiles.zoom-toggle")
|
||||
return a.println("(re)loaded")
|
||||
@@ -0,0 +1,38 @@
|
||||
-- [nfnl] fnl/dotfiles/mapping.fnl
|
||||
local util = require("dotfiles.util")
|
||||
local nfnl = require("nfnl.api")
|
||||
local function noremap(mode, from, to)
|
||||
return vim.keymap.set(mode, from, to, {noremap = true})
|
||||
end
|
||||
local function _1_()
|
||||
nfnl["compile-all-files"](vim.fn.stdpath("config"))
|
||||
return vim.cmd.source((vim.fn.stdpath("config") .. "/init.lua"))
|
||||
end
|
||||
vim.keymap.set("n", "<leader>`", _1_)
|
||||
noremap("n", "<Enter>", ":nohlsearch<Enter>/<BS>")
|
||||
noremap("n", "<leader>zz", ":normal! 1z=<cr>")
|
||||
noremap("i", "<C-V><C-O>", ":set paste<CR><C-R><C-R>+<C-O>:set nopaste<CR>")
|
||||
noremap("n", "<F5>", "\"=strftime(\"%F\")<CR>p")
|
||||
noremap("i", "<F5>", "<C-R>=strftime(\"%F\")<CR>")
|
||||
noremap("n", "<M-5>", "\"=trim(system('date -u'))<CR>p")
|
||||
noremap("i", "<M-5>", "<C-R>=trim(system('date -u'))<CR>")
|
||||
noremap("v", "<leader>ah", "S<a href=\"\" target=\"_blank\" rel=\"nopener noreferrer\"><CR>")
|
||||
noremap("v", "<leader>ml", "xi[<c-r>\"]()<esc>")
|
||||
noremap("n", "<C-e>", "3<C-e>")
|
||||
noremap("n", "<C-y>", "3<C-y>")
|
||||
noremap("n", "<C-k>", "[e")
|
||||
noremap("n", "<C-j>", "]e")
|
||||
noremap("v", "<C-k>", "[egv")
|
||||
noremap("v", "<C-j>", "]egv")
|
||||
noremap("n", "<leader>jpp", ":%!python -m json.tool --indent=2<CR>")
|
||||
noremap("c", "w!!", "w !sudo tee % >/dev/null")
|
||||
noremap("n", "gnh", ":GitGutterNextHunk<CR>")
|
||||
noremap("n", "gph", ":GitGutterPrevHunk<CR>")
|
||||
noremap("n", "gsh", ":GitGutterStageHunk<CR>")
|
||||
noremap("n", "<leader>mv", ":AsyncRun -mode=bang open -a Marked\\ 2.app '%:p'<cr>")
|
||||
vim.api.nvim_create_autocmd({"FileType"}, {pattern = "sql", command = "nmap <leader>s vap<leader>S"})
|
||||
noremap("n", "Q", ":.!bash <CR>")
|
||||
util.lvnoremap("tw", "<C-U>s/\\s\\+$//ge<CR>:nohlsearch<Enter>/<BS>")
|
||||
util.lnnoremap("tw", "<C-U>.s/\\s\\+$//ge<CR>:nohlsearch<Enter>/<BS>")
|
||||
util.lnnoremap("<C-k>", ":set scrollback=1 | :set scrollback 100000<cr>", {silent = true})
|
||||
return util.ltnoremap("<C-k>", "<C-\\><C-n><leader><C-l>i", {silent = true})
|
||||
@@ -0,0 +1,18 @@
|
||||
-- [nfnl] fnl/dotfiles/plugin/cmp.fnl
|
||||
local cmp = require("cmp")
|
||||
local luasnip = require("luasnip")
|
||||
local cmp_src_menu_items = {buffer = "buff", conjure = "conj", nvim_lsp = "lsp"}
|
||||
local cmp_srcs = {{name = "nvim_lsp"}, {name = "nvim_lua"}, {name = "luasnip"}, {name = "vsnip"}, {name = "conjure"}, {name = "buffer"}, {name = "orgmode"}, {name = "emoji", max_item_count = 8}}
|
||||
local cmp0 = require("cmp")
|
||||
local function _1_(entry, item)
|
||||
item.menu = (cmp_src_menu_items[entry.source.name] or "")
|
||||
return item
|
||||
end
|
||||
local function _2_(args)
|
||||
if args then
|
||||
return luasnip.lsp_expand(args.body)
|
||||
else
|
||||
return nil
|
||||
end
|
||||
end
|
||||
return cmp0.setup({formatting = {format = _1_}, mapping = {["<C-p>"] = cmp0.mapping.select_prev_item(), ["<C-n>"] = cmp0.mapping.select_next_item(), ["<C-b>"] = cmp0.mapping.scroll_docs(( - 4)), ["<C-f>"] = cmp0.mapping.scroll_docs(4), ["<C-Space>"] = cmp0.mapping.complete(), ["<C-e>"] = cmp0.mapping.close(), ["<C-y>"] = cmp0.mapping.confirm({select = true})}, snippet = {expand = _2_}, sources = cmp_srcs})
|
||||
@@ -0,0 +1,3 @@
|
||||
-- [nfnl] fnl/dotfiles/plugin/colorizer.fnl
|
||||
local colorizer = require("colorizer")
|
||||
return colorizer.setup({"*"}, {RGB = true, RRGGBB = true, names = true, RRGGBBAA = true, rgb_fn = true, hsl_fn = true, css = true, css_fn = true})
|
||||
@@ -0,0 +1,8 @@
|
||||
-- [nfnl] fnl/dotfiles/plugin/conjure.fnl
|
||||
local core = require("nfnl.core")
|
||||
local conjure_config = require("conjure.config")
|
||||
vim.g["conjure#mapping#doc_word"] = "gk"
|
||||
vim.g["conjure#client#clojure#nrepl#mapping#session_clone"] = "sC"
|
||||
vim.g["conjure#extract#tree_sitter#enabled"] = true
|
||||
conjure_config["assoc-in"]({"filetypes"}, core.concat(conjure_config.filetypes(), {"markdown"}))
|
||||
return conjure_config["assoc-in"]({"filetype", "markdown"}, "conjure.client.clojure.nrepl")
|
||||
@@ -0,0 +1,2 @@
|
||||
-- [nfnl] fnl/dotfiles/plugin/dadbodui.fnl
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
-- [nfnl] fnl/dotfiles/plugin/easyalign.fnl
|
||||
local util = require("dotfiles.util")
|
||||
return util.noremap("v", "<leader><bslash>", "EasyAlign*<Bar>")
|
||||
@@ -0,0 +1,11 @@
|
||||
-- [nfnl] fnl/dotfiles/plugin/fugitive.fnl
|
||||
local util = require("dotfiles.util")
|
||||
local function bufmap(mode, from, to)
|
||||
return util.noremap(mode, from, to, {["local?"] = true})
|
||||
end
|
||||
local function map_fugitive_keys()
|
||||
bufmap("n", "<leader>gp", ":Git pull<CR>")
|
||||
bufmap("n", "<leader>gP", ":Git push<CR>")
|
||||
return bufmap("n", "<leader>gF", ":Git push -f<CR>")
|
||||
end
|
||||
return vim.api.nvim_create_autocmd({"FileType"}, {pattern = "fugitive", callback = map_fugitive_keys})
|
||||
@@ -0,0 +1,3 @@
|
||||
-- [nfnl] fnl/dotfiles/plugin/headlines.fnl
|
||||
local headlines = require("headlines")
|
||||
return nil
|
||||
@@ -0,0 +1,7 @@
|
||||
-- [nfnl] fnl/dotfiles/plugin/hex.fnl
|
||||
local hex = require("hex")
|
||||
if hex then
|
||||
return hex.setup()
|
||||
else
|
||||
return nil
|
||||
end
|
||||
@@ -0,0 +1,153 @@
|
||||
-- [nfnl] fnl/dotfiles/plugin/lspconfig.fnl
|
||||
local a = require("nfnl.core")
|
||||
local u = require("dotfiles.util")
|
||||
local lsp = require("vim.lsp")
|
||||
local lspconfig = require("lspconfig")
|
||||
local cmp_nvim_lsp = require("cmp_nvim_lsp")
|
||||
local function bufmap(mode, from, to, opts)
|
||||
return u.noremap(mode, from, to, a.merge({["local?"] = true}, opts))
|
||||
end
|
||||
local function nbufmap(from, to, opts)
|
||||
return bufmap("n", from, to, opts)
|
||||
end
|
||||
local function xbufmap(from, to, opts)
|
||||
return bufmap("x", from, to, opts)
|
||||
end
|
||||
local function lsp_execute_command(client, cmd, ...)
|
||||
local buf_uri = vim.uri_from_bufnr(0)
|
||||
local cursor = vim.api.nvim_win_get_cursor(0)
|
||||
local r = (a.first(cursor) - 1)
|
||||
local c = a.second(cursor)
|
||||
local opts = {buf_uri, r, c}
|
||||
local args = a.concat(opts, {...})
|
||||
return client.request_sync("workspace/executeCommand", {command = cmd, arguments = args}, nil, 0)
|
||||
end
|
||||
vim.diagnostic.config({signs = {text = {[vim.diagnostic.severity.ERROR] = "\226\152\162\239\184\143", [vim.diagnostic.severity.WARN] = "\226\154\160\239\184\143", [vim.diagnostic.severity.INFO] = "\226\132\185\239\184\143", [vim.diagnostic.severity.HINT] = "\240\159\148\142"}}})
|
||||
local 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.diagnostic.goto_prev()", ["]g"] = "lua vim.diagnostic.goto_next()", ["<leader>ca"] = "lua vim.lsp.buf.code_action()", ["<leader>cl"] = "lua vim.lsp.codelens.run()", ["<leader>ic"] = "lua vim.lsp.buf.incoming_calls()", ["<leader>sld"] = "lua vim.diagnostic.open_float(nil, {source = 'always'})", ["<leader>rn"] = "lua vim.lsp.buf.rename()", ["<leader>fa"] = "lua vim.lsp.buf.format()"}
|
||||
local client_nmappings = {clojure_lsp = {}}
|
||||
local client_command_lnmappings
|
||||
local function _1_()
|
||||
return vim.fn.input("Namespace name: ")
|
||||
end
|
||||
local function _2_()
|
||||
return vim.fn.input("Namespace name: ")
|
||||
end
|
||||
local function _3_()
|
||||
return vim.fn.input("Namespace as: ")
|
||||
end
|
||||
local function _4_()
|
||||
return vim.fn.input("Namespace name: ")
|
||||
end
|
||||
local function _5_()
|
||||
return vim.fn.input("Definition name: ")
|
||||
end
|
||||
local function _6_()
|
||||
return vim.fn.input("Function name: ")
|
||||
end
|
||||
local function _7_()
|
||||
return vim.fn.input("Binding name: ")
|
||||
end
|
||||
local function _8_()
|
||||
return vim.fn.input("File name: ")
|
||||
end
|
||||
local function _9_()
|
||||
return vim.fn.input("Binding name: ")
|
||||
end
|
||||
local function _10_()
|
||||
return vim.fn.input("Function name: ")
|
||||
end
|
||||
local function _11_()
|
||||
return vim.fn.input("")
|
||||
end
|
||||
client_command_lnmappings = {clojure_lsp = {ai = {"add-import-to-namespace", {_1_}}, am = {"add-missing-libspec", {}}, as = {"add-require-suggestion", {_2_, _3_, _4_}}, cc = {"cycle-coll", {}}, cn = {"clean-ns", {}}, cp = {"cycle-privacy", {}}, ct = {"create-test", {}}, df = {"drag-forward", {}}, db = {"drag-backward", {}}, dk = {"destructure-keys", {}}, ed = {"extract-to-def", {_5_}}, ref = {"extract-function", {_6_}}, el = {"expand-let", {}}, fe = {"create-function", {}}, il = {"introduce-let", {_7_}}, is = {"inline-symbol", {}}, ma = {"resolve-macro-as", {}}, mf = {"move-form", {_8_}}, ml = {"move-to-let", {_9_}}, pf = {"promote-fn", {_10_}}, sc = {"change-collection", {_11_, "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", {}}}}
|
||||
local server_specific_opts = {}
|
||||
local function bind_client_mappings(client)
|
||||
local client_name = a.get(client, "name")
|
||||
local mappings = a.get(client_nmappings, client_name)
|
||||
local command_lnmappings = a.get(client_command_lnmappings, client_name)
|
||||
if mappings then
|
||||
for mapping, cmd in pairs(mappings) do
|
||||
nbufmap(mapping, cmd, {})
|
||||
end
|
||||
else
|
||||
end
|
||||
if command_lnmappings then
|
||||
for lnmapping, command_mapping in pairs(command_lnmappings) do
|
||||
local lsp_cmd = a.first(command_mapping)
|
||||
local mapping = ("<leader>" .. lnmapping)
|
||||
local cmd
|
||||
local function _13_()
|
||||
local opts
|
||||
do
|
||||
local s = ""
|
||||
for _i, opt in ipairs(a.second(command_mapping)) do
|
||||
local _14_
|
||||
if ("function" == type(opt)) then
|
||||
_14_ = opt()
|
||||
else
|
||||
_14_ = opt
|
||||
end
|
||||
s = (s .. _14_)
|
||||
end
|
||||
opts = s
|
||||
end
|
||||
return lsp_execute_command(client, lsp_cmd, opts)
|
||||
end
|
||||
cmd = _13_
|
||||
nbufmap(mapping, cmd, {desc = ("LSP command `" .. lsp_cmd .. "`")})
|
||||
end
|
||||
return nil
|
||||
else
|
||||
return nil
|
||||
end
|
||||
end
|
||||
local function on_attach(client, bufnr)
|
||||
for mapping, cmd in pairs(core_nmappings) do
|
||||
nbufmap(mapping, cmd, {})
|
||||
end
|
||||
xbufmap("<leader>fa", "lua vim.lsp.buf.format()", {desc = "Format buffer"})
|
||||
vim.api.nvim_set_option_value("omnifunc", "v:lua.vim.lsp.omnifunc", {buf = 0})
|
||||
bind_client_mappings(client)
|
||||
if client.server_capabilities.documentHighlightProvider then
|
||||
for hlgroup, base_group in pairs({LspReferenceRead = "SpecialKey", LspReferenceText = "SpecialKey", LspReferenceWrite = "SpecialKey"}) do
|
||||
vim.api.nvim_set_hl(0, hlgroup, a.merge(vim.api.nvim_get_hl_by_name(base_group, true), {italic = true, foreground = "#6c71c4", background = "NONE"}))
|
||||
end
|
||||
local group = vim.api.nvim_create_augroup("LspDocumentHighlight", {clear = true})
|
||||
local function _17_()
|
||||
return vim.lsp.buf.document_highlight()
|
||||
end
|
||||
vim.api.nvim_create_autocmd({"CursorHold", "CursorHoldI"}, {group = group, pattern = "<buffer>", callback = _17_})
|
||||
local function _18_()
|
||||
return vim.lsp.buf.clear_references()
|
||||
end
|
||||
vim.api.nvim_create_autocmd({"CursorMoved"}, {group = group, pattern = "<buffer>", callback = _18_})
|
||||
else
|
||||
end
|
||||
if client.server_capabilities.documentFormattingProvider then
|
||||
local function _20_()
|
||||
return vim.lsp.buf.format()
|
||||
end
|
||||
vim.api.nvim_create_autocmd({"BufWritePre"}, {pattern = "<buffer>", callback = _20_})
|
||||
else
|
||||
end
|
||||
return print("LSP Client Attached.")
|
||||
end
|
||||
local base_server_opts
|
||||
do
|
||||
local capabilities = cmp_nvim_lsp.default_capabilities(lsp.protocol.make_client_capabilities())
|
||||
base_server_opts = {on_attach = on_attach, capabilities = capabilities, flags = {debounce_text_changes = 150}}
|
||||
end
|
||||
local function default_server_handler(server_name)
|
||||
local specific_opts = a.get(server_specific_opts, server_name, {})
|
||||
local server_opts = a.merge(base_server_opts, specific_opts)
|
||||
return vim.lsp.config(server_name, server_opts)
|
||||
end
|
||||
local function setup_handlers(language_servers)
|
||||
for _, server_name in pairs(language_servers) do
|
||||
default_server_handler(server_name)
|
||||
end
|
||||
return nil
|
||||
end
|
||||
u.nnoremap("<leader>li", "LspInfo")
|
||||
vim.api.nvim_create_user_command("LspExecuteCommand", lsp_execute_command, {nargs = "+"})
|
||||
return {on_attach = on_attach, ["default-server-handler"] = default_server_handler, ["setup-handlers"] = setup_handlers}
|
||||
@@ -0,0 +1,32 @@
|
||||
-- [nfnl] fnl/dotfiles/plugin/luasnip.fnl
|
||||
local luasnip = require("luasnip")
|
||||
local select_choice = require("luasnip.extras.select_choice")
|
||||
if luasnip then
|
||||
local function _1_()
|
||||
if luasnip.expand_or_jumpable() then
|
||||
return luasnip.expand_or_jump()
|
||||
else
|
||||
return nil
|
||||
end
|
||||
end
|
||||
vim.keymap.set({"i", "s"}, "<C-k>", _1_, {silent = true})
|
||||
local function _3_()
|
||||
if luasnip.jumpable(-1) then
|
||||
return luasnip.jump(-1)
|
||||
else
|
||||
return nil
|
||||
end
|
||||
end
|
||||
vim.keymap.set({"i", "s"}, "<C-j>", _3_, {silent = true})
|
||||
local function _5_()
|
||||
if luasnip.choice_active() then
|
||||
return luasnip.choice(1)
|
||||
else
|
||||
return nil
|
||||
end
|
||||
end
|
||||
vim.keymap.set("i", "<C-l>", _5_)
|
||||
return vim.keymap.set("i", "<C-u>", select_choice)
|
||||
else
|
||||
return nil
|
||||
end
|
||||
@@ -0,0 +1,14 @@
|
||||
-- [nfnl] fnl/dotfiles/plugin/mason.fnl
|
||||
local mason = require("mason")
|
||||
local mason_lspconf = require("mason-lspconfig")
|
||||
local lspconfig = require("dotfiles.plugin.lspconfig")
|
||||
local function setup()
|
||||
mason.setup({ui = {icons = {package_installed = "\226\156\147"}}})
|
||||
if mason_lspconf then
|
||||
mason_lspconf.setup({ensure_installed = {"lua_ls"}, automatic_enable = true})
|
||||
return lspconfig["setup-handlers"](mason_lspconf.get_installed_servers())
|
||||
else
|
||||
return nil
|
||||
end
|
||||
end
|
||||
return setup()
|
||||
@@ -0,0 +1,3 @@
|
||||
-- [nfnl] fnl/dotfiles/plugin/nfnl.fnl
|
||||
local nfnl = require("nfnl")
|
||||
return nfnl.setup({compile_on_write = true})
|
||||
@@ -0,0 +1,9 @@
|
||||
-- [nfnl] fnl/dotfiles/plugin/null-ls.fnl
|
||||
local null_ls = require("null-ls")
|
||||
local lspconfig = require("dotfiles.plugin.lspconfig")
|
||||
if null_ls then
|
||||
local null_ls_server_options = {sources = {null_ls.builtins.formatting.stylua, null_ls.builtins.formatting.fnlfmt}, on_attach = lspconfig.on_attach}
|
||||
return null_ls.setup(null_ls_server_options)
|
||||
else
|
||||
return nil
|
||||
end
|
||||
@@ -0,0 +1,41 @@
|
||||
-- [nfnl] fnl/dotfiles/plugin/orgbullets.fnl
|
||||
local core = require("nfnl.core")
|
||||
local conceal = require("dotfiles.conceal")
|
||||
local ts_utils = require("dotfiles.ts-utils")
|
||||
local stars = {"\226\151\137", "\226\166\190", "\226\151\139", "\226\156\184", "\226\156\191", "\226\156\182", "\226\128\162", "\226\128\163"}
|
||||
local stars_query = "(headline (stars) @stars)"
|
||||
local function star_index(heading_level)
|
||||
local star_count = core.count(stars)
|
||||
local idx = math.fmod(heading_level, star_count)
|
||||
if (0 < idx) then
|
||||
return idx
|
||||
else
|
||||
return star_count
|
||||
end
|
||||
end
|
||||
local extmark_namespace = vim.api.nvim_create_namespace("HeaderStars")
|
||||
local star_captures = ts_utils["make-query"]("org", stars_query)
|
||||
local function gen_star_extmarks()
|
||||
if ("org" == vim.bo.filetype) then
|
||||
local bufnr = vim.api.nvim_get_current_buf()
|
||||
local star_count = core.count(stars)
|
||||
vim.api.nvim_buf_clear_namespace(bufnr, extmark_namespace, 0, -1)
|
||||
for id, node, metadata in star_captures(bufnr) do
|
||||
local start_line,start_col,end_row,end_col = node:range()
|
||||
local heading_level
|
||||
if (start_line == end_row) then
|
||||
heading_level = (end_col - start_col)
|
||||
else
|
||||
heading_level = nil
|
||||
end
|
||||
local star = core.get(stars, star_index(heading_level))
|
||||
local replacement = string.format(core.str("%", (2 + heading_level), "s"), star)
|
||||
vim.api.nvim_buf_set_extmark(bufnr, extmark_namespace, start_line, start_col, {end_col = end_col, end_row = end_row, virt_text = {{replacement, {}}}, virt_text_pos = "overlay", hl_mode = "combine"})
|
||||
end
|
||||
return nil
|
||||
else
|
||||
return nil
|
||||
end
|
||||
end
|
||||
local group = vim.api.nvim_create_augroup("HeaderStars", {clear = true})
|
||||
return vim.api.nvim_create_autocmd({"FileChangedShellPost", "Syntax", "TextChanged", "InsertLeave", "WinScrolled"}, {group = group, callback = conceal["setup-conceals"]})
|
||||
@@ -0,0 +1,4 @@
|
||||
-- [nfnl] fnl/dotfiles/plugin/orgmode.fnl
|
||||
local orgmode = require("orgmode")
|
||||
orgmode.setup({org_agenda_files = {"~/Dropbox/org/*", "~/my-orgs/**/*"}, org_default_notes_file = "~/Dropbox/org/refile.org", mappings = {org = {org_toggle_checkbox = "<C-.>"}}})
|
||||
return require("dotfiles.plugin.orgbullets")
|
||||
@@ -0,0 +1,4 @@
|
||||
-- [nfnl] fnl/dotfiles/plugin/packer.fnl
|
||||
local u = require("dotfiles.util")
|
||||
u.nnoremap("<leader>pi", "PackerInstall")
|
||||
return u.nnoremap("<leader>pu", "PackerUpdate")
|
||||
@@ -0,0 +1,92 @@
|
||||
-- [nfnl] fnl/dotfiles/plugin/paredit.fnl
|
||||
local a = require("nfnl.core")
|
||||
local ts_parsers = require("nvim-treesitter.parsers")
|
||||
local ts_utils = require("nvim-treesitter.ts_utils")
|
||||
local languagetree = require("vim.treesitter.languagetree")
|
||||
vim.g.paredit_smartjump = 1
|
||||
local function list_member_3f(xs, x)
|
||||
local function _1_(_241)
|
||||
return (x == _241)
|
||||
end
|
||||
return a.some(_1_, a.vals(xs))
|
||||
end
|
||||
local function bool__3eint(bool)
|
||||
if bool then
|
||||
return 1
|
||||
else
|
||||
return 0
|
||||
end
|
||||
end
|
||||
local function int__3ebool(x)
|
||||
if (0 == x) then
|
||||
return false
|
||||
else
|
||||
return true
|
||||
end
|
||||
end
|
||||
local function toggle_global_21(x)
|
||||
vim.g[x] = bool__3eint(not int__3ebool(a.get(vim.g, x)))
|
||||
return nil
|
||||
end
|
||||
local function language_at_cursor()
|
||||
local parser = ts_parsers.get_parser()
|
||||
local current_node = ts_utils.get_node_at_cursor()
|
||||
local range
|
||||
if current_node then
|
||||
range = {current_node:range()}
|
||||
else
|
||||
range = nil
|
||||
end
|
||||
local lang
|
||||
if range then
|
||||
lang = languagetree.language_for_range(parser, range)
|
||||
else
|
||||
lang = nil
|
||||
end
|
||||
if lang then
|
||||
return lang:lang()
|
||||
else
|
||||
return nil
|
||||
end
|
||||
end
|
||||
local function parser_language()
|
||||
local parser = ts_parsers.get_parser()
|
||||
if parser then
|
||||
return parser:lang()
|
||||
else
|
||||
return nil
|
||||
end
|
||||
end
|
||||
local paredit_langs = {"clojure", "fennel", "hy", "janet", "julia", "lfe", "lisp", "racket", "scheme", "shen"}
|
||||
local paredit_host_langs = {"org", "markdown", "asciidoc"}
|
||||
local function host_lang_in_3f(langs)
|
||||
return list_member_3f(langs, parser_language())
|
||||
end
|
||||
local function paredit_lang_3f(lang)
|
||||
return list_member_3f(paredit_langs, lang)
|
||||
end
|
||||
local function TreeSitterLangParedit()
|
||||
if host_lang_in_3f(paredit_host_langs) then
|
||||
local cursor_lang = language_at_cursor()
|
||||
if cursor_lang then
|
||||
vim.g.paredit_mode = bool__3eint(paredit_lang_3f(cursor_lang))
|
||||
return vim.fn.PareditInitBuffer()
|
||||
else
|
||||
return nil
|
||||
end
|
||||
else
|
||||
return nil
|
||||
end
|
||||
end
|
||||
local function _10_()
|
||||
return vim.fn.PareditInitBalancingAllBracketsBuffer()
|
||||
end
|
||||
vim.api.nvim_create_autocmd({"FileType"}, {pattern = "ruby", callback = _10_})
|
||||
local function _11_()
|
||||
return vim.fn.PareditInitBalancingAllBracketsBuffer()
|
||||
end
|
||||
vim.api.nvim_create_autocmd({"FileType"}, {pattern = "javascript", callback = _11_})
|
||||
local function _12_()
|
||||
return vim.fn.PareditInitBalancingAllBracketsBuffer()
|
||||
end
|
||||
return vim.api.nvim_create_autocmd({"FileType"}, {pattern = "terraform", callback = _12_})
|
||||
@@ -0,0 +1,19 @@
|
||||
-- [nfnl] fnl/dotfiles/plugin/smartsplits.fnl
|
||||
local smart_splits = require("smart-splits")
|
||||
if smart_splits then
|
||||
smart_splits.setup()
|
||||
vim.keymap.set("n", "<M-S-h>", smart_splits.resize_left)
|
||||
vim.keymap.set("n", "<M-S-j>", smart_splits.resize_down)
|
||||
vim.keymap.set("n", "<M-S-k>", smart_splits.resize_up)
|
||||
vim.keymap.set("n", "<M-S-l>", smart_splits.resize_right)
|
||||
vim.keymap.set("n", "<M-h>", smart_splits.move_cursor_left)
|
||||
vim.keymap.set("n", "<M-j>", smart_splits.move_cursor_down)
|
||||
vim.keymap.set("n", "<M-k>", smart_splits.move_cursor_up)
|
||||
vim.keymap.set("n", "<M-l>", smart_splits.move_cursor_right)
|
||||
vim.keymap.set("n", "<leader><leader>h", smart_splits.swap_buf_left)
|
||||
vim.keymap.set("n", "<leader><leader>j", smart_splits.swap_buf_down)
|
||||
vim.keymap.set("n", "<leader><leader>k", smart_splits.swap_buf_up)
|
||||
return vim.keymap.set("n", "<leader><leader>l", smart_splits.swap_buf_right)
|
||||
else
|
||||
return nil
|
||||
end
|
||||
@@ -0,0 +1,28 @@
|
||||
-- [nfnl] fnl/dotfiles/plugin/telescope.fnl
|
||||
local util = require("dotfiles.util")
|
||||
local telescope = require("telescope")
|
||||
local vimgrep_arguments = {"ag", "--nocolor", "--noheading", "--number", "--column", "--nobreak", "--smart-case", "--hidden", "--ignore", ".git", "--follow"}
|
||||
telescope.load_extension("projects")
|
||||
telescope.load_extension("yank_history")
|
||||
telescope.setup({pickers = {buffers = {mappings = {n = {d = "delete_buffer"}}}}, extensions = {projects = {projects = {}}}})
|
||||
util.lnnoremap("fc", "Telescope commands")
|
||||
util.lnnoremap("fC", "Telescope command_history")
|
||||
util.lnnoremap("ff", "Telescope git_files hidden=true")
|
||||
util.lnnoremap("f-", "Telescope find_files")
|
||||
util.lnnoremap("fg", "Telescope live_grep")
|
||||
util.lnnoremap("*", "Telescope grep_string")
|
||||
util.lnnoremap("fb", "Telescope buffers")
|
||||
util.lnnoremap("fd", "Telescope diagnostics")
|
||||
util.lnnoremap("fH", "Telescope help_tags")
|
||||
util.lnnoremap("fh", "Telescope oldfiles")
|
||||
util.lnnoremap("fp", "Telescope projects")
|
||||
util.lnnoremap("fm", "Telescope keymaps")
|
||||
util.lnnoremap("fM", "Telescope marks")
|
||||
util.lnnoremap("ft", "Telescope filetypes")
|
||||
util.lnnoremap("fq", "Telescope quickfix")
|
||||
util.lnnoremap("fl", "Telescope loclist")
|
||||
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")
|
||||
return util.lnnoremap("fy", "Telescope yank_history")
|
||||
@@ -0,0 +1,14 @@
|
||||
-- [nfnl] fnl/dotfiles/plugin/toggleterm.fnl
|
||||
local toggleterm = require("toggleterm")
|
||||
toggleterm.setup({open_mapping = "<c-\\>", start_in_insert = true, insert_mappings = true, terminal_mappings = true, persist_size = true, persist_mode = true, autochdir = true})
|
||||
local function set_terminal_keymaps()
|
||||
vim.keymap.set("t", "<esc>", "<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-j>", "<Cmd>wincmd j<CR>")
|
||||
vim.keymap.set("t", "<C-k>", "<Cmd>wincmd k<CR>")
|
||||
vim.keymap.set("t", "<C-l>", "<Cmd>wincmd l<CR>")
|
||||
return vim.keymap.set("t", "<C-w>", "<C-\\><C-n><C-w>")
|
||||
end
|
||||
vim.api.nvim_create_user_command("SetTerminalKeymaps", set_terminal_keymaps, {})
|
||||
return vim.api.nvim_create_autocmd({"TermOpen"}, {pattern = "term://*", callback = set_terminal_keymaps})
|
||||
@@ -0,0 +1,3 @@
|
||||
-- [nfnl] fnl/dotfiles/plugin/treesitter.fnl
|
||||
local treesitter_configs = require("nvim-treesitter.configs")
|
||||
return treesitter_configs.setup({highlight = {enable = true, additional_vim_regex_highlighting = {"org"}}, ensure_installed = "all"})
|
||||
@@ -0,0 +1,7 @@
|
||||
-- [nfnl] fnl/dotfiles/plugin/whichkey.fnl
|
||||
local which_key = require("which-key")
|
||||
if which_key then
|
||||
return which_key.setup({})
|
||||
else
|
||||
return nil
|
||||
end
|
||||
@@ -0,0 +1,23 @@
|
||||
-- [nfnl] fnl/dotfiles/plugin/yanky.fnl
|
||||
local yanky = require("yanky")
|
||||
yanky.setup({ring = {history_length = 100, storage = "shada", sync_with_numbered_registers = true, cancel_event = "update"}, system_clipboard = {sync_with_ring = true}})
|
||||
vim.keymap.set("n", "p", "<Plug>(YankyPutAfter)")
|
||||
vim.keymap.set("n", "P", "<Plug>(YankyPutBefore)")
|
||||
vim.keymap.set("n", "gp", "<Plug>(YankyGPutAfter)")
|
||||
vim.keymap.set("n", "gP", "<Plug>(YankyGPutBefore)")
|
||||
vim.keymap.set("n", "<c-n>", "<Plug>(YankyCycleForward)")
|
||||
vim.keymap.set("n", "<c-p>", "<Plug>(YankyCycleBackward)")
|
||||
vim.keymap.set("n", "]p", "<Plug>(YankyPutIndentAfterLinewise)")
|
||||
vim.keymap.set("n", "[p", "<Plug>(YankyPutIndentBeforeLinewise)")
|
||||
vim.keymap.set("n", "]P", "<Plug>(YankyPutIndentAfterLinewise)")
|
||||
vim.keymap.set("n", "[P", "<Plug>(YankyPutIndentBeforeLinewise)")
|
||||
vim.keymap.set("n", ">p", "<Plug>(YankyPutIndentAfterShiftRight)")
|
||||
vim.keymap.set("n", "<p", "<Plug>(YankyPutIndentAfterShiftLeft)")
|
||||
vim.keymap.set("n", ">P", "<Plug>(YankyPutIndentBeforeShiftRight)")
|
||||
vim.keymap.set("n", "<P", "<Plug>(YankyPutIndentBeforeShiftLeft)")
|
||||
vim.keymap.set("n", "=p", "<Plug>(YankyPutAfterFilter)")
|
||||
vim.keymap.set("n", "=P", "<Plug>(YankyPutBeforeFilter)")
|
||||
vim.keymap.set("x", "p", "<Plug>(YankyPutAfter)")
|
||||
vim.keymap.set("x", "P", "<Plug>(YankyPutBefore)")
|
||||
vim.keymap.set("x", "gp", "<Plug>(YankyGPutAfter)")
|
||||
return vim.keymap.set("x", "gP", "<Plug>(YankyGPutBefore)")
|
||||
@@ -0,0 +1,2 @@
|
||||
-- [nfnl] fnl/dotfiles/plugins.fnl
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
-- [nfnl] fnl/dotfiles/terraform-helpers.fnl
|
||||
local function append_to_buf(bufno, lines)
|
||||
if lines then
|
||||
return vim.aip.nvim_buf_set_lines(bufno, -1, -1, false, lines)
|
||||
else
|
||||
return nil
|
||||
end
|
||||
end
|
||||
local tf_log_bufno = nil
|
||||
return nil
|
||||
@@ -0,0 +1,17 @@
|
||||
-- [nfnl] fnl/dotfiles/ts-utils.fnl
|
||||
local core = require("nfnl.core")
|
||||
local function root(bufnr, lang)
|
||||
local parser = vim.treesitter.get_parser(bufnr, lang, {})
|
||||
local tree = core.first(parser:parse())
|
||||
return tree:root()
|
||||
end
|
||||
local function make_query(lang, query_string)
|
||||
local query = vim.treesitter.query.parse(lang, "(headline (stars) @stars)")
|
||||
local function _1_(bufnr)
|
||||
local root_node = root(bufnr, lang)
|
||||
local iter_captures = query.iter_captures(query, root_node, bufnr, 0, -1)
|
||||
return iter_captures
|
||||
end
|
||||
return _1_
|
||||
end
|
||||
return {root = root, ["make-query"] = make_query}
|
||||
@@ -0,0 +1,44 @@
|
||||
-- [nfnl] fnl/dotfiles/util.fnl
|
||||
local a = require("nfnl.core")
|
||||
local function fn_3f(x)
|
||||
return ("function" == type(x))
|
||||
end
|
||||
local function noremap(mode, from, to, opts)
|
||||
local local_3f = a.get(opts, "local?")
|
||||
local opts0 = a.assoc(opts, "local?", nil)
|
||||
local map_opts = a.merge(opts0, {noremap = true, silent = true})
|
||||
local to0
|
||||
if fn_3f(to) then
|
||||
to0 = to
|
||||
else
|
||||
to0 = (":" .. to .. "<cr>")
|
||||
end
|
||||
local buff_num = a.get(opts0, "buff-num")
|
||||
if (local_3f or buff_num) then
|
||||
return vim.keymap.set(mode, from, to0, a.merge(map_opts, {buffer = (buff_num or 0)}))
|
||||
else
|
||||
return vim.keymap.set(mode, from, to0, map_opts)
|
||||
end
|
||||
end
|
||||
local function nnoremap(from, to, opts)
|
||||
return noremap("n", from, to, opts)
|
||||
end
|
||||
local function tnoremap(from, to, opts)
|
||||
return noremap("t", from, to, opts)
|
||||
end
|
||||
local function inoremap(from, to, opts)
|
||||
return noremap("i", from, to, opts)
|
||||
end
|
||||
local function vnoremap(from, to, opts)
|
||||
return noremap("v", from, to, opts)
|
||||
end
|
||||
local function lnnoremap(from, to, opts)
|
||||
return nnoremap(("<leader>" .. from), to, opts)
|
||||
end
|
||||
local function ltnoremap(from, to, opts)
|
||||
return noremap("v", ("<leader>" .. from), to, opts)
|
||||
end
|
||||
local function lvnoremap(from, to, opts)
|
||||
return noremap("t", ("<leader>" .. from), to, opts)
|
||||
end
|
||||
return {noremap = noremap, nnoremap = nnoremap, tnoremap = tnoremap, inoremap = inoremap, vnoremap = vnoremap, lnnoremap = lnnoremap, ltnoremap = ltnoremap, lvnoremap = lvnoremap}
|
||||
@@ -0,0 +1,17 @@
|
||||
-- [nfnl] fnl/dotfiles/zoom-toggle.fnl
|
||||
local u = require("dotfiles.util")
|
||||
local unzoom_21 = nil
|
||||
local function zoom_toggle()
|
||||
if unzoom_21 then
|
||||
vim.cmd(unzoom_21)
|
||||
unzoom_21 = nil
|
||||
return nil
|
||||
else
|
||||
unzoom_21 = vim.fn.winrestcmd()
|
||||
vim.cmd.resize()
|
||||
return vim.cmd.resize({mods = {vertical = true}})
|
||||
end
|
||||
end
|
||||
vim.api.nvim_create_user_command("ZoomToggle", zoom_toggle, {})
|
||||
local wk = require("which-key")
|
||||
return wk.add({{{"<M-z>", zoom_toggle, desc = "Toggle zoom of buffer window"}}, {{"<M-z>", zoom_toggle, desc = "Toggle zoom of buffer window", mode = {"n", "t"}}}})
|
||||
Loaded 100 of 127 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user