this repo has no description
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Group configs using `do`

+183 -187
+1 -1
vim/.config/nvim/fnl/nvim/init.fnl
··· 39 39 40 40 (local api (setmetatable {} 41 41 {:__index (fn [_ key] 42 - (let [func (.. "nvim_" key)] 42 + (let [func (.. "nvim_" (key:gsub "-" "_"))] 43 43 (. vim.api func)))})) 44 44 45 45 (local ex (setmetatable {}
+182 -186
vim/.config/nvim/init.fnl
··· 14 14 15 15 (require :plugins) 16 16 17 - ; Colors 18 - (ex.colorscheme :blame) 19 - 20 17 (set opts.shell "fish") 21 18 22 - ; MatchIt must be unloaded for MatchPair to work correctly 23 - (set vim.g.loaded_matchit true) 24 - (set vim.g.matchup_surround_enabled true) 19 + (do ; MatchIt must be unloaded for MatchPair to work correctly 20 + (set vim.g.loaded_matchit true) 21 + (set vim.g.matchup_surround_enabled true)) 25 22 26 23 (set vim.g.choosewin_label "QWERTYUIOP") 27 24 28 - ; Colors 29 - (opts {:termguicolors true 30 - :guicursor ["n-v-c-sm:block-Cursor" "i-ci-ve:ver25-Cursor" "r-cr-o:hor20-Cursor"]}) 25 + (do ; Colors 26 + (ex.colorscheme :blame) 27 + (opts {:termguicolors true 28 + :guicursor ["n-v-c-sm:block-Cursor" "i-ci-ve:ver25-Cursor" "r-cr-o:hor20-Cursor"]})) 31 29 32 - ; Indentation 33 - (opts {:shiftwidth 2 34 - :expandtab true 35 - :textwidth 80 36 - :wrap false 37 - :linebreak true 38 - :formatoptions "tcqjl"}) 30 + (do ; Indentation 31 + (opts {:shiftwidth 2 32 + :expandtab true 33 + :textwidth 80 34 + :wrap false 35 + :linebreak true 36 + :formatoptions "tcqjl"})) 39 37 40 - ; UI 41 - (opts {:lazyredraw true 42 - :updatetime 500 43 - :title true}) 38 + (do ; UI 39 + (opts {:lazyredraw true 40 + :updatetime 500 41 + :title true 42 + :showmode true})) 44 43 45 - ; Display tabs and trailing spaces visually 46 - (opts {:fillchars ["vert:┃" "fold:·"] 47 - :list true 48 - :listchars ["tab:→ " "trail:·" "nbsp:␣" "extends:↦" "precedes:↤"] 49 - :conceallevel 2}) 44 + (do ; Display tabs and trailing spaces visually 45 + (opts {:fillchars ["vert:┃" "fold:·"] 46 + :list true 47 + :listchars ["tab:→ " "trail:·" "nbsp:␣" "extends:↦" "precedes:↤"] 48 + :conceallevel 2})) 50 49 51 - ; Ignore case. If your code uses different casing to differentiate files, then 52 - ; you need mental help 53 - (opts {:wildignorecase true 54 - :wildmode :full 55 - :fileignorecase true 56 - :wildignore ["*.o" 57 - "*~" 58 - "**/.git/**" 59 - "**/tmp/**" 60 - "**/node_modules/**" 61 - "**/_build/**" 62 - "**/deps/**" 63 - "**/target/**" 64 - "**/uploads/**" 65 - "*.lock"]}) 50 + (do ; Ignore case. 51 + ; If your code uses different casing to differentiate files, then you need 52 + ; mental help 53 + (opts {:wildignorecase true 54 + :wildmode :full 55 + :fileignorecase true 56 + :wildignore ["*.o" 57 + "*~" 58 + "**/.git/**" 59 + "**/tmp/**" 60 + "**/node_modules/**" 61 + "**/_build/**" 62 + "**/deps/**" 63 + "**/target/**" 64 + "**/uploads/**" 65 + "*.lock"]})) 66 66 67 67 (opts {:diffopt+ ["indent-heuristic" "algorithm:patience"] 68 68 :tags^ ["./**/tags"] 69 69 :iskeyword+ ["-"]}) 70 70 71 - (set opts.showmode false) 72 - 73 - ; Autowrite file whenever possible 74 - (opts {:hidden false 75 - :autowriteall true}) 76 - 77 - ; Keep cursor in the middle 78 - (let [value 9999] 79 - (set opts.scrolloff value) 80 - (augroup terminal-scrolloff 81 - (on BufEnter "term://*" (set opts.window.scrolloff 0)) 82 - (on BufLeave "term://*" (set opts.window.scrolloff value)))) 71 + (do ; Autowrite file whenever possible 72 + (opts {:hidden false 73 + :autowriteall true})) 83 74 84 - ; XXI century - we have cursors now 85 - (set opts.mouse :a) 75 + (do ; Keep cursor in the middle 76 + (let [value 9999] 77 + (set opts.scrolloff value) 78 + (augroup terminal-scrolloff 79 + (on BufEnter "term://*" (set opts.window.scrolloff 0)) 80 + (on BufLeave "term://*" (set opts.window.scrolloff value))))) 86 81 87 - ; Split in CORRECT places 88 - (opts {:splitright true 89 - :splitbelow true}) 82 + (do ; XXI century - we have cursors now 83 + (set opts.mouse :a)) 90 84 91 - ; Searching 92 - (opts {:ignorecase true 93 - :smartcase true 94 - :inccommand :nosplit}) 95 - 96 - ; Permanent undo 97 - (set opts.undofile true) 85 + (do ; Split in CORRECT places 86 + (opts {:splitright true 87 + :splitbelow true})) 98 88 99 - ; Save only meaningfull data to sessions 100 - (set opts.sessionoptions [:blank :buffers :curdir :folds :tabpages :winsize :terminal]) 89 + (do ; Searching 90 + (opts {:ignorecase true 91 + :smartcase true 92 + :inccommand :nosplit})) 101 93 102 - ; Folding 103 - (opts {:foldmethod :expr 104 - :foldexpr "nvim_treesitter#foldexpr()" 105 - :foldlevel 999}) 106 - (map :n :<CR> "foldlevel(\".\") ? \"za\" : \"\\<CR>\"" {:expr true}) 94 + (do ; Permanent undo 95 + (set opts.undofile true)) 107 96 108 - ; Completion 109 - (opts {:complete [:. :w :b :t :k :kspell] 110 - :completeopt [:menuone :noselect :noinsert]}) 97 + (do ; Save only meaningfull data to sessions 98 + (set opts.sessionoptions [:blank :buffers :curdir :folds :tabpages :winsize :terminal])) 111 99 112 - ; Clap 113 - (map :n :<Space><Space> 114 - #(picker.find_files)) 100 + (do ; Folding 101 + (opts {:foldmethod :expr 102 + :foldexpr "nvim_treesitter#foldexpr()" 103 + :foldlevel 999}) 104 + (map :n :<CR> "foldlevel(\".\") ? \"za\" : \"\\<CR>\"" {:expr true})) 115 105 116 - ; Frequently used unimpaired mappings 117 - (let [unimpaired (fn [char left right] 118 - (map :n (.. "[" char) left) 119 - (map :n (.. "]" char) right))] 120 - (unimpaired :w "gT" "gt") 121 - (unimpaired :q ":cprev" ":cnext") 122 - (unimpaired :Q ":cpfile" ":cnfile") 123 - (unimpaired :l ":lprev" ":lnext") 124 - (unimpaired :L ":lpfile" ":lnfile")) 106 + (do ; Completion 107 + (opts {:complete [:. :w :b :t :k :kspell] 108 + :completeopt [:menuone :noselect :noinsert]})) 125 109 126 - ; Additional "Close" commands 127 - (map :n :ZS ":wa") 128 - (map :n :ZA ":qa") 129 - (map :n :ZX ":cq") 110 + (do ; Clap 111 + (map :n :<Space><Space> 112 + #(picker.find_files))) 130 113 131 - ; Swap ; and : for easier command line mode 132 - (let [swap (fn [a b] (map :nx a b) (map :nx b a))] 133 - (swap ";" ":") 134 - (map :n "q;" "q:")) 114 + (do ; Frequently used unimpaired mappings 115 + (let [unimpaired (fn [char left right] 116 + (map :n (.. "[" char) left) 117 + (map :n (.. "]" char) right))] 118 + (unimpaired :w "gT" "gt") 119 + (unimpaired :q ":cprev" ":cnext") 120 + (unimpaired :Q ":cpfile" ":cnfile") 121 + (unimpaired :l ":lprev" ":lnext") 122 + (unimpaired :L ":lpfile" ":lnfile"))) 135 123 136 - ; Expand abbreviation when hitted <CR> 137 - (map :i :<CR> "<C-]><CR>") 124 + (do ; Additional "Close" commands 125 + (map :n :ZS ":wa") 126 + (map :n :ZA ":qa") 127 + (map :n :ZX ":cq")) 138 128 139 - ; Make Vim behaviour consistent 140 - (map :n :Y :y$) 129 + (do ; Swap ; and : for easier command line mode 130 + (let [swap (fn [a b] (map :nx a b) (map :nx b a))] 131 + (swap ";" ":") 132 + (map :n "q;" "q:"))) 141 133 142 - ; Code formatting 143 - (map :n :g= "=aGg``") 144 - (map :nx :Q "gq") 145 - (map :n :gQ "gqaG``") 134 + (do ; Expand abbreviation when hitted <CR> 135 + (map :i :<CR> "<C-]><CR>")) 146 136 147 - ; Smart `0` 148 - ; Goes to the beginning of the text at first and later goes to the beginning of 149 - ; the line, alternates afterwards 150 - (map :n :0 "virtcol('.') - 1 <= indent('.') && col('.') > 1 ? '0' : '_'" {:expr true}) 137 + (do ; Make Vim behaviour consistent 138 + (map :n :Y :y$)) 151 139 152 - (map :n :gK ":Dash") 153 - (map :n :gq (fn [] 154 - (let [name (func.expand "<cfile>")] 155 - (func.jobstart ["open" name] {:detach true}) 156 - (print "Open" name)))) 140 + (do ; Code formatting 141 + (map :n :g= "=aGg``") 142 + (map :nx :Q "gq") 143 + (map :n :gQ "gqaG``")) 157 144 158 - ; Text object for whole file 159 - (map :o :aG ":normal! ggVG") 145 + (do ; Smart `0` 146 + ; Goes to the beginning of the text at first and later goes to the beginning of 147 + ; the line, alternates afterwards 148 + (map :n :0 "virtcol('.') - 1 <= indent('.') && col('.') > 1 ? '0' : '_'" {:expr true})) 160 149 161 - ; Quickly disable highligh 162 - (map :n "<Space>," ":nohlsearch") 150 + (do ; Help viewing and opening URLs 151 + (map :n :gK ":Dash") 152 + (map :n :gq (fn [] 153 + (let [name (func.expand "<cfile>")] 154 + (func.jobstart ["open" name] {:detach true}) 155 + (print "Open" name))))) 163 156 164 - ; Terminal mappings 165 - (map :n "<C-q>" "<Nop>") 166 - (map :n "<C-q>c" ":term") 167 - (map :n "<C-q>s" ":split +term") 168 - (map :n "<C-q>v" ":vsplit +term") 169 - (map :n "<C-q>t" ":tabnew +term") 157 + (do ; Text object for whole file 158 + (map :o :aG ":normal! ggVG")) 170 159 171 - (map :t "<C-q>" "<C-\\><C-n>") 172 - (map :i "<C-q>" "<ESC>") 173 - (map :n "<C-q>" "<ESC>") 160 + (do ; Quickly disable highligh 161 + (map :n "<Space>," ":nohlsearch")) 174 162 175 - (when (executable? "nvr") 176 - (set vim.env.EDITOR "nvr -cc split -c 'set bufhidden=delete' --remote-wait")) 163 + (do ; Terminal mappings 164 + (map :n "<C-q>" "<Nop>") 165 + (map :n "<C-q>c" ":term") 166 + (map :n "<C-q>s" ":split +term") 167 + (map :n "<C-q>v" ":vsplit +term") 168 + (map :n "<C-q>t" ":tabnew +term") 177 169 178 - ; Git mappings 179 - (let [leader "U" 180 - git-map (fn [lhs cmd] (map :n (.. leader lhs) (.. ":Git " cmd)))] 181 - (map :n leader "<nop>") 182 - (map :n (.. leader leader) (.. leader :u) {:noremap false}) 183 - (git-map :p "push") 184 - (git-map :s "") 185 - (git-map :d "diff") 186 - (git-map :B "blame") 187 - (git-map :c "commit") 188 - (git-map :u "pull") 189 - (git-map :g "log")) 170 + (map :t "<C-q>" "<C-\\><C-n>") 171 + (map :i "<C-q>" "<ESC>") 172 + (map :n "<C-q>" "<ESC>") 190 173 191 - ; Split management 192 - (map :n "<C-w><C-w>" "<plug>(choosewin)" {:noremap false}) 193 - (map :n "<C-_>" "<plug>(choosewin)" {:noremap false}) 174 + (when (executable? "nvr") 175 + (set vim.env.EDITOR "nvr -cc split -c 'set bufhidden=delete' --remote-wait"))) 194 176 195 - ; Search 196 - (when (executable? "rg") 197 - (opts {:grepprg "rg --vimgrep --no-heading --smart-case" 198 - :grepformat "%f:%l:%c:%m,%f:%l%m,%f %l%m"})) 177 + (do ; Git mappings 178 + (let [leader "U" 179 + git-map (fn [lhs cmd] (map :n (.. leader lhs) (.. ":Git " cmd)))] 180 + (map :n leader "<nop>") 181 + (map :n (.. leader leader) (.. leader :u) {:noremap false}) 182 + (git-map :p "push") 183 + (git-map :s "") 184 + (git-map :d "diff") 185 + (git-map :B "blame") 186 + (git-map :c "commit") 187 + (git-map :u "pull") 188 + (git-map :g "log"))) 199 189 200 - ; Matchparen 201 - (set vim.g.matchup_matchparen_offscreen {:method :popup}) 190 + (do ; Split management 191 + (map :n "<C-w><C-w>" "<plug>(choosewin)" {:noremap false}) 192 + (map :n "<C-_>" "<plug>(choosewin)" {:noremap false})) 202 193 203 - (augroup matchparen 204 - (let [term "term://*"] 205 - (on BufEnter term (ex.NoMatchParen)) 206 - (on BufLeave term (ex.DoMatchParen)))) 194 + (do ; Search 195 + (when (executable? "rg") 196 + (opts {:grepprg "rg --vimgrep --no-heading --smart-case" 197 + :grepformat "%f:%l:%c:%m,%f:%l%m,%f %l%m"}))) 207 198 208 - ; Autoreload Direnv after writing the .envrc 209 - (when (executable? "direnv") 210 - (augroup autoreload-envrc 211 - (on BufWritePost ".envrc" (ex.silent "!direnv allow %")))) 199 + (do ; Matchparen 200 + (set vim.g.matchup_matchparen_offscreen {:method :popup}) 201 + (augroup matchparen 202 + (let [term "term://*"] 203 + (on BufEnter term (ex.NoMatchParen)) 204 + (on BufLeave term (ex.DoMatchParen))))) 212 205 213 - ; Setup Lua extensions 214 - (let [setup (fn [package object] ((. (require package) :setup) object))] 215 - (setup :startify 216 - {:lists [{:type "sessions" :header [" Sessions"]} 217 - {:type "commands" :header [" Wiki"]}] 218 - :session-dir "~/.local/share/nvim/site/sessions/" 219 - :session-autoload true 220 - :session-persistence true 221 - :change-to-dir false 222 - :change-to-vcs-root true 223 - :fortune-use-unicode true}) 224 - (setup :nvim-treesitter.configs 225 - {:highlight {:enable true} 226 - :matchup {:enable true} 227 - :indent {:enable true}}) 228 - (setup :fidget {}) 229 - ; (setup :orgmode {}) 230 - ) 206 + (do ; Autoreload Direnv after writing the .envrc 207 + (when (executable? "direnv") 208 + (augroup autoreload-envrc 209 + (on BufWritePost ".envrc" (ex.silent "!direnv allow %"))))) 231 210 232 - (: (require :presence) :setup 233 - {:auto_update true 234 - :buttons false 235 - :blacklist ["Workspace/forte"]}) 211 + (do ; Setup Lua extensions 212 + (let [setup (fn [package object] ((. (require package) :setup) object))] 213 + (setup :startify 214 + {:lists [{:type "sessions" :header [" Sessions"]} 215 + {:type "commands" :header [" Wiki"]}] 216 + :session-dir "~/.local/share/nvim/site/sessions/" 217 + :session-autoload true 218 + :session-persistence true 219 + :change-to-dir false 220 + :change-to-vcs-root true 221 + :fortune-use-unicode true}) 222 + (setup :nvim-treesitter.configs 223 + {:highlight {:enable true} 224 + :matchup {:enable true} 225 + :indent {:enable true}}) 226 + (setup :fidget {})) 227 + ; Presence requires to call `:setup` instead of `.setup 228 + (: (require :presence) :setup 229 + {:auto_update true 230 + :buttons false 231 + :blacklist ["Workspace/forte"]})) 236 232 237 233 (defcommand Bd "b#|bd#") 238 234 (defcommand BClean 239 235 (->> (func.getbufinfo {:buflisted true}) 240 236 (vim.tbl_filter #(= (next $1.windows) nil)) 241 237 (#(each [_ v (ipairs $1)] 242 - (api.buf_delete v.bufnr {}))))) 238 + (api.buf-delete v.bufnr {}))))) 243 239 (defcommand Clean "keeppatterns %s/\\s\\+$//e | set nohlsearch") 244 240 245 - ; Async Make and Grep 246 - (let [run (fn [args f-args] 247 - (api.call_function :asyncdo#run (vim.list_extend args f-args)))] 248 - (defcommand Make {:bang true :nargs :* :complete :file} 249 - (run [bang opts.makeprg] f-args)) 250 - (defcommand Grep {:bang true :nargs :+ :complete :dir} 251 - (run [bang {:job opts.grepprg :errorformat opts.grepformat}] f-args))) 241 + (do ; Async Make and Grep 242 + (let [run (fn [args f-args] 243 + (api.call-function :asyncdo#run (vim.list_extend args f-args)))] 244 + (defcommand Make {:bang true :nargs :* :complete :file} 245 + (run [bang opts.makeprg] f-args)) 246 + (defcommand Grep {:bang true :nargs :+ :complete :dir} 247 + (run [bang {:job opts.grepprg :errorformat opts.grepformat}] f-args)))) 252 248 253 249 (defcommand Ctags 254 250 (ex.AsyncDo "ctags -R .")) ··· 260 256 (defcommand Dash {:nargs :?} 261 257 (func.dash#open q-args)) 262 258 263 - (do 259 + (do ; Setup vim-sandwitch 264 260 (ex.packadd! :vim-sandwich) 265 261 (ex.runtime "macros/sandwich/keymap/surround.vim")) 266 262