dotfiles/nvim/.config/nvim/init.lua

32 lines
956 B
Lua
Raw Normal View History

-- many ideas for this config come from
nvim: Switch from vimL to lua setup Switched to a lua setup. Moved from `init.vim` to `init.lua`. Moved to a lua-based plugin manager (packer.nvim). Moved some plugins to neovim (i.e. lua) versions instead of vimL (notably fzf and indentLine). Enabled lsp, treesitter and similar plugins by default. Modularized plugins a little by invoking them in separate files. This should provide a base to build on, and allow me to more fully integrate lua into my workflow. More detailed changes follow: nvim: Replace completion-nvim with nvim-compe Replaced completion-nvim since compe comes with more things working out of the box (especially buffer completion and treesitter save me two plugin installations), and seems to be overall a bit better supported. It's fast, it works well, and I can add custom completion sources so that should be good enough for me. Changed around a couple of other things for lsp settings and treesitter, and moved the files around a bit. This is somewhat in preparation for a move to a lua-based configuration, since I have long wanted to make the switch. nvim: Add treesitter-enabled rainbow brackets Added rainbow brackets to the editor, using the treesitter AST detection. I am not sure yet if I will keep them, or if they confuse me more than they help by coloring *everything* *everywhere* and being a bit too much for my tired eyes. nvim: Add vim-terminator to enable repl style dev Added vim-terminator and included some basic keybindings. The plugin allows sending code over to a terminal window, or repl for those languages where it's enabled (python, R, bash somewhat). The basic workflow for me right now is: From e.g. a python file 1. Open a repl with <leader>rr 2. Send over code with 2a. <leader>rt sending (selected part or whole of) file over 2b. <leader>rd sending (selected part or whole of) delimited area over A delimited area in option 2b looks for certain patterns and sends everything up-to the next instance of that pattern. Currently, the enabled patterns are `In[n]:` with n being a number, emulating the way jupyter blocks are coded; and `^```` (three back-ticks at the beginning of a line), to enable sending code fences from (R)markdown files. Since it uses the filetype to determine which repl/interpreter to send code to, it is still a little unwieldy in markdown files (which in this editor get handled as `pandoc` filetype.) FIXME: There are two options going forward, either finding a way to correctly identify the interpreter without filetype (should be done in vim-terminator and seems inelegant) or correctly setting the filetype for code fences in (R)Markdown *only* (seems more feasible and may already be enabled in RMarkdown plugins for vim). nvim: Fix simultaneous opening alacritty and nvim When opening both (e.g. `alacritty -e nvim file`), neovim would open with the wrong size (usually way smaller than the resulting terminal size) and stay that way until you resized the terminal window. This simply sends a 'resize' kill command to vim whenever the user enters it to circumvent the bug until it's fixed. nvim: Simplify lua plugin setup, Add indentLine Added indent line plugin to show where and how indentations occur using neovims virtual text. Can be toggled with `:IndentBlanklineToggle`. Simplified lua setup a little by naming settings after intent instead of per plugin -- everything lsp-y now resides in `lsp.lua`, everything treesitter in `treesitter.lua`, everything indentation in its respective file. Should, as long as plugins don't get too many, be perhaps a little simpler to reason about. nvim: Switch to packer as plugin manager Switched to packer -- the plugins move to lua and so will I. Packer seems basically like `vim-plug` in a dress (which is awesome, since vim-plug is also awesome!) and it is extremely fast. So, no real complaints but still a little switch to get that little bit further away from vimscript. nvim: Add telescope plugin and configuration Added telescope as fzf replacement. Fzf served me well, but the configuration is somewhat difficult (not least owing to the fact it's written in vimscript), and telescope has a burgeoning ecosystem growing around it. I could basically drop-in replace all of my mappings and then some. Refined some options and changed some defaults and I am fairly happy for now. nvim: Switch to zettelkasten plugin over wiki.vim
2021-03-24 20:06:17 +00:00
-- https://github.com/elianiva/dotfiles/ - with much gratitude
local api = vim.api
api.nvim_exec('runtime abbrev.vim', false)
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({
"git", "clone", "--filter=blob:none",
"https://github.com/folke/lazy.nvim.git", "--branch=stable", -- latest stable release
lazypath
})
end
vim.opt.rtp:prepend(lazypath)
-- set our leader key to space since with hjkl, space is largely useless
-- needs to be set before lazy.nvim is loaded
vim.g.mapleader = " "
require('settings')
require('autocmds')
require("lazy").setup("plugins", {
defaults = { version = "*" },
performance = { rtp = { disabled_plugins = { "netrw", "netrwPlugin" } } }
})
require('look')
require('maps')
-- to include e.g. the spell dictionaries for vim
vim.opt.rtp:append(vim.fn.stdpath("data") .. "/site")