├── .gitignore ├── ftdetect ├── astro.vim └── mdx.vim ├── fnl ├── mods │ ├── ui │ │ ├── gps.fnl │ │ ├── dressing.fnl │ │ ├── gitsigns.fnl │ │ ├── colorizer.fnl │ │ ├── which-key.fnl │ │ ├── onedark.fnl │ │ ├── bufferline.fnl │ │ ├── lualine.fnl │ │ ├── nvim-tree.fnl │ │ ├── indent-line.fnl │ │ └── alpha.fnl │ ├── util │ │ ├── comments.fnl │ │ ├── autopairs.fnl │ │ ├── project.fnl │ │ ├── terminal.fnl │ │ └── tree-sitter.fnl │ └── lsp │ │ ├── color.fnl │ │ ├── signature.fnl │ │ ├── elixir-ls.fnl │ │ ├── rust-analyzer.fnl │ │ ├── null-ls.fnl │ │ ├── html.fnl │ │ ├── tailwindcss.fnl │ │ ├── lua-language-server.fnl │ │ ├── tsserver.fnl │ │ ├── cmp.fnl │ │ └── lsp.fnl ├── startup.fnl ├── core.fnl ├── mapping.fnl └── packs.fnl ├── init.lua ├── LICENSE └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | lua/ 2 | plugin/ 3 | -------------------------------------------------------------------------------- /ftdetect/astro.vim: -------------------------------------------------------------------------------- 1 | autocmd BufNewFile,BufRead *.astro setfiletype astro 2 | -------------------------------------------------------------------------------- /ftdetect/mdx.vim: -------------------------------------------------------------------------------- 1 | autocmd BufNewFile,BufRead *.mdx setfiletype markdown 2 | -------------------------------------------------------------------------------- /fnl/mods/ui/gps.fnl: -------------------------------------------------------------------------------- 1 | (module mods.ui.gps) 2 | 3 | (let [gps (require :nvim-gps)] 4 | (gps.setup)) 5 | -------------------------------------------------------------------------------- /fnl/startup.fnl: -------------------------------------------------------------------------------- 1 | (module startup) 2 | 3 | (require :packs) 4 | (require :core) 5 | (require :mapping) 6 | -------------------------------------------------------------------------------- /fnl/mods/ui/dressing.fnl: -------------------------------------------------------------------------------- 1 | (module mods.ui.dressing) 2 | 3 | (let [dressing (require :dressing)] 4 | (dressing.setup)) 5 | -------------------------------------------------------------------------------- /fnl/mods/ui/gitsigns.fnl: -------------------------------------------------------------------------------- 1 | (module mods.ui.gitsigns) 2 | 3 | (let [gitsigns (require :gitsigns)] 4 | (gitsigns.setup)) 5 | -------------------------------------------------------------------------------- /fnl/mods/ui/colorizer.fnl: -------------------------------------------------------------------------------- 1 | (module mods.ui.colorizer) 2 | 3 | (let [colorizer (require :colorizer)] 4 | (colorizer.setup)) 5 | -------------------------------------------------------------------------------- /fnl/mods/util/comments.fnl: -------------------------------------------------------------------------------- 1 | (module mods.util.comments) 2 | 3 | (let [comments (require :Comment)] 4 | (comments.setup)) 5 | -------------------------------------------------------------------------------- /fnl/mods/ui/which-key.fnl: -------------------------------------------------------------------------------- 1 | (module mods.ui.which-key) 2 | 3 | (let [which-key (require :which-key)] 4 | (which-key.setup {})) 5 | -------------------------------------------------------------------------------- /fnl/mods/lsp/color.fnl: -------------------------------------------------------------------------------- 1 | (module mods.lsp.color 2 | {autoload {document-color document-color}}) 3 | 4 | (document-color.setup 5 | {:mode :single}) 6 | -------------------------------------------------------------------------------- /fnl/mods/lsp/signature.fnl: -------------------------------------------------------------------------------- 1 | (module mods.lsp.signature) 2 | 3 | (let [signature (require :lsp_signature)] 4 | (signature.setup 5 | {:hint_prefix " "})) 6 | -------------------------------------------------------------------------------- /fnl/mods/lsp/elixir-ls.fnl: -------------------------------------------------------------------------------- 1 | (module mods.lsp.elixir-ls 2 | {autoload {lsp mods.lsp.lsp}}) 3 | 4 | (lsp.use :elixirls 5 | {:opts {:cmd ["elixir-ls"] }}) 6 | -------------------------------------------------------------------------------- /fnl/mods/ui/onedark.fnl: -------------------------------------------------------------------------------- 1 | (module mods.ui.onedark) 2 | 3 | (let [onedark (require :onedark)] 4 | (onedark.setup 5 | {:style :cool 6 | :toggle_style_key ""}) 7 | (onedark.load)) 8 | -------------------------------------------------------------------------------- /fnl/mods/util/autopairs.fnl: -------------------------------------------------------------------------------- 1 | (module mods.util.autopairs) 2 | 3 | (let [autopairs (require :nvim-autopairs)] 4 | (autopairs.setup 5 | {:disable_filetype ["TelescopePrompt" "fennel"]})) 6 | -------------------------------------------------------------------------------- /fnl/mods/util/project.fnl: -------------------------------------------------------------------------------- 1 | (module mods.util.project) 2 | 3 | (let [project (require :project_nvim) 4 | telescope (require :telescope)] 5 | (project.setup {}) 6 | (telescope.load_extension "projects")) 7 | -------------------------------------------------------------------------------- /fnl/mods/lsp/rust-analyzer.fnl: -------------------------------------------------------------------------------- 1 | (module mods.lsp.rust-analyzer 2 | {autoload {lsp mods.lsp.lsp}}) 3 | 4 | (let [rust-tools (require :rust-tools)] 5 | (rust-tools.setup 6 | {:server {:on_attach (lsp.make-on-attach)}})) 7 | -------------------------------------------------------------------------------- /fnl/mods/lsp/null-ls.fnl: -------------------------------------------------------------------------------- 1 | (module mods.lsp.null-ls 2 | {autoload {null-ls null-ls}}) 3 | 4 | (null-ls.setup 5 | {:sources [;;null-ls.builtins.formatting.stylua 6 | null-ls.builtins.formatting.autopep8 7 | (null-ls.builtins.formatting.prettier.with {:prefer_local "node_modules/.bin"})]}) 8 | -------------------------------------------------------------------------------- /fnl/mods/lsp/html.fnl: -------------------------------------------------------------------------------- 1 | (module mods.lsp.html 2 | {autoload {lsp mods.lsp.lsp}}) 3 | 4 | (lsp.use :html 5 | {:hook (fn [client buffer] 6 | ;; disable formatting, using formatting via null-ls instead 7 | (set client.server_capabilities.documentFormattingProvider false) 8 | (set client.server_capabilities.documentRangeFormattingProvider false))}) 9 | -------------------------------------------------------------------------------- /fnl/mods/lsp/tailwindcss.fnl: -------------------------------------------------------------------------------- 1 | (module mods.lsp.tailwindcss 2 | {autoload {lsp mods.lsp.lsp 3 | document-color document-color}}) 4 | 5 | (lsp.use :tailwindcss 6 | {:opts {:init_options {:userLanguages {:elixir "html" 7 | :eelixir "html" 8 | :heex "html"}}} 9 | :hook (fn [client buffer] 10 | (document-color.buf_attach buffer))}) 11 | -------------------------------------------------------------------------------- /fnl/mods/ui/bufferline.fnl: -------------------------------------------------------------------------------- 1 | (module mods.ui.bufferline) 2 | 3 | (let [bufferline (require :bufferline)] 4 | (bufferline.setup 5 | {:options {:offsets [{:filetype "NvimTree" 6 | :text " File Explorer" 7 | :highlight "Directory" 8 | :text_align :left}] 9 | :show_close_icon false}}) 10 | (vim.cmd 11 | "autocmd FileType alpha set showtabline=0 | autocmd WinLeave set showtabline=2")) 12 | -------------------------------------------------------------------------------- /fnl/mods/util/terminal.fnl: -------------------------------------------------------------------------------- 1 | (module mods.util.terminal) 2 | 3 | (let [fterm (require :FTerm)] 4 | (fterm.setup 5 | {:border :double 6 | :dimensions {:height 0.9 7 | :width 0.9}}) 8 | (let [map vim.api.nvim_set_keymap] 9 | (map :t : "" {:noremap true :silent true}) 10 | (map :n : "lua require('FTerm').toggle()" {:noremap true :silent true}) 11 | (map :t : "lua require('FTerm').toggle()" {:noremap true :silent true}))) 12 | -------------------------------------------------------------------------------- /fnl/mods/ui/lualine.fnl: -------------------------------------------------------------------------------- 1 | (module mods.ui.lualine) 2 | 3 | (let [lualine (require :lualine) 4 | gps (require :nvim-gps)] 5 | (lualine.setup 6 | {:options {:theme :onedark 7 | :component_separators "|" 8 | :section_separators {:left "" :right ""} 9 | :disabled_filetypes ["NvimTree"]} 10 | :sections {:lualine_a [:mode] 11 | :lualine_b [:branch :diff :diagnostics] 12 | :lualine_c [:filename 13 | {1 gps.get_location :cond gps.is_available}]}})) 14 | -------------------------------------------------------------------------------- /fnl/mods/util/tree-sitter.fnl: -------------------------------------------------------------------------------- 1 | (module mods.util.tree-sitter) 2 | 3 | (let [tree-sitter-config (require :nvim-treesitter.configs)] 4 | (tree-sitter-config.setup 5 | {:ensure_installed :all 6 | :ignore_install [] 7 | :highlight {:enable true 8 | :disble []} 9 | :autotag {:enable true} 10 | :textobjects {:select {:enable true 11 | :lookahead true 12 | :keymaps {:af "@function.outer" 13 | :if "@function.inner" 14 | :ac "@class.outer" 15 | :ic "@class.inner" 16 | :ab "@block.outer" 17 | :ib "@block.inner"}}}})) 18 | -------------------------------------------------------------------------------- /init.lua: -------------------------------------------------------------------------------- 1 | local execute = vim.api.nvim_command 2 | local fn = vim.fn 3 | local fmt = string.format 4 | 5 | local pack_path = fn.stdpath("data") .. "/site/pack" 6 | 7 | function ensure (user, repo) 8 | -- Ensures a given github.com/USER/REPO is cloned in the pack/packer/start directory. 9 | local install_path = fmt("%s/packer/start/%s", pack_path, repo) 10 | if fn.empty(fn.glob(install_path)) > 0 then 11 | execute(fmt("!git clone https://github.com/%s/%s %s", user, repo, install_path)) 12 | execute(fmt("packadd %s", repo)) 13 | end 14 | end 15 | 16 | ensure("wbthomason", "packer.nvim") 17 | ensure("Olical", "aniseed") 18 | ensure("lewis6991", "impatient.nvim") 19 | 20 | require("impatient") 21 | 22 | vim.g["aniseed#env"] = { 23 | module = "startup", 24 | compile = true 25 | } 26 | -------------------------------------------------------------------------------- /fnl/mods/lsp/lua-language-server.fnl: -------------------------------------------------------------------------------- 1 | (module mods.lsp.lua-language-server 2 | {autoload {lsp mods.lsp.lsp}}) 3 | 4 | (let [runtime_path (vim.split package.path ";") 5 | libraries (vim.api.nvim_get_runtime_file "" true)] 6 | (table.insert runtime_path "lua/?.lua") 7 | (table.insert runtime_path "lua/?/init.lua") 8 | (table.insert runtime_path "lib/?.lua") 9 | (table.insert runtime_path "lib/?/init.lua") 10 | (lsp.use :sumneko_lua 11 | {:opts {:settings {:Lua {:runtime {:version "LuaJIT" 12 | :path runtime_path} 13 | :diagnostics {:globals ["vim"]} 14 | :workspace {:library libraries} 15 | :telemetry {:enable false}}}}})) 16 | -------------------------------------------------------------------------------- /fnl/core.fnl: -------------------------------------------------------------------------------- 1 | (module core) 2 | 3 | ;; leader key 4 | (set vim.g.mapleader " ") 5 | (set vim.g.maplocalleader ",") 6 | 7 | ;; general settings 8 | (set vim.o.termguicolors true) 9 | (set vim.o.cursorline true) 10 | (set vim.o.number true) 11 | (set vim.o.shiftwidth 2) 12 | (set vim.o.tabstop 2) 13 | (set vim.o.softtabstop 2) 14 | (set vim.o.expandtab true) 15 | (set vim.o.hidden true) 16 | (set vim.o.wrap false) 17 | (set vim.o.mouse "a") 18 | (set vim.o.encoding "utf-8") 19 | (set vim.o.wildmenu true) 20 | (set vim.o.smartcase true) 21 | (set vim.o.relativenumber true) 22 | (set vim.o.foldenable false) 23 | 24 | ;; switch off relative number in insert mode 25 | (vim.cmd "autocmd InsertEnter * :set norelativenumber") 26 | (vim.cmd "autocmd InsertLeave * :set relativenumber") 27 | 28 | ;; neovide settings 29 | (when vim.g.neovide 30 | (set vim.o.guifont "FiraCode Nerd Font:h14")) 31 | -------------------------------------------------------------------------------- /fnl/mods/ui/nvim-tree.fnl: -------------------------------------------------------------------------------- 1 | (module :mods.ui.nvim-tree) 2 | 3 | (let [nvim-tree (require :nvim-tree)] 4 | (nvim-tree.setup 5 | {:update_cwd false}) 6 | (set vim.g.nvim_tree_respect_buf_cwd 1) 7 | (set vim.g.nvim_tree_indent_markers 1) 8 | (set vim.g.nvim_tree_highlight_opened_files 1) 9 | (set vim.g.nvim_tree_icons 10 | {:default "" 11 | :symlink "" 12 | :git {:unstaged "" 13 | :staged "" 14 | :unmerged "" 15 | :renamed "" 16 | :untracked "" 17 | :deleted "" 18 | :ignored ""} 19 | :folder {:arrow_open "" 20 | :arrow_closed "" 21 | :default "" 22 | :open "" 23 | :empty "" 24 | :empty_open "" 25 | :symlink "" 26 | :symlink_open ""} 27 | :lsp {:hint "" 28 | :info "" 29 | :warning "" 30 | :error ""}})) 31 | -------------------------------------------------------------------------------- /fnl/mods/ui/indent-line.fnl: -------------------------------------------------------------------------------- 1 | (module mods.ui.indent-line) 2 | 3 | (let [indent-line (require :indent_blankline)] 4 | (indent-line.setup 5 | {:show_current_context true 6 | :filetype_exclude ["alpha" 7 | "startify" 8 | "dashboard" 9 | "dotooagenda" 10 | "log" 11 | "fugitive" 12 | "gitcommit" 13 | "packer" 14 | "vimwiki" 15 | "markdown" 16 | "json" 17 | "txt" 18 | "vista" 19 | "help" 20 | "todoist" 21 | "NvimTree" 22 | "peekaboo" 23 | "git" 24 | "TelescopePrompt" 25 | "undotree" 26 | "flutterToolsOutline" 27 | "FTerm" 28 | ;; for all buffers without filetype 29 | ""]})) 30 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 Tristan Young 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /fnl/mods/ui/alpha.fnl: -------------------------------------------------------------------------------- 1 | (module mods.ui.alpha) 2 | 3 | (let [alpha (require :alpha) 4 | dashboard (require :alpha.themes.dashboard)] 5 | (set dashboard.section.header.val 6 | [" " 7 | " " 8 | " ███╗ ██╗███████╗ ██████╗ ██╗ ██╗██╗███╗ ███╗ " 9 | " ████╗ ██║██╔════╝██╔═══██╗██║ ██║██║████╗ ████║ " 10 | " ██╔██╗ ██║█████╗ ██║ ██║██║ ██║██║██╔████╔██║ " 11 | " ██║╚██╗██║██╔══╝ ██║ ██║╚██╗ ██╔╝██║██║╚██╔╝██║ " 12 | " ██║ ╚████║███████╗╚██████╔╝ ╚████╔╝ ██║██║ ╚═╝ ██║ " 13 | " ╚═╝ ╚═══╝╚══════╝ ╚═════╝ ╚═══╝ ╚═╝╚═╝ ╚═╝ " 14 | " "]) 15 | (set dashboard.section.buttons.val 16 | [(dashboard.button "e" " > New file" "ene ") 17 | (dashboard.button "SPC f f" " > Find file") 18 | (dashboard.button "SPC f h" " > Find history") 19 | (dashboard.button "SPC f g" " > Find word") 20 | (dashboard.button "SPC f p" " > Find project") 21 | (dashboard.button "q" " > Quit" ":qa")]) 22 | (alpha.setup (. dashboard :opts))) 23 | -------------------------------------------------------------------------------- /fnl/mods/lsp/tsserver.fnl: -------------------------------------------------------------------------------- 1 | (module mods.lsp.tsserver 2 | {autoload {lsp mods.lsp.lsp 3 | which-key which-key 4 | typescript typescript}}) 5 | 6 | (typescript.setup {:server {:on_attach (lsp.make-on-attach)}}) 7 | 8 | ;; (lsp.use :tsserver 9 | ;; {:hook (fn [client buffer] 10 | ;; ;; disable tsserver formatting, using formatting via null-ls instead 11 | ;; (set client.resolved_capabilities.document_formatting false) 12 | ;; (set client.resolved_capabilities.document_range_formatting false) 13 | ;; (ts-utils.setup {:enable_formatting true}) 14 | ;; (ts-utils.setup_client client) 15 | ;; (which-key.register 16 | ;; {:l {:name "LSP" 17 | ;; :o [ "TSLspOrganize" "Organize imports"] 18 | ;; :i [ "TSLspImportAll" "Import missing imports"] 19 | ;; :r [ "TSLspRenameFile" "Rename file"]}} 20 | ;; {:prefix "" 21 | ;; :buffer buffer 22 | ;; :silent true})) 23 | ;; :opts {:init_options ts-utils.init_options}}) 24 | -------------------------------------------------------------------------------- /fnl/mods/lsp/cmp.fnl: -------------------------------------------------------------------------------- 1 | (module mods.lsp.cmp 2 | {autoload {cmp cmp}}) 3 | 4 | (set vim.o.completeopt "menu,menuone,noselect") 5 | 6 | (defn- on-tab-down [fallback] 7 | (if (cmp.visible) 8 | (let [entry (cmp.get_selected_entry)] 9 | (if (not entry) 10 | (cmp.select_next_item {:behavior cmp.SelectBehavior.Select}) 11 | (cmp.confirm))) 12 | (fallback))) 13 | 14 | (cmp.setup 15 | {:snippet {:expand (fn [args] 16 | ((. vim.fn :vsnip#anonymous) args.body))} 17 | :mapping (cmp.mapping.preset.insert 18 | {: (cmp.mapping.confirm {:select true}) 19 | : (cmp.mapping on-tab-down [:i :s :c])}) 20 | :sources (cmp.config.sources 21 | [{:name :nvim_lsp} 22 | {:name :vsnip} 23 | {:name :buffer} 24 | {:name :path}])}) 25 | 26 | (cmp.setup.cmdline 27 | ":" {:mapping (cmp.mapping.preset.cmdline) 28 | :sources [{:name :cmdline}]}) 29 | 30 | (cmp.setup.cmdline 31 | "/" {:mapping (cmp.mapping.preset.cmdline) 32 | :sources [{:name :buffer}] 33 | :view {:entries {:name :wildmenu 34 | :separator :|}}}) 35 | 36 | (vim.cmd "imap vsnip#jumpable(1) ? '(vsnip-jump-next)' : '' 37 | smap vsnip#jumpable(1) ? '(vsnip-jump-next)' : '' 38 | imap vsnip#jumpable(-1) ? '(vsnip-jump-prev)' : '' 39 | smap vsnip#jumpable(-1) ? '(vsnip-jump-prev)' : ''") 40 | 41 | (let [cmp-autopairs (require :nvim-autopairs.completion.cmp)] 42 | (: cmp.event :on :confirm_done (cmp-autopairs.on_confirm_done {:map_char {:tex ""}}))) 43 | -------------------------------------------------------------------------------- /fnl/mapping.fnl: -------------------------------------------------------------------------------- 1 | (module mapping 2 | {autoload {which-key which-key}}) 3 | 4 | (which-key.register 5 | {:f {:name "find" 6 | :f ["Telescope find_files" "Find files"] 7 | :b ["Telescope buffers" "Find buffers"] 8 | :h ["Telescope oldfiles" "Find history"] 9 | :g ["Telescope live_grep" "Find by grep"] 10 | :p ["Telescope projects" "Find projects"]} 11 | 12 | :F {:name "file" 13 | :w ["w" "Save file"]} 14 | 15 | :w {:name "window" 16 | :h ["h" "Go to left window"] 17 | :j ["j" "Go to down window"] 18 | :k ["k" "Go to up window"] 19 | :l ["l" "Go to right window"] 20 | :H ["H" "Move window left"] 21 | :J ["J" "Move window down"] 22 | :K ["K" "Move window up"] 23 | :L ["L" "Move window right"] 24 | :s ["s" "Split window horizontally"] 25 | :v ["v" "Split window vertically"] 26 | :x ["x" "Swap current window with next"] 27 | :q ["q" "Quit current window"] 28 | :w ["w" "Switch windows"]} 29 | 30 | :b {:name "buffer" 31 | :n ["BufferLineMoveNext" "Move to next"] 32 | :p ["BufferLineMovePrev" "Move to previous"] 33 | :b ["BufferLinePick" "Pick buffer to go"] 34 | :x ["BufferLinePickClose" "Pick buffer to close"] 35 | :h ["BufferLineCloseLeft" "Close left buffers"] 36 | :l ["BufferLineCloseRight" "Close right buffers"]} 37 | 38 | :p {:name "packs" 39 | :i ["PackerInstall" "Install plugins"] 40 | :u ["PackerUpdate" "Update plugins"] 41 | :c ["PackerCompile" "Compile packer file"] 42 | :C ["PackerClean" "Clean plugins"]} 43 | 44 | :e ["NvimTreeToggle" "Toggle NvimTree"] 45 | : ["silent! nohls" "Clear search highlight"]} 46 | 47 | {:prefix ""}) 48 | 49 | (which-key.register 50 | {:== ["lua vim.lsp.buf.formatting()" "Code format"] 51 | : ["\"+" "Using system clipboard register"]} 52 | 53 | {:prefix ""}) 54 | 55 | (which-key.register 56 | {: ["\"+" "Using system clipboard register"]} 57 | 58 | {:prefix "" :mode :v}) 59 | 60 | (which-key.register 61 | {"[b" ["BufferLineCyclePrev" "Previous buffer"] 62 | "]b" ["BufferLineCycleNext" "Next buffer"]}) 63 | -------------------------------------------------------------------------------- /fnl/mods/lsp/lsp.fnl: -------------------------------------------------------------------------------- 1 | (module mods.lsp.lsp 2 | {autoload {lsp-config lspconfig 3 | cmp-lsp cmp_nvim_lsp 4 | which-key which-key}}) 5 | 6 | (def- border 7 | [[ "╭" :FloatBorder ] 8 | [ "─" :FloatBorder ] 9 | [ "╮" :FloatBorder ] 10 | [ "│" :FloatBorder ] 11 | [ "╯" :FloatBorder ] 12 | [ "─" :FloatBorder ] 13 | [ "╰" :FloatBorder ] 14 | [ "│" :FloatBorder ]]) 15 | 16 | (defn make-on-attach [hook] 17 | (fn [client buffer] 18 | (which-key.register 19 | {:gD [ "lua vim.lsp.buf.declaration()" "Goto declaration"] 20 | :gd [ "lua vim.lsp.buf.definition()" "Goto definition"] 21 | :gi [ "lua vim.lsp.buf.implementation()" "Goto implementation"] 22 | :gr [ "lua vim.lsp.buf.references()" "Goto references"] 23 | :go [ "lua vim.diagnostic.open_float()" "Show diagnostics"] 24 | :K [ "lua vim.lsp.buf.hover()" "Hover"] 25 | "[d" [ "lua vim.diagnostic.goto_prev()" "Previous diagnostics"] 26 | "]d" [ "lua vim.diagnostic.goto_next()" "Next diagnostics"]} 27 | {:buffer buffer 28 | :silent true}) 29 | (which-key.register 30 | {:c {:name "code" 31 | :r [ "lua vim.lsp.buf.rename()" "Rename"] 32 | :a [ "lua vim.lsp.buf.code_action()" "Code action"] 33 | :f [ "lua vim.lsp.buf.format({async = true})" "Format"] 34 | :k [ "lua vim.lsp.buf.signature_help()" "Signature help"] 35 | :d [ "lua vim.diagnostic.setloclist()" "Diagnostics"]}} 36 | {:prefix "" 37 | :buffer buffer 38 | :silent true}) 39 | (tset vim.lsp.handlers "textDocument/hover" (vim.lsp.with vim.lsp.handlers.hover {:border border})) 40 | (when hook 41 | (hook client buffer)))) 42 | 43 | (defn use [name config] 44 | (let [server (. lsp-config name) 45 | opts (or (. config :opts) {}) 46 | hook (. config :hook)] 47 | (tset opts :on_attach (make-on-attach hook)) 48 | (tset opts :capabilities (cmp-lsp.default_capabilities)) 49 | (server.setup opts)) 50 | nil) 51 | 52 | (let [servers [:bashls 53 | :clangd 54 | :cssls 55 | :zls 56 | :hls 57 | :astro 58 | :jdtls 59 | :ocamllsp 60 | :pyright 61 | :solargraph]] 62 | (each [_ server (ipairs servers)] 63 | (use server {}))) 64 | 65 | (require :mods.lsp.null-ls) 66 | (require :mods.lsp.tsserver) 67 | (require :mods.lsp.html) 68 | (require :mods.lsp.elixir-ls) 69 | (require :mods.lsp.rescript-ls) 70 | (require :mods.lsp.tailwindcss) 71 | (require :mods.lsp.rust-analyzer) 72 | (require :mods.lsp.lua-language-server) 73 | 74 | (require :mods.lsp.opal) 75 | -------------------------------------------------------------------------------- /fnl/packs.fnl: -------------------------------------------------------------------------------- 1 | (module packs 2 | {autoload {packer packer}}) 3 | 4 | (defn safe-require [mod] 5 | (let [(ok? val-or-err) (pcall require (.. :mods. mod))] 6 | (when (not ok?) 7 | (print (.. "failed to load config for 'mods." mod "': " val-or-err))))) 8 | 9 | (defn- use [...] 10 | (let [packs [...]] 11 | (packer.startup 12 | {1 (fn [use] 13 | (for [i 1 (length packs) 2] 14 | (let [name (. packs i) 15 | opts (. packs (+ i 1))] 16 | (-?> (. opts :mod) (safe-require)) 17 | (table.insert opts 1 name) 18 | (use opts)))) 19 | :config {:display {:open_fn (. (require :packer.util) :float)}}})) 20 | nil) 21 | 22 | (use 23 | ;; bootstrap 24 | :wbthomason/packer.nvim {} 25 | :Olical/aniseed {} 26 | :lewis6991/impatient.nvim {} 27 | 28 | ;; ui 29 | :navarasu/onedark.nvim {:mod :ui.onedark} 30 | :lukas-reineke/indent-blankline.nvim {:mod :ui.indent-line} 31 | :kyazdani42/nvim-tree.lua {:mod :ui.nvim-tree :requires [[:kyazdani42/nvim-web-devicons]]} 32 | :nvim-lualine/lualine.nvim {:mod :ui.lualine} 33 | :akinsho/bufferline.nvim {:mod :ui.bufferline} 34 | :goolord/alpha-nvim {:mod :ui.alpha} 35 | :folke/which-key.nvim {:mod :ui.which-key} 36 | ;; :norcalli/nvim-colorizer.lua {:mod :ui.colorizer} 37 | :stevearc/dressing.nvim {:mod :ui.dressing} 38 | :SmiteshP/nvim-gps {:mod :ui.gps} 39 | :lewis6991/gitsigns.nvim {:mod :ui.gitsigns} 40 | 41 | ;; util 42 | :nvim-telescope/telescope.nvim {:requires [[:nvim-lua/popup.nvim] [:nvim-lua/plenary.nvim]]} 43 | :ahmedkhalf/project.nvim {:mod :util.project} 44 | :numToStr/FTerm.nvim {:mod :util.terminal} 45 | :ggandor/lightspeed.nvim {} 46 | :windwp/nvim-autopairs {:mod :util.autopairs} 47 | :windwp/nvim-ts-autotag {} 48 | :numToStr/Comment.nvim {:mod :util.comments} 49 | :nvim-treesitter/nvim-treesitter-textobjects {} 50 | :tpope/vim-surround {} 51 | :tpope/vim-repeat {} 52 | 53 | ;; lsp 54 | :neovim/nvim-lspconfig {:mod :lsp.lsp} 55 | :jose-elias-alvarez/null-ls.nvim {:mod :lsp.null-ls} 56 | :ray-x/lsp_signature.nvim {:mod :lsp.signature} 57 | :mrshmllow/document-color.nvim {:mod :lsp.color} 58 | 59 | ;; completion 60 | :hrsh7th/nvim-cmp {:mod :lsp.cmp} 61 | :hrsh7th/cmp-nvim-lsp {} 62 | :hrsh7th/cmp-buffer {} 63 | :hrsh7th/cmp-path {} 64 | :hrsh7th/cmp-cmdline {} 65 | :hrsh7th/cmp-vsnip {} 66 | :hrsh7th/vim-vsnip {} 67 | :rafamadriz/friendly-snippets {} 68 | 69 | ;;tree-sitter 70 | :nvim-treesitter/nvim-treesitter {:mod :util.tree-sitter} 71 | :nkrkv/nvim-treesitter-rescript {} 72 | 73 | ;; lang 74 | :jose-elias-alvarez/nvim-lsp-ts-utils {} 75 | :jose-elias-alvarez/typescript.nvim {} 76 | :simrat39/rust-tools.nvim {} 77 | :elixir-editors/vim-elixir {} 78 | :vim-crystal/vim-crystal {} 79 | :wlangstroth/vim-racket {} 80 | :Olical/conjure {}) 81 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Neovim Config 2 | 3 | A *simple*, *fast* and *modular* neovim configuration powered by [Fennel][0] for Elixir/React/Rust programmers. 4 | 5 | ![20220731-12-52-08](https://user-images.githubusercontent.com/10807119/182010763-d23a2baa-c979-4c0b-bb0e-81b469512379.png) 6 | ![20220731-12-52-54](https://user-images.githubusercontent.com/10807119/182010765-3b6b9f02-f028-4352-a868-2cfd34f94616.png) 7 | ![20220731-12-55-40](https://user-images.githubusercontent.com/10807119/182010766-457fb0b8-e866-46e9-a18b-3af7d627f9a4.png) 8 | 9 | # Featured Plugins 10 | 11 |
12 | plugin list 13 | 14 | | Plugin | Description | 15 | | :------------------------------------------------------------------------------------------------------------ | :------------------------------------------ | 16 | | [wbthomason/packer.nvim](https://github.com/wbthomason/packer.nvim) | plugin manager | 17 | | [Olical/aniseed](https://github.com/Olical/aniseed) | fennel support for neovim | 18 | | [lewis6991/impatient.nvim](https://github.com/lewis6991/impatient.nvim) | speed up loading modules | 19 | | [navarasu/onedark.nvim](https://github.com/navarasu/onedark.nvim) | one dark colorscheme | 20 | | [lukas-reineke/indent-blankline.nvim](https://github.com/lukas-reineke/indent-blankline.nvim) | indent line | 21 | | [kyazdani42/nvim-tree.lua](https://github.com/kyazdani42/nvim-tree.lua) | file tree | 22 | | [nvim-lualine/lualine.nvim](https://github.com/nvim-lualine/lualine.nvim) | status line | 23 | | [akinsho/bufferline.nvim](https://github.com/akinsho/bufferline.nvim) | buffer tab line | 24 | | [goolord/alpha-nvim](https://github.com/goolord/alpha-nvim) | startup dashboard | 25 | | [folke/which-key.nvim](https://github.com/folke/which-key.nvim) | key mapping cheatsheet | 26 | | [norcalli/nvim-colorizer.lua](https://github.com/norcalli/nvim-colorizer.lua) | color hex values | 27 | | [stevearc/dressing.nvim](https://github.com/stevearc/dressing.nvim) | better ui | 28 | | [SmiteshP/nvim-gps](https://github.com/SmiteshP/nvim-gps) | context info for lualine | 29 | | [nvim-telescope/telescope.nvim](https://github.com/nvim-telescope/telescope.nvim) | the ultimate fuzzy finder | 30 | | [ahmedkhalf/project.nvim](https://github.com/ahmedkhalf/project.nvim) | shortcut to your recently opened project | 31 | | [numToStr/FTerm.nvim](https://github.com/numToStr/FTerm.nvim) | floating terminal | 32 | | [ggandor/lightspeed.nvim](https://github.com/ggandor/lightspeed.nvim) | easymotion/vim-sneak alternative | 33 | | [windwp/nvim-autopairs](https://github.com/windwp/nvim-autopairs) | brackets/parenthesis/braces auto pair | 34 | | [windwp/nvim-ts-autotag](https://github.com/windwp/nvim-ts-autotag) | html tags auto pair | 35 | | [numToStr/Comment.nvim](https://github.com/numToStr/Comment.nvim) | comment operator | 36 | | [nvim-treesitter/nvim-treesitter-textobjects](https://github.com/nvim-treesitter/nvim-treesitter-textobjects) | custom text objects | 37 | | [tpope/vim-surround](https://github.com/tpope/vim-surround) | surround operator | 38 | | [tpope/vim-repeat](https://github.com/tpope/vim-repeat) | dot repeat | 39 | | [neovim/nvim-lspconfig](https://github.com/neovim/nvim-lspconfig) | lsp configuration | 40 | | [jose-elias-alvarez/null-ls.nvim](https://github.com/jose-elias-alvarez/null-ls.nvim) | general usage lang server | 41 | | [ray-x/lsp_signature.nvim](https://github.com/ray-x/lsp_signature.nvim) | show function signature popup | 42 | | [hrsh7th/nvim-cmp](https://github.com/hrsh7th/nvim-cmp) | completion framework | 43 | | [hrsh7th/cmp-nvim-lsp](https://github.com/hrsh7th/cmp-nvim-lsp) | lsp completion source | 44 | | [hrsh7th/cmp-buffer](https://github.com/hrsh7th/cmp-buffer) | buffer completion source | 45 | | [hrsh7th/cmp-path](https://github.com/hrsh7th/cmp-path) | path completion source | 46 | | [hrsh7th/cmp-cmdline](https://github.com/hrsh7th/cmp-cmdline) | cmdline completions ource | 47 | | [hrsh7th/cmp-vsnip](https://github.com/hrsh7th/cmp-vsnip) | vsnip completion source | 48 | | [hrsh7th/vim-vsnip](https://github.com/hrsh7th/vim-vsnip) | vscode format snippet support | 49 | | [rafamadriz/friendly-snippets](https://github.com/rafamadriz/friendly-snippets) | a collection of snippets | 50 | | [nvim-treesitter/nvim-treesitter](https://github.com/nvim-treesitter/nvim-treesitter) | treesitter for syntax highlighting and more | 51 | | [jose-elias-alvarez/nvim-lsp-ts-utils](https://github.com/jose-elias-alvarez/nvim-lsp-ts-utils) | typescript plugin | 52 | | [simrat39/rust-tools.nvim](https://github.com/simrat39/rust-tools.nvim) | rust pluging | 53 | | [elixir-editors/vim-elixir](https://github.com/elixir-editors/vim-elixir) | elixir plugin | 54 | 55 |
56 | 57 | # Installation 58 | 59 | ```sh 60 | # if you already have a configured neovim, please make a backup first 61 | cp -r ~/.config/nvim ~/.config/nvim.bak 62 | git clone https://github.com/TunkShif/neovim ~/.config/nvim 63 | ``` 64 | 65 | You'll have to mannually install missing language servers. 66 | 67 | # Keymapping Preset 68 | 69 | Almost all user-defined key mappings are set in `fnl/mapping.fnl` using `which-key`. The default leader key is `SPC` i.e. the space key, and the default local leader key is `,`. Most mappings are grouped, following ` ` format. 70 | 71 |
72 | mappings 73 | 74 | | Mapping | Description | 75 | | :-------------: | :------------------------------ | 76 | | `SPC f f` | find files | 77 | | `SPC f b` | find buffers | 78 | | `SPC f h` | find history | 79 | | `SPC f g` | find by grep | 80 | | `SPC f p` | find projects | 81 | | `SPC F w` | save file | 82 | | `SPC w h/j/k/l` | goto window | 83 | | `SPC w H/J/K/L` | move window | 84 | | `SPC w s` | split window horizontally | 85 | | `SPC w v` | split window vertically | 86 | | `SPC w x` | swap window | 87 | | `SPC w q` | quit window | 88 | | `SPC w w` | switch window | 89 | | `SPC b n` | next buffer | 90 | | `SPC b p` | previous buffer | 91 | | `SPC b b` | pick buffer | 92 | | `SPC b x` | pick to close buffer | 93 | | `SPC b h` | close left buffers | 94 | | `SPC b l` | close right buffers | 95 | | `SPC p i` | install plugins | 96 | | `SPC p u` | update plugins | 97 | | `SPC p c` | compile plugin file | 98 | | `SPC p C` | clean plugins | 99 | | `SPC c r` | lsp symbol rename | 100 | | `SPC c a` | lsp code action | 101 | | `SPC c f` | lsp code format | 102 | | `SPC c k` | lsp signature help | 103 | | `SPC c d` | lsp diagnostics list | 104 | | `SPC e` | toggle file tree | 105 | | `SPC ` | clear search highlight | 106 | | `,,` | using system clipboard register | 107 | | `` | toggle floating terminal | 108 | | `gd` | lsp goto definition | 109 | | `gD` | lsp goto declaration | 110 | | `gi` | lsp goto implementation | 111 | | `gr` | lsp goto references | 112 | | `go` | lsp open floating diafnostic | 113 | | `K` | lsp hover documentation | 114 | | `[d` | previous diagnostic | 115 | | `]d` | next diagnostic | 116 | | `[b` | previous buffer | 117 | | `]b` | next buffer | 118 | 119 |
120 | 121 | And there're some customized text objects 122 | 123 | | Mapping | Descriptiont | 124 | | :-----: | :------------------ | 125 | | `af` | function body outer | 126 | | `if` | function body inner | 127 | | `ac` | class outer | 128 | | `ic` | class inner | 129 | | `ab` | block outer | 130 | | `ib` | block inner | 131 | 132 | # Customization 133 | 134 | ## Add a new plugin 135 | 136 | Open `fnl/packs.fnl`, and add new plugins following the format `:/ {}` in the last `(use)` form. 137 | 138 | You can pass addtional settings from available for `packer`'s `use` callback, like `requires`, `branch`, etc. 139 | 140 | Besides you can optionally pass a `:mod ` option for plugin configuration setup. 141 | 142 | ## Add a new module 143 | 144 | It's recommended to put your new module under `fnl/mods//.fnl`, then use the module/autoload system from [aniseed][1] to define the new module. 145 | 146 | ### Example 147 | 148 | If we want to add a new plugin from `foobar/baz.nvim`, and corresponding module for plugin configuration. 149 | 150 | ```fennel 151 | ;; fnl/packs.fnl 152 | (use 153 | ;; other plugins 154 | :foobar/baz.nvim {:mod :util.baz}) 155 | 156 | ;; fnl/mods/util/baz.fnl 157 | (module mods.util.baz) 158 | 159 | (let [baz (require :baz)] 160 | (baz.setup {})) 161 | ``` 162 | 163 | ## Add a new language server 164 | 165 | Use `use` function provided by `mods.lsp.lsp` module to add a new langauge server support. 166 | 167 | ```fennel 168 | (module mods.lsp.elixir-ls 169 | {autoload {lsp mods.lsp.lsp}}) 170 | 171 | (lsp.use :tailwindcss {}) 172 | 173 | ;; you can also pass additional settings 174 | 175 | ;; example from `mods.lsp.elixir-ls` 176 | (lsp.use :elixirls 177 | {:opts {:cmd ["elixir-ls"] }}) 178 | ;; example from `mods.lsp.lua-language-server` 179 | (let [runtime_path (vim.split package.path ";")] 180 | (table.insert runtime_path "lua/?.lua") 181 | (table.insert runtime_path "lua/?/init.lua") 182 | (lsp.use :sumneko_lua 183 | {:opts {:settings {:Lua {:runtime {:version "LuaJIT" 184 | :path runtime_path} 185 | :diagnostics {:globals ["vim"]} 186 | :workspace {:library (vim.api.nvim_get_runtime_file "" true)} 187 | :telemetry {:enable false}} }}})) 188 | 189 | ;; if you want to add some additional logic in `on_attach` callback 190 | ;; you can pass an optional `:hook` option 191 | 192 | ;; example from `mods.lsp.tsserver` 193 | (lsp.use :tsserver 194 | {:hook (fn [client buffer] 195 | ;; disable tsserver formatting, using formatting via null-ls instead 196 | (set client.resolved_capabilities.document_formatting false) 197 | (set client.resolved_capabilities.document_range_formatting false) 198 | (ts-utils.setup {:enable_formatting true}) 199 | (ts-utils.setup_client client)) 200 | :opts {:init_options ts-utils.init_options}}) 201 | ``` 202 | 203 | [0]: https://fennel-lang.org/ 204 | [1]: https://github.com/Olical/aniseed 205 | --------------------------------------------------------------------------------