diff --git a/nvim/.config/nvim/fnl/init.fnl b/nvim/.config/nvim/fnl/init.fnl deleted file mode 100644 index f3099c2..0000000 --- a/nvim/.config/nvim/fnl/init.fnl +++ /dev/null @@ -1,14 +0,0 @@ -(module init - {require {a aniseed.core - nvim aniseed.nvim}}) - -;; Load all modules in no particular order -(let [config-path (nvim.fn.stdpath "config") - module-glob (.. config-path "/fnl/modules/**/*.fnl")] - (each [_ path (ipairs (vim.fn.glob module-glob true true true))] - (-> path - (string.gsub (.. config-path "/fnl/") "") - (string.gsub "/" ".") - (string.gsub ".fnl" "") - (string.gsub "fnl" "lua") - (require)))) diff --git a/nvim/.config/nvim/fnl/modules/keybinds.fnl b/nvim/.config/nvim/fnl/modules/keybinds.fnl deleted file mode 100644 index 2f33f04..0000000 --- a/nvim/.config/nvim/fnl/modules/keybinds.fnl +++ /dev/null @@ -1,45 +0,0 @@ -(module modules.keybinds - {require {nvim aniseed.nvim - utils utils - wk which-key}}) - -(defn cmd [s desc] - [(.. "" s "") desc]) - -(nvim.command "let g:mapleader = \"\\\"") - -(utils.keymap :i "" "compe#complete()" {:expr true}) -(utils.keymap :i "" "compe#close('')" {:expr true}) - -(utils.keymap :i :kj "") - -(utils.keymap :v "<" "" ">gv") - -(utils.keymap :n "" "h") -(utils.keymap :n "" "j") -(utils.keymap :n "" "k") -(utils.keymap :n "" "l") - -(wk.setup {}) -(wk.register - {"" (cmd "Telescope find_files" "find file") - :r (cmd "Telescope live_grep" "ripgrep") - :b (cmd "Telescope buffers" "select buffer") - :s (cmd "w" "save file") - ":" (cmd "Telescope commands" "search commands") - - :t {:name "+toggle" - :i (cmd "IndentGuidesToggle" "indent guides") - :r (cmd "RainbowParentheses!!" "rainbow parens") - :g (cmd "Goyo" "goyo") - :l (cmd "Limelight!!" "limelight")} - - :l {:name "+lsp" - :a (cmd "Lspsaga code_action" "code actions") - :d (cmd "Lspsaga hover_doc" "show docs") - :f (cmd "Lspsaga lsp_finder" "finder") - :r (cmd "Lspsaga rename" "rename") - :g [vim.lsp.buf.definition "go to definition"]}} - - {:prefix ""}) diff --git a/nvim/.config/nvim/fnl/modules/looks.fnl b/nvim/.config/nvim/fnl/modules/looks.fnl deleted file mode 100644 index 1446941..0000000 --- a/nvim/.config/nvim/fnl/modules/looks.fnl +++ /dev/null @@ -1,45 +0,0 @@ -(module modules.looks - {require {nvim aniseed.nvim - utils utils}}) - -(def colors - {:primary - {:background "#fdf6e3" - :foreground "#586e75"} - - :normal - {:black "#07e642" - :red "#dc322f" - :green "#859900" - :yellow "#b58900" - :blue "#268bd2" - :magenta "#d33682" - :cyan "#2aa198" - :white "#eee8d5"} - - :bright - {:black "#002b36" - :red "#cb4b16" - :green "#586e75" - :yellow "#657b83" - :blue "#839496" - :magenta "#6c71c4" - :cyan "#93a1a1" - :white "#fdf6e3"}}) - -(set nvim.o.termguicolors true) -(set nvim.o.background "light") -(set nvim.g.lightline {:colorscheme "solarized"}) -(set nvim.o.fillchars (.. nvim.o.fillchars "vert:│")) - -(nvim.command "colorscheme NeoSolarized") -(utils.highlight "Comment" {:gui "italic"}) - -(utils.highlight "ExtraWhitespace" {:bg colors.normal.red}) -(nvim.command "match ExtraWhitespace /\\s\\+$/") - -(utils.highlight - ["LineNr" - "SignColumn" - "VertSplits"] - {:bg colors.primary.background}) diff --git a/nvim/.config/nvim/fnl/modules/lsp.fnl b/nvim/.config/nvim/fnl/modules/lsp.fnl deleted file mode 100644 index 0a319b8..0000000 --- a/nvim/.config/nvim/fnl/modules/lsp.fnl +++ /dev/null @@ -1,35 +0,0 @@ -(module modules.lsp - {require {a aniseed.core - lsp lspconfig - lsp_signature lsp_signature - rust-tools rust-tools - utils utils}}) - -(fn on_attach [client bufnr] - (lsp_signature.on_attach) - (if client.resolved_capabilities.document_highlight - (do - (utils.highlight "LspReferenceRead" {:gui "underline"}) - (utils.highlight "LspReferenceText" {:gui "underline"}) - (utils.highlight "LspReferenceWrite" {:gui "underline"})))) - -(fn init-lsp [lsp-name ?opts] - "Initialize a language server" - (let [merged-opts (a.merge {:on_attach on_attach} (or ?opts {}))] - ((. lsp lsp-name :setup) merged-opts))) - -;; Rust extra caps -(let [caps (vim.lsp.protocol.make_client_capabilities)] - (set caps.textDocument.completion.completionItem.snippetSupport true) - (set caps.textDocument.completion.completionItem.resolveSupport - {:properties ["documentation" "detail" "additionalTextEdits"]}) - (lsp.rust_analyzer.setup - {:capabilities caps - :on_attach (fn [...] - (on_attach ...))})) - ;; TODO: fix - ;(rust-tools.setup - ; {:tools {:inlay_hints {:show_parameter_hints false}}}))})) - -(init-lsp :clangd) -(init-lsp :vimls) diff --git a/nvim/.config/nvim/fnl/modules/options.fnl b/nvim/.config/nvim/fnl/modules/options.fnl deleted file mode 100644 index 6c09f1e..0000000 --- a/nvim/.config/nvim/fnl/modules/options.fnl +++ /dev/null @@ -1,45 +0,0 @@ -(module modules.options - {require {nvim aniseed.nvim}}) - -(set nvim.o.mouse "a") -(set nvim.o.undodir (.. nvim.env.XDG_CACHE_HOME "/vim-undodir")) -(set nvim.o.undofile true) -(set nvim.o.shortmess (.. nvim.o.shortmess "c")) -(set nvim.o.hidden true) -(set nvim.o.encoding "utf-8") -(set nvim.o.hlsearch true) -(set nvim.o.incsearch true) -(set nvim.o.inccommand "nosplit") -(set nvim.o.ignorecase true) -(set nvim.o.smartcase true) -(set nvim.o.completeopt "menuone,noselect") -(set nvim.o.laststatus 2) -(set nvim.o.lazyredraw true) -(set nvim.o.splitbelow true) -(set nvim.o.splitright true) -(set nvim.o.matchtime 2) -(set nvim.o.showmatch true) -(set nvim.o.wrap false) -(set nvim.o.writebackup false) -(set nvim.o.showmode false) -(set nvim.o.updatetime 250) -(set nvim.o.signcolumn "yes") -(set nvim.o.shiftwidth 4) -(set nvim.o.tabstop 4) -(set nvim.o.backspace "indent,eol,start") -(set nvim.o.shiftround true) -(set nvim.o.autoindent true) -(set nvim.o.smartindent true) -(set nvim.o.expandtab true) - -(set nvim.wo.colorcolumn "+1") -(set nvim.wo.cursorline true) -(set nvim.wo.signcolumn "yes") - -(defn make-wiki [name] - {:path (.. "~/docs/wiki/" name "/")}) - -(tset vim.g "vimwiki_list" [(make-wiki "private") - (make-wiki "veil")]) - -;(nvim.command "autocmd FileType * setlocal formatoptions-=cro") diff --git a/nvim/.config/nvim/fnl/modules/plugins/compe.fnl b/nvim/.config/nvim/fnl/modules/plugins/compe.fnl deleted file mode 100644 index e163f59..0000000 --- a/nvim/.config/nvim/fnl/modules/plugins/compe.fnl +++ /dev/null @@ -1,16 +0,0 @@ -(module modules.plugins.compe - {require {compe compe}}) - -(compe.setup - {:enabled true - :autocomplete true - :debug false - :min_length 2 - :preselect "enable" - :documentation true - :source {:path true - :buffer true - :calc true - :nvim_lsp true - :nvim_lua true - :conjure true}}) diff --git a/nvim/.config/nvim/fnl/modules/plugins/gitsigns.fnl b/nvim/.config/nvim/fnl/modules/plugins/gitsigns.fnl deleted file mode 100644 index c405c4d..0000000 --- a/nvim/.config/nvim/fnl/modules/plugins/gitsigns.fnl +++ /dev/null @@ -1,4 +0,0 @@ -(module modules.plugins.singify - {require {gitsigns gitsigns}}) - -(gitsigns.setup) diff --git a/nvim/.config/nvim/fnl/modules/plugins/lspsaga.fnl b/nvim/.config/nvim/fnl/modules/plugins/lspsaga.fnl deleted file mode 100644 index 42f3494..0000000 --- a/nvim/.config/nvim/fnl/modules/plugins/lspsaga.fnl +++ /dev/null @@ -1,10 +0,0 @@ -(module modules.plugins.lspsaga - {require {saga lspsaga}}) - -(saga.init_lsp_saga - {:border_style "round" - :finder_action_keys - {:open "" - :vsplit :v - :split :s - :quit :q}}) diff --git a/nvim/.config/nvim/fnl/modules/plugins/telescope.fnl b/nvim/.config/nvim/fnl/modules/plugins/telescope.fnl deleted file mode 100644 index d16ccbf..0000000 --- a/nvim/.config/nvim/fnl/modules/plugins/telescope.fnl +++ /dev/null @@ -1,8 +0,0 @@ -(module modules.plugins.telescope - {require {actions telescope.actions - telescope telescope}}) - -(telescope.setup - {:defaults - {:mappings - {:i {"" actions.close}}}}) diff --git a/nvim/.config/nvim/fnl/utils.fnl b/nvim/.config/nvim/fnl/utils.fnl deleted file mode 100644 index fb6fd39..0000000 --- a/nvim/.config/nvim/fnl/utils.fnl +++ /dev/null @@ -1,31 +0,0 @@ -(module utils - {require {a aniseed.core - nvim aniseed.nvim}}) - -(defn contains? [list elem] - (or (a.some #(= elem $1) list)) false) - -(defn filter-table [f t] - (collect [k v (pairs t)] - (when (f k v) - (values k v)))) - -(defn without-keys [keys t] - (filter-table #(not (contains? keys $1)) t)) - -(defn keymap [mode from to ?opts] - "Set a mapping in the given mode, and some optional parameters, defaulting to {:noremap true :silent true}. - If :buffer is set, uses buf_set_keymap rather than set_keymap" - (local full-opts - (->> (or ?opts {}) - (a.merge {:noremap true :silent true}) - (without-keys [:buffer]))) - (if (and ?opts (?. ?opts :buffer)) - (nvim.buf_set_keymap 0 mode from to full-opts) - (nvim.set_keymap mode from to full-opts))) - -(defn highlight [groups colset] - (let [groups (if (a.string? groups) [groups] groups) - opts (a.merge {:fg "NONE" :bg "NONE" :gui "NONE"} colset)] - (each [_ group (ipairs groups)] - (nvim.command (.. "hi!" group " guifg='" opts.fg "' guibg='" opts.bg "' gui='" opts.gui "'"))))) diff --git a/nvim/.config/nvim/init.lua b/nvim/.config/nvim/init.lua index 82041a0..7bae859 100644 --- a/nvim/.config/nvim/init.lua +++ b/nvim/.config/nvim/init.lua @@ -1,92 +1,6 @@ -local exec = vim.api.nvim_command -local fn = vim.fn +require 'keybinds' +require 'options' -local install_path = fn.stdpath('data')..'/site/pack/packer/opt/packer.nvim' - -if fn.empty(fn.glob(install_path)) > 0 then - fn.system({'git', 'clone', 'https://github.com/wbthomason/packer.nvim', install_path}) -end - -exec 'packadd packer.nvim' - -require('packer').startup(function () - use 'wbthomason/packer.nvim' - - use 'Olical/aniseed' - use 'norcalli/nvim.lua' - - -- TODO: fix auto "noet sw=2" - -- TODO: setup treesitter - -- TODO: look into diffview - -- TODO: look into iamcco/markdown-preview.nvim - -- TODO: look into vsnip (enable for compe) - use 'alisdair/vim-armasm' - use 'ap/vim-css-color' - use 'arrufat/vala.vim' - use 'editorconfig/editorconfig-vim' - use 'folke/lsp-trouble.nvim' - use 'folke/which-key.nvim' - use 'gentoo/gentoo-syntax' - use 'github/copilot.vim' - use 'godlygeek/tabular' - use 'hrsh7th/nvim-compe' - use 'itchyny/lightline.vim' - use 'jiangmiao/auto-pairs' - use 'junegunn/goyo.vim' - use 'junegunn/limelight.vim' - use 'junegunn/rainbow_parentheses.vim' - use 'junegunn/vim-slash' - use 'justinmk/vim-sneak' - use 'nathanaelkane/vim-indent-guides' - use 'neovim/nvim-lspconfig' - use 'overcache/NeoSolarized' - use 'psliwka/vim-smoothie' - use 'ray-x/lsp_signature.nvim' - use 'roryokane/detectindent' - use 'rust-lang/rust.vim' - use 'simrat39/rust-tools.nvim' - use 'tami5/lspsaga.nvim' - use 'tommcdo/vim-exchange' - use 'tpope/vim-abolish' - use 'tpope/vim-fugitive' - use 'tpope/vim-repeat' - use 'tpope/vim-surround' - use 'vmchale/ats-vim' - use 'wellle/targets.vim' - - use { - 'Olical/conjure', - requires = { - 'tami5/compe-conjure' - }, - - config = "vim.g['conjure#client#fennel#aniseed#aniseed_module_prefix'] = 'aniseed.'", - } - - use { - 'eraserhd/parinfer-rust', - run = 'cargo build --release' - } - - use { - 'lewis6991/gitsigns.nvim', - requires = { - 'nvim-lua/plenary.nvim', - }, - } - - use { - 'nvim-telescope/telescope.nvim', - requires = { - 'nvim-lua/plenary.nvim', - 'nvim-lua/popup.nvim', - }, - } - - use { - 'vimwiki/vimwiki', - branch = 'dev', - } -end) - -vim.g['aniseed#env'] = true +vim.defer_fn(function() + require 'plugins' +end, 0) diff --git a/nvim/.config/nvim/lua/keybinds.lua b/nvim/.config/nvim/lua/keybinds.lua new file mode 100644 index 0000000..755002e --- /dev/null +++ b/nvim/.config/nvim/lua/keybinds.lua @@ -0,0 +1,20 @@ +vim.g.mapleader = ' ' + +vim.keymap.set('i', 'kj', '') + +-- better defaults for indenting +vim.keymap.set('v', '<', '', '>gv') + +-- telescope +--[[ +vim.keymap.set('n', 'f', 'Telescope find_files') +vim.keymap.set('n', 'r', 'Telescope live_grep') +--]] + +-- lsp +vim.keymap.set('n', 'lr', 'Lspsaga rename', { silent = true }) +--vim.keymap.set('n', 'lg', 'Lspsaga ', { silent = true }) + +-- misc +vim.keymap.set('n', 's', 'w', { silent = true }) diff --git a/nvim/.config/nvim/lua/options.lua b/nvim/.config/nvim/lua/options.lua new file mode 100644 index 0000000..ced3098 --- /dev/null +++ b/nvim/.config/nvim/lua/options.lua @@ -0,0 +1,44 @@ +local function opts(os) + for k,v in pairs(os) do + vim.opt[k] = v + end +end + +opts { + termguicolors = true, + background = 'light', + + undodir = vim.env['XDG_CACHE_HOME'] .. '/vim-undodir', + undofile = true, + + encoding = 'utf-8', + hidden = true, + mouse = 'a', + hlsearch = true, + incsearch = true, + inccommand = 'nosplit', + ignorecase = true, + smartcase = true, + laststatus = 2, + lazyredraw = true, + splitbelow = true, + splitright = true, + matchtime = 2, + showmatch = true, + wrap = false, + writebackup = false, + swapfile = false, + showmode = false, + updatetime = 250, + signcolumn = 'yes', + shiftwidth = 4, + tabstop = 4, + shiftround = true, + autoindent = true, + smartindent = true, + expandtab = true, + + colorcolumn = '+1', + cursorline = true, + signcolumn = 'yes', +} diff --git a/nvim/.config/nvim/lua/plugins.lua b/nvim/.config/nvim/lua/plugins.lua new file mode 100644 index 0000000..e84eec4 --- /dev/null +++ b/nvim/.config/nvim/lua/plugins.lua @@ -0,0 +1,61 @@ +local fn = vim.fn +local install_path = fn.stdpath('data')..'/site/pack/packer/start/packer.nvim' +if fn.empty(fn.glob(install_path)) > 0 then + packer_bootstrap = fn.system({'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path}) +end + +return require('packer').startup(function() + use 'wbthomason/packer.nvim' + + use 'neovim/nvim-lspconfig' -- TODO: config? + + use { -- TODO: config + 'hrsh7th/nvim-cmp', + requires = { + 'hrsh7th/cmp-nvim-lsp', + }, + } + + use { + 'nvim-treesitter/nvim-treesitter', + run = ':TSUpdate', + requires = { + -- TODO :ts text-objects? + }, + config = function() + -- TODO: config + end, + } + + use { + 'nvim-telescope/telescope.nvim', + requires = { + 'nvim-lua/plenary.nvim', + 'nvim-lua/popup.nvim', + }, + } + + use { + 'overcache/NeoSolarized', + config = function() + + end, + } + + -- TODO: latex? + + -- TODO: vim-slash replacement + use 'editorconfig/editorconfig-vim' + --use 'folke/lsp-trouble.nvim' + use 'itchyny/lightline.vim' -- TODO: look into alternatives + --use 'roryokane/detectindent' + use 'tpope/vim-fugitive' + use 'tpope/vim-repeat' + -- vim surround? + -- gitsigns? + -- telescope + + if packer_bootstrap then + require('packer').sync() + end +end)