this repo has no description
1
fork

Configure Feed

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

Format Fennel code

+304 -255
+1
flake.nix
··· 29 29 30 30 devShells.default = pkgs.mkShell { 31 31 nativeBuildInputs = [ 32 + pkgs.fnlfmt 32 33 pkgs.alejandra 33 34 # TODO: Remove it and manage all configuration from Nix 34 35 pkgs.stow
+11 -14
vim/.config/nvim/fnl/langclient.fnl
··· 8 8 9 9 (fn on_attach [client] 10 10 (logger.inspect client) 11 - (local capable? (fn [capability] 12 - (. client.server_capabilities capability))) 13 - (augroup lsp-diagnostics 14 - (on CursorHold :* (vim.diagnostic.open_float nil))) 11 + (local capable? 12 + (fn [capability] 13 + (. client.server_capabilities capability))) 14 + (augroup lsp-diagnostics (on CursorHold "*" (vim.diagnostic.open_float nil))) 15 15 (when (capable? :hoverProvider) 16 16 (bmap :n :K #(vim.lsp.buf.hover))) 17 17 (when (capable? :declarationProvider) ··· 28 28 (set opts.buffer.omnifunc "v:lua.vim.lsp.omnifunc"))) 29 29 30 30 (set lspconfig.util.default_config 31 - (vim.tbl_extend :force lspconfig.util.default_config 32 - {:autostart false 33 - : on_attach})) 31 + (vim.tbl_extend :force lspconfig.util.default_config 32 + {:autostart false : on_attach})) 34 33 35 - (vim.diagnostic.config 36 - {:virtual_text false}) 34 + (vim.diagnostic.config {:virtual_text false}) 37 35 38 36 (lspconfig.rust_analyzer.setup {:settings {:trace {:server :verbose}}}) 39 37 40 - (lspconfig.elixirls.setup {:cmd ["elixir-ls"] 41 - :settings {:elixirLS {:dialyzerEnabled false}}}) 38 + (lspconfig.elixirls.setup {:cmd [:elixir-ls] 39 + :settings {:elixirLS {:dialyzerEnabled false}}}) 42 40 43 - (lspconfig.erlangls.setup {:cmd ["erlang_ls"]}) 41 + (lspconfig.erlangls.setup {:cmd [:erlang_ls]}) 44 42 45 - (augroup lsp-direnv 46 - (on User :DirenvLoaded (command "LspStart"))) 43 + (augroup lsp-direnv (on User :DirenvLoaded (command :LspStart)))
+49 -37
vim/.config/nvim/fnl/nvim/init.fnl
··· 4 4 5 5 (fn filter [t cb] 6 6 (collect [k v (pairs t)] 7 - (when (cb k v) (values k v)))) 7 + (when (cb k v) 8 + (values k v)))) 8 9 9 10 (fn try [value test cb] 10 11 (if (test value) (cb value) value)) 11 12 12 13 (fn normalise-map [rhs opts] 13 14 (if (= (type rhs) :string) 14 - (if (and (vim.startswith rhs ":") (not= rhs ":")) 15 - (-> rhs 16 - (try #(not (. opts :selection)) 17 - #(.. "<cmd>" (: $1 :sub 2))) 18 - (try #(and (not (vim.endswith (: $1 :lower) "<cr>")) (. opts :cr)) 19 - #(.. $1 "<cr>"))) 20 - rhs) 21 - (.. "<cmd>lua " (make-func rhs) "()<CR>"))) 15 + (if (and (vim.startswith rhs ":") (not= rhs ":")) 16 + (-> rhs 17 + (try #(not (. opts :selection)) #(.. :<cmd> (: $1 :sub 2))) 18 + (try #(and (not (vim.endswith (: $1 :lower) :<cr>)) (. opts :cr)) 19 + #(.. $1 :<cr>))) 20 + rhs) 21 + (.. "<cmd>lua " (make-func rhs) "()<CR>"))) 22 22 23 23 (fn plug-map? [rhs] 24 - (and (= (type rhs) :string) 25 - (vim.startswith (rhs:lower) "<plug>"))) 24 + (and (= (type rhs) :string) (vim.startswith (rhs:lower) :<plug>))) 26 25 27 26 (fn make-map [cb] 28 27 (lambda [modes lhs rhs ?opts] 29 - (let [options (vim.tbl_extend :force {:noremap (not (plug-map? rhs)) 30 - :selection false 31 - :cr true} 28 + (let [options (vim.tbl_extend :force 29 + {:noremap (not (plug-map? rhs)) 30 + :selection false 31 + :cr true} 32 32 (or ?opts {})) 33 33 map-opts (filter options #(not (or (= $1 :selection) (= $1 :cr)))) 34 34 normalised-rhs (normalise-map rhs options)] 35 - (when (= modes "") (error "At least one mode must be specified")) 35 + (when (= modes "") 36 + (error "At least one mode must be specified")) 36 37 (each [mode (modes:gmatch ".")] 37 38 (cb mode lhs normalised-rhs map-opts))))) 38 39 39 - 40 40 (local api (setmetatable {} 41 41 {:__index (fn [_ key] 42 - (let [func (.. "nvim_" (key:gsub "-" "_"))] 42 + (let [func (.. :nvim_ (key:gsub "-" "_"))] 43 43 (. vim.api func)))})) 44 44 45 - (local ex (setmetatable {} 46 - {:__index (fn [_ key] 47 - (fn [...] 48 - (api.command (.. key " " (table.concat [...] " ")))))})) 45 + (local ex 46 + (setmetatable {} 47 + {:__index (fn [_ key] 48 + (fn [...] 49 + (api.command (.. key " " 50 + (table.concat [...] " ")))))})) 49 51 50 - (local func (setmetatable {} 51 - {:__index (fn [_ key] 52 - (fn [...] (api.call_function key [...])))})) 52 + (local func 53 + (setmetatable {} 54 + {:__index (fn [_ key] 55 + (fn [...] 56 + (api.call_function key [...])))})) 53 57 54 - (local opts (setmetatable {} 55 - {:__newindex (fn [_ key val] 56 - (print (fennel.view {: key : val})))})) 58 + (local opts 59 + (setmetatable {} 60 + {:__newindex (fn [_ key val] 61 + (print (fennel.view {: key : val})))})) 57 62 58 - (fn ?> [f ...] (let [(ok? val) (f)] (if (and ok? (not= val "")) val (?> ...)))) 63 + (fn ?> [f ...] 64 + (let [(ok? val) (f)] 65 + (if (and ok? (not= val "")) val (?> ...)))) 59 66 60 67 (fn set-opt [scope key value] 61 68 (let [len (length key) 62 69 opt (if (key:match "[-+^!]$") (key:sub 1 (- len 1)) key) 63 - l (lambda [] (vim.split (. scope opt) ",")) 70 + l (lambda [] 71 + (vim.split (. scope opt) ",")) 64 72 val (match (key:sub len) 65 - :- (assert false "not-implemented") 66 - :^ (vim.list_extend value (l)) 67 - :+ (vim.list_extend (l) value) 73 + "-" (assert false :not-implemented) 74 + "^" (vim.list_extend value (l)) 75 + "+" (vim.list_extend (l) value) 68 76 _ value)] 69 77 (tset scope opt (maybe-join val)))) 70 78 71 79 (fn build-opts [table scope] 72 80 (setmetatable table 73 81 {:__index scope 74 - :__newindex (fn [_ key val] (set-opt scope key val)) 75 - :__call (fn [table opts] 76 - (each [key value (pairs opts)] 77 - (set-opt scope key value)))})) 82 + :__newindex (fn [_ key val] 83 + (set-opt scope key val)) 84 + :__call (fn [table opts] 85 + (each [key value (pairs opts)] 86 + (set-opt scope key value)))})) 78 87 79 88 ; TODO: Allow setting buffer and window local options 89 + 80 90 (local opts (build-opts {:global (build-opts {} vim.go) 81 91 :window (build-opts {} vim.wo) 82 - :buffer (build-opts {} vim.bo)} vim.o)) 92 + :buffer (build-opts {} vim.bo)} 93 + vim.o)) 83 94 84 95 (fn executable? [name] 85 96 (func.executable name)) 86 97 87 98 ;; Exports 99 + 88 100 (setmetatable {:map (make-map api.set_keymap) 89 101 :buf-map (make-map #(api.buf_set_keymap 0 $...)) 90 102 : api
+2 -1
vim/.config/nvim/fnl/nvim/logger.fnl
··· 1 1 (fn inspect [data] 2 2 `(let [v# ,data] 3 - (when vim.g.debug (print (vim.inspect v#))) 3 + (when vim.g.debug 4 + (print (vim.inspect v#))) 4 5 v#)) 5 6 6 7 {: inspect}
+21 -20
vim/.config/nvim/fnl/nvim/macro-init.fnl
··· 2 2 3 3 (fn on [event pattern ...] 4 4 "Run command on `event`" 5 - (let [body (if (list? ...) `(fn [] ,...) ...)] 5 + (let [body (if (list? ...) `(fn [] 6 + ,...) ...)] 6 7 `(vim.api.nvim_create_autocmd ,(view event) 7 8 {:pattern ,pattern 8 - :callback ,body 9 - :group au-id}))) 9 + :callback ,body 10 + :group au-id}))) 10 11 11 12 (fn augroup [name ...] 12 13 "Define auto group" 13 - `(let [,(sym "au-id") (vim.api.nvim_create_augroup ,(view name) {:clear true})] 14 - (import-macros {: on} :nvim) 15 - ,... 16 - au-id)) 14 + `(let [,(sym :au-id) (vim.api.nvim_create_augroup ,(view name) {:clear true})] 15 + (import-macros {: on} :nvim) 16 + ,... 17 + au-id)) 17 18 18 19 (fn command-func [body] 19 - (let [q-args (sym "q-args") 20 - f-args (sym "f-args") 21 - bang (sym "bang") 22 - lines (sym "lines") 23 - count (sym "count") 24 - reg (sym "reg") 25 - mods (sym "mods") 26 - smods (sym "smods")] 20 + (let [q-args (sym :q-args) 21 + f-args (sym :f-args) 22 + bang (sym :bang) 23 + lines (sym :lines) 24 + count (sym :count) 25 + reg (sym :reg) 26 + mods (sym :mods) 27 + smods (sym :smods)] 27 28 `(lambda [arg#] 28 29 (let [{:args ,q-args 29 30 :fargs ,f-args ··· 35 36 :reg ,reg 36 37 :mods ,mods 37 38 :smods ,smods} arg# 38 - ,lines {:from line1# :to line2# :range range#}] 39 + ,lines {:from line1# :to line2# :range range#}] 39 40 ,body)))) 40 41 41 42 (fn defcommand [name opts ...] 42 - (assert-compile (string.match (view name) "^%u%w*$") "User defined command must start with uppercase letter" name) 43 + (assert-compile (string.match (view name) "^%u%w*$") 44 + "User defined command must start with uppercase letter" name) 43 45 (let [(body opts) (if (= ... nil) (values opts {}) (values ... opts)) 44 46 body (if (list? body) (command-func body) body)] 45 47 `(vim.api.nvim_create_user_command ,(view name) ,body ,opts))) 46 48 47 49 ;; Exports 48 - {: augroup 49 - : defcommand 50 - : on} 50 + 51 + {: augroup : defcommand : on}
+1 -2
vim/.config/nvim/fnl/nvim/utils.fnl
··· 10 10 (tset __nvim_functions__ idx func) 11 11 (.. "__nvim_functions__[" idx "]"))) 12 12 13 - {: maybe-join 14 - : make-func} 13 + {: maybe-join : make-func}
+15 -9
vim/.config/nvim/fnl/picker.fnl
··· 3 3 (use telescope) 4 4 (use telescope.themes) 5 5 6 - (let [opts {:vimgrep_arguments ["rg" 7 - "--vimgrep" 8 - "--smart-case" 9 - "--hidden" 10 - "--glob=!.git"]}] 11 - (telescope.setup 12 - {:defaults (themes.get_dropdown opts)})) 6 + (let [opts {:vimgrep_arguments [:rg 7 + :--vimgrep 8 + :--smart-case 9 + :--hidden 10 + :--glob=!.git]}] 11 + (telescope.setup {:defaults (themes.get_dropdown opts)})) 12 + 13 13 (telescope.load_extension :fzy_native) 14 14 15 15 (fn finder [name] 16 16 (. (require :telescope.builtin) name)) 17 17 18 18 (fn find_files [opts] 19 - (let [defaults {:find_command ["rg" "--hidden" "--ignore" "--files" "--glob=!.git" "--glob=!*.lock"] 19 + (let [defaults {:find_command [:rg 20 + :--hidden 21 + :--ignore 22 + :--files 23 + :--glob=!.git 24 + :--glob=!*.lock] 20 25 :previewer false} 21 26 options (vim.tbl_extend :force defaults (or opts {}))] 22 27 ((finder :find_files) options))) 23 28 24 29 (setmetatable {: find_files} 25 - {:__index (fn [_ key] (finder key))}) 30 + {:__index (fn [_ key] 31 + (finder key))})
+15 -12
vim/.config/nvim/fnl/plugins.fnl
··· 3 3 (use packer) 4 4 5 5 (fn config [cb] 6 - (packer.startup 7 - (fn [-pkg -pkg-rocks] 8 - (let [super (fn [f] (fn [name ?opts] (f (vim.tbl_extend :keep {1 name} (or ?opts {}))))) 9 - pkg (super -pkg) 10 - pkg-rocks (super -pkg-rocks)] 11 - (cb pkg pkg-rocks))))) 6 + (packer.startup (fn [-pkg -pkg-rocks] 7 + (let [super (fn [f] 8 + (fn [name ?opts] 9 + (f (vim.tbl_extend :keep {1 name} 10 + (or ?opts {}))))) 11 + pkg (super -pkg) 12 + pkg-rocks (super -pkg-rocks)] 13 + (cb pkg pkg-rocks))))) 12 14 15 + ;; fnlfmt: skip 13 16 (config (fn [pkg pkg-rocks] 14 17 ; Color scheme 15 18 ; (pkg :hauleth/blame.vim) 19 + 16 20 ; Project navigation 17 21 (pkg :tpope/vim-projectionist) 18 22 (pkg :justinmk/vim-dirvish) ··· 35 39 (pkg :elixir-editors/vim-elixir) 36 40 ;(pkg :nvim-orgmode/orgmode) 37 41 38 - ; Tree Sitter 42 + ; Language Protocol 39 43 (pkg :neovim/nvim-lspconfig) 40 44 (pkg :nvim-treesitter/playground) 45 + (pkg :j-hui/fidget.nvim) 41 46 42 47 ; Code manipulation 43 48 (pkg :AndrewRadev/splitjoin.vim) ··· 65 70 (pkg :andymass/vim-matchup) 66 71 (pkg :direnv/direnv.vim) 67 72 (pkg :hauleth/vim-backscratch) 68 - (pkg :https://gitlab.com/hauleth/qfx.vim.git) 69 - (pkg :https://gitlab.com/hauleth/smart.vim.git) 73 + (pkg "https://gitlab.com/hauleth/qfx.vim.git") 74 + (pkg "https://gitlab.com/hauleth/smart.vim.git") 70 75 (pkg :sgur/vim-editorconfig) 71 76 (pkg :mbbill/undotree) 72 77 (pkg :tpope/vim-characterize) 73 78 (pkg :tpope/vim-dadbod) 74 79 (pkg :tpope/vim-repeat) 75 80 (pkg :tpope/vim-rsi) 76 - (pkg :andweeb/presence.nvim) 77 - (pkg :j-hui/fidget.nvim) 78 - )) 81 + (pkg :andweeb/presence.nvim)))
+1 -1
vim/.config/nvim/fnl/startify.fnl
··· 1 1 (fn setup [opts] 2 2 (each [k v (pairs opts)] 3 - (tset vim.g (.. "startify_" (k:gsub "-" "_")) v))) 3 + (tset vim.g (.. :startify_ (k:gsub "-" "_")) v))) 4 4 5 5 {: setup}
+188 -159
vim/.config/nvim/init.fnl
··· 1 1 (import-macros {: use} :relude) 2 2 3 - (use nvim { 4 - : map 5 - : command 6 - : executable? 7 - : func 8 - : api 9 - : opts 10 - : ex}) 3 + (use nvim {: map : command : executable? : func : api : opts : ex}) 4 + 11 5 (use picker) 12 - (import-macros {: augroup 13 - : defcommand} :nvim) 6 + (import-macros {: augroup : defcommand} :nvim) 14 7 15 8 (require :plugins) 16 9 17 - (set opts.shell "fish") 10 + (set opts.shell :fish) 18 11 19 - (do ; MatchIt must be unloaded for MatchPair to work correctly 12 + (do 13 + ; MatchIt must be unloaded for MatchPair to work correctly 20 14 (set vim.g.loaded_matchit true) 21 15 (set vim.g.matchup_surround_enabled true)) 22 16 23 - (set vim.g.choosewin_label "QWERTYUIOP") 17 + (set vim.g.choosewin_label :QWERTYUIOP) 24 18 25 - (do ; Colors 19 + (do 20 + ; Colors 26 21 (ex.colorscheme :blame) 27 22 (opts {:termguicolors true 28 - :guicursor ["n-v-c-sm:block-Cursor" "i-ci-ve:ver25-Cursor" "r-cr-o:hor20-Cursor"]})) 23 + :guicursor ["n-v-c-sm:block-Cursor" 24 + "i-ci-ve:ver25-Cursor" 25 + "r-cr-o:hor20-Cursor"]})) 29 26 30 - (do ; Indentation 27 + (do 28 + ; Indentation 31 29 (opts {:shiftwidth 2 32 - :expandtab true 33 - :textwidth 80 34 - :wrap false 35 - :linebreak true 36 - :formatoptions "tcqjl"})) 30 + :expandtab true 31 + :textwidth 80 32 + :wrap false 33 + :linebreak true 34 + :formatoptions :tcqjl})) 37 35 38 - (do ; UI 39 - (opts {:lazyredraw true 40 - :updatetime 500 41 - :title true 42 - :showmode true})) 36 + (do 37 + ; UI 38 + (opts {:lazyredraw true :updatetime 500 :title true :showmode true})) 43 39 44 - (do ; Display tabs and trailing spaces visually 40 + (do 41 + ; Display tabs and trailing spaces visually 45 42 (opts {:fillchars ["vert:┃" "fold:·"] 46 - :list true 47 - :listchars ["tab:→ " "trail:·" "nbsp:␣" "extends:↦" "precedes:↤"] 48 - :conceallevel 2})) 43 + :list true 44 + :listchars ["tab:→ " 45 + "trail:·" 46 + "nbsp:␣" 47 + "extends:↦" 48 + "precedes:↤"] 49 + :conceallevel 2})) 49 50 50 - (do ; Ignore case. 51 - ; If your code uses different casing to differentiate files, then you need 52 - ; mental help 51 + (do 52 + ; Ignore case. ; If your code uses different casing to differentiate files, then you need ; mental help 53 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"]})) 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 - (opts {:diffopt+ ["indent-heuristic" "algorithm:patience"] 68 - :tags^ ["./**/tags"] 69 - :iskeyword+ ["-"]}) 67 + (opts {:diffopt+ [:indent-heuristic "algorithm:patience"] 68 + :tags^ [:./**/tags] 69 + :iskeyword+ ["-"]}) 70 70 71 - (do ; Autowrite file whenever possible 72 - (opts {:hidden false 73 - :autowriteall true})) 71 + (do 72 + ; Autowrite file whenever possible 73 + (opts {:hidden false :autowriteall true})) 74 74 75 - (do ; Keep cursor in the middle 75 + (do 76 + ; Keep cursor in the middle 76 77 (let [value 9999] 77 78 (set opts.scrolloff value) 78 79 (augroup terminal-scrolloff 79 80 (on BufEnter "term://*" (set opts.window.scrolloff 0)) 80 81 (on BufLeave "term://*" (set opts.window.scrolloff value))))) 81 82 82 - (do ; XXI century - we have cursors now 83 + (do 84 + ; XXI century - we have cursors now 83 85 (set opts.mouse :a)) 84 86 85 - (do ; Split in CORRECT places 86 - (opts {:splitright true 87 - :splitbelow true})) 87 + (do 88 + ; Split in CORRECT places 89 + (opts {:splitright true :splitbelow true})) 88 90 89 - (do ; Searching 90 - (opts {:ignorecase true 91 - :smartcase true 92 - :inccommand :nosplit})) 91 + (do 92 + ; Searching 93 + (opts {:ignorecase true :smartcase true :inccommand :nosplit})) 93 94 94 - (do ; Permanent undo 95 + (do 96 + ; Permanent undo 95 97 (set opts.undofile true)) 96 98 97 - (do ; Save only meaningfull data to sessions 98 - (set opts.sessionoptions [:blank :buffers :curdir :folds :tabpages :winsize :terminal])) 99 + (do 100 + ; Save only meaningfull data to sessions 101 + (set opts.sessionoptions [:blank 102 + :buffers 103 + :curdir 104 + :folds 105 + :tabpages 106 + :winsize 107 + :terminal])) 99 108 100 - (do ; Folding 109 + (do 110 + ; Folding 101 111 (opts {:foldmethod :expr 102 - :foldexpr "nvim_treesitter#foldexpr()" 103 - :foldlevel 999}) 112 + :foldexpr "nvim_treesitter#foldexpr()" 113 + :foldlevel 999}) 104 114 (map :n :<CR> "foldlevel(\".\") ? \"za\" : \"\\<CR>\"" {:expr true})) 105 115 106 - (do ; Completion 107 - (opts {:complete [:. :w :b :t :k :kspell] 108 - :completeopt [:menuone :noselect :noinsert]})) 116 + (do 117 + ; Completion 118 + (opts {:complete ["." :w :b :t :k :kspell] 119 + :completeopt [:menuone :noselect :noinsert]})) 109 120 110 - (do ; Clap 111 - (map :n :<Space><Space> 112 - #(picker.find_files))) 121 + (do 122 + ; Clap 123 + (map :n :<Space><Space> #(picker.find_files))) 113 124 114 - (do ; Frequently used unimpaired mappings 125 + (do 126 + ; Frequently used unimpaired mappings 115 127 (let [unimpaired (fn [char left right] 116 128 (map :n (.. "[" char) left) 117 129 (map :n (.. "]" char) right))] 118 - (unimpaired :w "gT" "gt") 119 - (unimpaired :q ":cprev" ":cnext") 130 + (unimpaired :w :gT :gt) 131 + (unimpaired :q ":cprev" ":cnext") 120 132 (unimpaired :Q ":cpfile" ":cnfile") 121 - (unimpaired :l ":lprev" ":lnext") 133 + (unimpaired :l ":lprev" ":lnext") 122 134 (unimpaired :L ":lpfile" ":lnfile"))) 123 135 124 - (do ; Additional "Close" commands 136 + (do 137 + ; Additional "Close" commands 125 138 (map :n :ZS ":wa") 126 139 (map :n :ZA ":qa") 127 140 (map :n :ZX ":cq")) 128 141 129 - (do ; Swap ; and : for easier command line mode 130 - (let [swap (fn [a b] (map :nx a b) (map :nx b a))] 142 + (do 143 + ; Swap ; and : for easier command line mode 144 + (let [swap (fn [a b] 145 + (map :nx a b) 146 + (map :nx b a))] 131 147 (swap ";" ":") 132 148 (map :n "q;" "q:"))) 133 149 134 - (do ; Expand abbreviation when hitted <CR> 150 + (do 151 + ; Expand abbreviation when hitted <CR> 135 152 (map :i :<CR> "<C-]><CR>")) 136 153 137 - (do ; Make Vim behaviour consistent 154 + (do 155 + ; Make Vim behaviour consistent 138 156 (map :n :Y :y$)) 139 157 140 - (do ; Code formatting 158 + (do 159 + ; Code formatting 141 160 (map :n :g= "=aGg``") 142 - (map :nx :Q "gq") 161 + (map :nx :Q :gq) 143 162 (map :n :gQ "gqaG``")) 144 163 145 - (do ; Smart `0` 146 - ; Goes to the beginning of the text at first and later goes to the beginning of 164 + (do 165 + ; Smart `0` ; Goes to the beginning of the text at first and later goes to the beginning of 147 166 ; the line, alternates afterwards 148 - (map :n :0 "virtcol('.') - 1 <= indent('.') && col('.') > 1 ? '0' : '_'" {:expr true})) 167 + (map :n :0 "virtcol('.') - 1 <= indent('.') && col('.') > 1 ? '0' : '_'" 168 + {:expr true})) 149 169 150 - (do ; Help viewing and opening URLs 170 + (do 171 + ; Help viewing and opening URLs 151 172 (map :n :gK ":Dash") 152 173 (map :n :gq (fn [] 153 - (let [name (func.expand "<cfile>")] 154 - (func.jobstart ["open" name] {:detach true}) 155 - (print "Open" name))))) 174 + (let [name (func.expand :<cfile>)] 175 + (func.jobstart [:open name] {:detach true}) 176 + (print :Open name))))) 156 177 157 - (do ; Text object for whole file 178 + (do 179 + ; Text object for whole file 158 180 (map :o :aG ":normal! ggVG")) 159 181 160 - (do ; Quickly disable highligh 182 + (do 183 + ; Quickly disable highligh 161 184 (map :n "<Space>," ":nohlsearch")) 162 185 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") 169 - 170 - (map :t "<C-q>" "<C-\\><C-n>") 171 - (map :i "<C-q>" "<ESC>") 172 - (map :n "<C-q>" "<ESC>") 173 - 174 - (when (executable? "nvr") 186 + (do 187 + ; Terminal mappings 188 + (map :n :<C-q> :<Nop>) 189 + (map :n :<C-q>c ":term") 190 + (map :n :<C-q>s ":split +term") 191 + (map :n :<C-q>v ":vsplit +term") 192 + (map :n :<C-q>t ":tabnew +term") 193 + (map :t :<C-q> "<C-\\><C-n>") 194 + (map :i :<C-q> :<ESC>) 195 + (map :n :<C-q> :<ESC>) 196 + (when (executable? :nvr) 175 197 (set vim.env.EDITOR "nvr -cc split -c 'set bufhidden=delete' --remote-wait"))) 176 198 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>") 199 + (do 200 + ; Git mappings 201 + (let [leader :U 202 + git-map (fn [lhs cmd] 203 + (map :n (.. leader lhs) (.. ":Git " cmd)))] 204 + (map :n leader :<nop>) 181 205 (map :n (.. leader leader) (.. leader :u) {:noremap false}) 182 - (git-map :p "push") 206 + (git-map :p :push) 183 207 (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"))) 208 + (git-map :d :diff) 209 + (git-map :B :blame) 210 + (git-map :c :commit) 211 + (git-map :u :pull) 212 + (git-map :g :log))) 189 213 190 - (do ; Split management 191 - (map :n "<C-w><C-w>" "<plug>(choosewin)" {:noremap false}) 192 - (map :n "<C-_>" "<plug>(choosewin)" {:noremap false})) 214 + (do 215 + ; Split management 216 + (map :n :<C-w><C-w> "<plug>(choosewin)" {:noremap false}) 217 + (map :n :<C-_> "<plug>(choosewin)" {:noremap false})) 193 218 194 - (do ; Search 195 - (when (executable? "rg") 219 + (do 220 + ; Search 221 + (when (executable? :rg) 196 222 (opts {:grepprg "rg --vimgrep --no-heading --smart-case" 197 - :grepformat "%f:%l:%c:%m,%f:%l%m,%f %l%m"}))) 223 + :grepformat "%f:%l:%c:%m,%f:%l%m,%f %l%m"}))) 198 224 199 - (do ; Matchparen 225 + (do 226 + ; Matchparen 200 227 (set vim.g.matchup_matchparen_offscreen {:method :popup}) 201 228 (augroup matchparen 202 229 (let [term "term://*"] 203 230 (on BufEnter term (ex.NoMatchParen)) 204 231 (on BufLeave term (ex.DoMatchParen))))) 205 232 206 - (do ; Autoreload Direnv after writing the .envrc 207 - (when (executable? "direnv") 233 + (do 234 + ; Autoreload Direnv after writing the .envrc 235 + (when (executable? :direnv) 208 236 (augroup autoreload-envrc 209 - (on BufWritePost ".envrc" (ex.silent "!direnv allow %"))))) 237 + (on BufWritePost :.envrc (ex.silent "!direnv allow %"))))) 210 238 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}) 239 + (do 240 + ; Setup Lua extensions 241 + (let [setup (fn [package object] 242 + ((. (require package) :setup) object))] 243 + (setup :startify {:lists [{:type :sessions :header [" Sessions"]} 244 + {:type :commands :header [" Wiki"]}] 245 + :session-dir "~/.local/share/nvim/site/sessions/" 246 + :session-autoload true 247 + :session-persistence true 248 + :change-to-dir false 249 + :change-to-vcs-root true 250 + :fortune-use-unicode true}) 222 251 (setup :nvim-treesitter.configs 223 252 {:highlight {:enable true} 224 - :matchup {:enable true} 225 - :indent {:enable true}}) 226 - (setup :fidget {})) 227 - ; Presence requires to call `:setup` instead of `.setup 253 + :matchup {:enable true} 254 + :indent {:enable true}}) 255 + (setup :fidget {})) ; Presence requires to call `:setup` instead of `.setup 228 256 (: (require :presence) :setup 229 - {:auto_update true 230 - :buttons false 231 - :blacklist ["Workspace/forte"]})) 257 + {:auto_update true :buttons false :blacklist [:Workspace/forte]})) 232 258 233 259 (defcommand Bd "b#|bd#") 234 - (defcommand BClean 235 - (->> (func.getbufinfo {:buflisted true}) 236 - (vim.tbl_filter #(= (next $1.windows) nil)) 237 - (#(each [_ v (ipairs $1)] 238 - (api.buf-delete v.bufnr {}))))) 260 + (defcommand BClean (->> (func.getbufinfo {:buflisted true}) 261 + (vim.tbl_filter #(= (next $1.windows) nil)) 262 + (#(each [_ v (ipairs $1)] 263 + (api.buf-delete v.bufnr {}))))) 264 + 239 265 (defcommand Clean "keeppatterns %s/\\s\\+$//e | set nohlsearch") 240 266 241 - (do ; Async Make and Grep 267 + (do 268 + ; Async Make and Grep 242 269 (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} 270 + (api.call-function "asyncdo#run" (vim.list_extend args f-args)))] 271 + (defcommand Make {:bang true :nargs "*" :complete :file} 245 272 (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)))) 273 + (defcommand Grep {:bang true :nargs "+" :complete :dir} 274 + (run [bang {:job opts.grepprg :errorformat opts.grepformat}] 275 + f-args)))) 276 + 277 + (defcommand Ctags (ex.AsyncDo "ctags -R .")) 248 278 249 - (defcommand Ctags 250 - (ex.AsyncDo "ctags -R .")) 251 - (defcommand Start {:nargs :*} 279 + (defcommand Start {:nargs "*"} 252 280 (let [cmd (func.expand q-args)] 253 281 (command (.. mods " new")) 254 282 (func.termopen cmd) 255 283 (ex.startinsert))) 256 - (defcommand Dash {:nargs :?} 257 - (func.dash#open q-args)) 258 284 259 - (do ; Setup vim-sandwitch 285 + (defcommand Dash {:nargs "?"} (func.dash#open q-args)) 286 + 287 + (do 288 + ; Setup vim-sandwitch 260 289 (ex.packadd! :vim-sandwich) 261 - (ex.runtime "macros/sandwich/keymap/surround.vim")) 290 + (ex.runtime :macros/sandwich/keymap/surround.vim)) 262 291 263 292 (require :startify) 264 293 (require :langclient)