nix

configuration files that power my machines
Log | Files | Refs | README | LICENSE

init.fnl (2343B)


      1 (vim.loader.enable)
      2 
      3 (local {: g : env : fs} vim)
      4 (local {:nvim_command command} vim.api)
      5 (local {: stdpath : empty : glob} vim.fn)
      6 (local {: format} string)
      7 
      8 (fn gh [name] (.. "https://github.com/" name))
      9 (fn cb [name] (.. "https://codeberg.org/" name))
     10 
     11 ;; fnlfmt: skip
     12 (fn setup-plugins []
     13   (local blink (require :config.blink))
     14   (local lsp (require :config.lsp))
     15   (local treesitter (require :config.treesitter))
     16   (local meepo (require :config.meepo))
     17 
     18   (vim.pack.add
     19      [(gh :nvim-mini/mini.nvim)
     20      (gh :nvim-orgmode/orgmode)
     21      (gh :stevearc/oil.nvim)
     22      (gh :neogitorg/neogit)
     23      (gh :sindrets/diffview.nvim)
     24      (gh :ibhagwan/fzf-lua)
     25      (gh :troydm/zoomwintab.vim)
     26      (gh :L3MON4D3/LuaSnip)
     27      {:src (gh :neovim/nvim-lspconfig) :version :master}
     28      {:src (gh :saghen/blink.cmp) :version (vim.version.range "^1")}]
     29     {:load true})
     30 
     31   ((. meepo :config))
     32   ((. (require :mini.comment) :setup))
     33   ((. (require :mini.surround) :setup))
     34   ((. (require :mini.pairs) :setup))
     35   ((. (require :oil) :setup) {:default_file_explorer false})
     36   ((. (require :orgmode) :setup)
     37    {:org_agenda_files ["~/.nb/notes/**/*.org" "~/.nb/work/**/*.org"]
     38     :org_default_notes_file "~/.nb/notes/refile.org"})
     39   ((. (require :neogit) :setup))
     40   ((. (require :fzf-lua) :setup))
     41   ((. (require :diffview) :setup)
     42    {:diff_binaries false
     43     :enhanced_diff_hl false
     44     :git_cmd [:git]
     45     :use_icons false
     46     :show_help_hints false
     47     :watch_index true})
     48   (: blink :config)
     49   (: lsp :config)
     50   (treesitter.config))
     51 
     52 (fn init []
     53   (let [vimrc (.. (vim.fn.stdpath :config) :/init_.vim)
     54         vim-dir (.. (vim.fn.expand "~") :/.vim/)]
     55     (pcall vim.cmd.source vimrc)
     56     (each [_ dir (ipairs [:backup :swap :undo])]
     57       (let [path (.. vim-dir dir)]
     58         (when (= (vim.fn.isdirectory path) 0)
     59           (vim.fn.mkdir path :p))))
     60     (set vim.opt.backupdir (.. vim-dir :backup//))
     61     (set vim.opt.directory (.. vim-dir :swap//))
     62     (set vim.opt.undodir (.. vim-dir :undo//))
     63     (set vim.opt.undofile true))
     64   (set vim.opt.clipboard :unnamedplus)
     65   (vim.opt.rtp:append (.. (vim.fn.stdpath :data) :/nix/tree-sitter))
     66   (set package.path (.. (fs.normalize "~") "/.config/nvim/lua/?.lua;"
     67                         package.path))
     68   (setup-plugins)
     69   (each [_ module (ipairs [:keymaps :functions])]
     70     (require module)))
     71 
     72 (init)