Nvim stuff
This commit is contained in:
parent
b440d44574
commit
052ebf3520
14 changed files with 130 additions and 344 deletions
|
@ -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))))
|
|
@ -1,45 +0,0 @@
|
|||
(module modules.keybinds
|
||||
{require {nvim aniseed.nvim
|
||||
utils utils
|
||||
wk which-key}})
|
||||
|
||||
(defn cmd [s desc]
|
||||
[(.. "<cmd>" s "<cr>") desc])
|
||||
|
||||
(nvim.command "let g:mapleader = \"\\<Space>\"")
|
||||
|
||||
(utils.keymap :i "<C-Space>" "compe#complete()" {:expr true})
|
||||
(utils.keymap :i "<Esc>" "compe#close('<Esc>')" {:expr true})
|
||||
|
||||
(utils.keymap :i :kj "<Esc>")
|
||||
|
||||
(utils.keymap :v "<" "<gv")
|
||||
(utils.keymap :v ">" ">gv")
|
||||
|
||||
(utils.keymap :n "<C-h>" "<C-w>h")
|
||||
(utils.keymap :n "<C-j>" "<C-w>j")
|
||||
(utils.keymap :n "<C-k>" "<C-w>k")
|
||||
(utils.keymap :n "<C-l>" "<C-w>l")
|
||||
|
||||
(wk.setup {})
|
||||
(wk.register
|
||||
{"<Space>" (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 "<Leader>"})
|
|
@ -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})
|
|
@ -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)
|
|
@ -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")
|
|
@ -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}})
|
|
@ -1,4 +0,0 @@
|
|||
(module modules.plugins.singify
|
||||
{require {gitsigns gitsigns}})
|
||||
|
||||
(gitsigns.setup)
|
|
@ -1,10 +0,0 @@
|
|||
(module modules.plugins.lspsaga
|
||||
{require {saga lspsaga}})
|
||||
|
||||
(saga.init_lsp_saga
|
||||
{:border_style "round"
|
||||
:finder_action_keys
|
||||
{:open "<Cr>"
|
||||
:vsplit :v
|
||||
:split :s
|
||||
:quit :q}})
|
|
@ -1,8 +0,0 @@
|
|||
(module modules.plugins.telescope
|
||||
{require {actions telescope.actions
|
||||
telescope telescope}})
|
||||
|
||||
(telescope.setup
|
||||
{:defaults
|
||||
{:mappings
|
||||
{:i {"<Esc>" actions.close}}}})
|
|
@ -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 "'")))))
|
|
@ -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)
|
||||
|
|
20
nvim/.config/nvim/lua/keybinds.lua
Normal file
20
nvim/.config/nvim/lua/keybinds.lua
Normal file
|
@ -0,0 +1,20 @@
|
|||
vim.g.mapleader = ' '
|
||||
|
||||
vim.keymap.set('i', 'kj', '<Esc>')
|
||||
|
||||
-- better defaults for indenting
|
||||
vim.keymap.set('v', '<', '<gv')
|
||||
vim.keymap.set('v', '>', '>gv')
|
||||
|
||||
-- telescope
|
||||
--[[
|
||||
vim.keymap.set('n', 'f', '<cmd>Telescope find_files<cr>')
|
||||
vim.keymap.set('n', 'r', '<cmd>Telescope live_grep<cr>')
|
||||
--]]
|
||||
|
||||
-- lsp
|
||||
vim.keymap.set('n', '<leader>lr', '<cmd>Lspsaga rename<cr>', { silent = true })
|
||||
--vim.keymap.set('n', '<leader>lg', '<cmd>Lspsaga <cr>', { silent = true })
|
||||
|
||||
-- misc
|
||||
vim.keymap.set('n', '<leader>s', '<cmd>w<cr>', { silent = true })
|
44
nvim/.config/nvim/lua/options.lua
Normal file
44
nvim/.config/nvim/lua/options.lua
Normal file
|
@ -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',
|
||||
}
|
61
nvim/.config/nvim/lua/plugins.lua
Normal file
61
nvim/.config/nvim/lua/plugins.lua
Normal file
|
@ -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)
|
Loading…
Reference in a new issue