add files
This commit is contained in:
11
.editorconfig
Normal file
11
.editorconfig
Normal file
@@ -0,0 +1,11 @@
|
||||
[*]
|
||||
charset = UTF-8
|
||||
end_of_line = LF
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
indent_style = tab
|
||||
indent_size = tab
|
||||
|
||||
[*.lua]
|
||||
indent_style = tab
|
||||
indent_size = tab
|
||||
0
autocmds.lua
Normal file
0
autocmds.lua
Normal file
15
init.lua
Normal file
15
init.lua
Normal file
@@ -0,0 +1,15 @@
|
||||
vim.g.mapleader = ' '
|
||||
vim.g.maplocalleader = ' '
|
||||
|
||||
Autocmd = vim.api.nvim_create_autocmd
|
||||
Map = vim.keymap.set
|
||||
|
||||
-- set up the general configurations
|
||||
require('opts')
|
||||
require('maps')
|
||||
require('autocmds')
|
||||
require('plug')
|
||||
|
||||
-- set up the plugins correctly
|
||||
-- first, set up our colourscheme
|
||||
vim.cmd('colorscheme gruvbox')
|
||||
46
maps.lua
Normal file
46
maps.lua
Normal file
@@ -0,0 +1,46 @@
|
||||
-- unmap arrow keys in non-insert modes
|
||||
Map({ 'n', 'v' }, '<up>', '<nop>')
|
||||
Map({ 'n', 'v' }, '<down>', '<nop>')
|
||||
Map({ 'n', 'v' }, '<left>', '<nop>')
|
||||
Map({ 'n', 'v' }, '<right>', '<nop>')
|
||||
|
||||
-- tab management / navigation
|
||||
Map('n', '<c-t>', '<cmd>enew<cr>', { desc = 'create a new tab' })
|
||||
|
||||
-- for help exiting certain modes
|
||||
Map({ 'n', 'i' }, '<esc>', '<cmd>nohlsearch<cr><esc>', { desc = 'cancel search highlighting and escape' })
|
||||
Map('t', '<c-esc>', '<c-\\><c-n>', { desc = 'exit terminal mode' })
|
||||
|
||||
-- window management
|
||||
Map('n', '<m-s>', '<cmd>wincmd s<cr>', { desc = 'horizontal split' })
|
||||
Map('n', '<m-v>', '<cmd>wincmd v<cr>', { desc = 'vertical split' })
|
||||
Map('n', '<c-h>', '<cmd>wincmd h<cr>', { desc = 'move focus to the left window' })
|
||||
Map('n', '<c-l>', '<cmd>wincmd l<cr>', { desc = 'move focus to the right window' })
|
||||
Map('n', '<c-j>', '<cmd>wincmd j<cr>', { desc = 'move focus to the lower window' })
|
||||
Map('n', '<c-k>', '<cmd>wincmd k<cr>', { desc = 'move focus to the upper window' })
|
||||
Map('n', '<m-H>', '<cmd>wincmd H<cr>', { desc = 'move window to left' })
|
||||
Map('n', '<m-L>', '<cmd>wincmd L<cr>', { desc = 'move window to right' })
|
||||
Map('n', '<m-K>', '<cmd>wincmd K<cr>', { desc = 'move window to top' })
|
||||
Map('n', '<m-J>', '<cmd>wincmd J<cr>', { desc = 'move window to bottom' })
|
||||
|
||||
-- diagnostic / lsp key bindings
|
||||
Map('n', 'K', vim.lsp.buf.hover, { desc = 'symbol hover' })
|
||||
Map('n', '<F2>', vim.lsp.buf.rename, { desc = 'rename symbol' })
|
||||
Map('n', '<leader>lm', vim.diagnostic.open_float, { desc = 'view line\'s diagnostic messages' })
|
||||
Map('n', '<leader>q', vim.lsp.buf.code_action, { desc = 'view quickfix list' })
|
||||
|
||||
-- smart tabulation
|
||||
Map('i', '<tab>', function()
|
||||
local _, col = unpack(vim.api.nvim_win_get_cursor(0)) -- get cursor position
|
||||
local isindent = vim.api.nvim_get_current_line():sub(1, col):match('^%s*$')
|
||||
local tabexpnd = vim.bo.expandtab
|
||||
local tabwidth = vim.bo.shiftwidth > 0 and vim.bo.shiftwidth or vim.bo.tabstop
|
||||
|
||||
if not tabexpnd and isindent then
|
||||
return '\t'
|
||||
else
|
||||
local spaces = tabwidth - col % tabwidth
|
||||
return string.rep(' ', spaces == 0 and tabwidth or spaces)
|
||||
end
|
||||
end, { expr = true, desc = "smart tabulation" })
|
||||
|
||||
61
opts.lua
Normal file
61
opts.lua
Normal file
@@ -0,0 +1,61 @@
|
||||
local o = vim.opt
|
||||
|
||||
-- TODO: get rid of default options I set for "explicitness"
|
||||
|
||||
-- set options
|
||||
o.clipboard = "unnamedplus" -- keep the clipboard in sync with the one provided by the OS
|
||||
o.termguicolors = true -- allows for colour in the terminal
|
||||
o.number = true -- show line numbers
|
||||
o.cursorline = true -- highlight the current line
|
||||
o.cursorcolumn = false -- highlight the current column
|
||||
o.dir = vim.fn.stdpath('cache') .. '/swp' -- swap directory location for recovery
|
||||
o.sessionoptions = 'buffers,curdir,folds,help,localoptions,tabpages,terminal'
|
||||
o.expandtab = false -- whether tabs are expanded to spaces (overridden by .editorconfig)
|
||||
o.diffopt = 'internal,filler,closeoff,linematch:60' -- diff visualisation
|
||||
o.foldenable = true -- whether folding is enabled
|
||||
o.wrap = false -- whether to wrap text to a new line when it goes off-screen
|
||||
o.breakindent = true -- wrapped lines start at the same location as the start of the line
|
||||
o.list = true -- shows invisible characters
|
||||
o.listchars = { -- whitespace characters
|
||||
eol = nil,
|
||||
trail = '~',
|
||||
extends = nil,
|
||||
precedes = '<',
|
||||
tab = '•-',
|
||||
space = '·',
|
||||
nbsp = '␣',
|
||||
}
|
||||
o.mouse = 'nv' -- which modes the mouse is enabled in 'a:all'
|
||||
o.relativenumber = true -- whether line numbers are relative to the cursor
|
||||
o.scrolloff = 10 -- minimal number of screen lines to keep above and below the cursor
|
||||
o.showtabline = 2 -- whether to show the tab line
|
||||
o.signcolumn = 'yes' -- always show the signcolumn, otherwise it shifts text all the time
|
||||
o.tabstop = 8 -- visual spaces per tab
|
||||
o.softtabstop = 8 -- spaces inserted per tab in insert mode
|
||||
o.shiftwidth = 8 -- spaces for auto-indent
|
||||
o.smartindent = true -- behave a bit more nuanced with when to indent
|
||||
o.ignorecase = true -- whether case should be ignored whilst searching
|
||||
o.smartcase = true -- overrides the above option if contains capital letters
|
||||
o.inccommand = 'split' -- split|nosplit whether substitutions should appear whilst typing.
|
||||
o.splitbelow = true -- force all horizontal splits below the current window
|
||||
o.splitright = true -- force all vertical splits to the right of this window
|
||||
o.showmode = false -- don't show mode as this is already in the status line
|
||||
o.undodir = vim.fn.stdpath('cache') .. '/undo' -- directory for undo files
|
||||
o.undofile = true -- for saving the undo history
|
||||
o.undolevels = 1024 -- the amount of changes that can be undone
|
||||
o.timeoutlen = 300 -- number of MS to wait for a mapped sequence to complete
|
||||
o.ttimeoutlen = 0 -- number of MS to wait for a key sequence to complete
|
||||
o.updatetime = 250 -- number of MS of nothing typed to write a swap file to disk.
|
||||
o.spell = true -- whether spell checking is enabled
|
||||
o.spelllang = 'en_gb,nl' -- set the spell languages
|
||||
o.spellfile = vim.fn.stdpath('config') .. '/spell/user.utf-8.add'
|
||||
|
||||
vim.diagnostic.config({
|
||||
underline = true, -- use underline for diagnostics
|
||||
virtual_text = true, -- shows diagnostics at the end of the line
|
||||
virtual_lines = false, -- shows one diagnostic per line
|
||||
severity_sort = true, -- sort diagnostics by severity
|
||||
update_in_insert = true, -- update diagnostics whilst in insert mode
|
||||
float = true, -- options for floating windows
|
||||
signs = true,
|
||||
})
|
||||
99
plug.lua
Normal file
99
plug.lua
Normal file
@@ -0,0 +1,99 @@
|
||||
-- Clone 'mini.nvim' manually in a way that it gets managed by 'mini.deps'
|
||||
local path_package = vim.fn.stdpath('data') .. '/site/'
|
||||
local mini_path = path_package .. 'pack/deps/start/mini.nvim'
|
||||
if not (vim.uv or vim.loop).fs_stat(mini_path) then
|
||||
vim.cmd('echo "Installing [`mini.nvim`](../doc/mini-nvim.qmd#mini.nvim)" | redraw')
|
||||
local clone_cmd = {
|
||||
'git', 'clone', '--filter=blob:none',
|
||||
'https://github.com/nvim-mini/mini.nvim', mini_path
|
||||
}
|
||||
vim.fn.system(clone_cmd)
|
||||
vim.cmd('packadd mini.nvim | helptags ALL')
|
||||
vim.cmd('echo "Installed [`mini.nvim`](../doc/mini-nvim.qmd#mini.nvim)" | redraw')
|
||||
end
|
||||
|
||||
-- Set up Mini stuff
|
||||
require('mini.ai').setup() -- enhances the use of a/i textobjects
|
||||
require('mini.align').setup() -- utility to align text in various ways
|
||||
require('mini.comment').setup() -- for toggling comments inline
|
||||
require('mini.completion').setup() -- for providing autocompletion results TODO: not up-to-par for my normal things
|
||||
require('mini.move').setup() -- moving lines
|
||||
require('mini.operators').setup() -- duplicating lines and evaluating equations inline
|
||||
require('mini.pairs').setup() -- automatic closing pairs
|
||||
require('mini.surround').setup() -- surround stuff
|
||||
require('mini.clue').setup() -- shows available keybinds when performing keybind actions
|
||||
require('mini.diff').setup() -- shows git diffs in the file
|
||||
require('mini.files').setup({ -- file browser
|
||||
-- TODO: customise with some sensible keybindings
|
||||
})
|
||||
require('mini.jump').setup() -- extends f,F,t,T to work across multiple lines
|
||||
require('mini.pick').setup() -- picker/browser for various occasions TODO: research to potentially replace telescope.
|
||||
require('mini.sessions').setup() -- for loading / creating sessions TODO: replace the AWFUL session management I keep bickering with with this, (I hope).
|
||||
require('mini.cursorword').setup() -- highlight words beneath the cursor WARN: conflicts with the folke word thingie
|
||||
require('mini.hipatterns').setup({
|
||||
-- TODO: look into replacing folke todo comments with this
|
||||
})
|
||||
require('mini.icons').setup()
|
||||
require('mini.indentscope').setup({ -- shows our current indent level
|
||||
draw = {
|
||||
delay = 50,
|
||||
animation = require('mini.indentscope').gen_animation.none(),
|
||||
}
|
||||
})
|
||||
require('mini.notify').setup() -- has more noticeable / utilitarian / aesthetically pleasing notifications
|
||||
require('mini.statusline').setup({
|
||||
content = {
|
||||
-- TODO: I still want the all-caps modal things, and likely farther customisations.
|
||||
active = function()
|
||||
local mode, mode_hl = MiniStatusline.section_mode({ trunc_width = 120 })
|
||||
local git = MiniStatusline.section_git({ trunc_width = 40 })
|
||||
local diff = MiniStatusline.section_diff({ trunc_width = 75 })
|
||||
local diagnostics = MiniStatusline.section_diagnostics({ trunc_width = 75 })
|
||||
local lsp = MiniStatusline.section_lsp({ trunc_width = 75 })
|
||||
local filename = MiniStatusline.section_filename({ trunc_width = 140 })
|
||||
local fileinfo = MiniStatusline.section_fileinfo({ trunc_width = 120 })
|
||||
|
||||
return MiniStatusline.combine_groups({
|
||||
{ hl = mode_hl, strings = { mode } },
|
||||
{ hl = 'MiniStatuslineDevinfo', strings = { git, diff, diagnostics, lsp } },
|
||||
'%<', -- general truncation point
|
||||
{ hl = 'MiniStatuslineFilename', strings = { filename } },
|
||||
'%=', -- align right
|
||||
{ hl = 'MiniStatuslineFileInfo', strings = { fileinfo } },
|
||||
{ hl = mode_hl, strings = { '%3l:%-3c' } }
|
||||
})
|
||||
end,
|
||||
inactive = function()
|
||||
return MiniStatusline.combine_groups({ -- TODO: what the heck is happening here?
|
||||
{},
|
||||
})
|
||||
end
|
||||
},
|
||||
use_icons = true,
|
||||
set_vim_settings = true,
|
||||
})
|
||||
|
||||
require('mini.deps').setup({ path = { package = path_package } })
|
||||
|
||||
-- import the plugins that we'll be using
|
||||
local add = MiniDeps.add
|
||||
add({ source = 'https://github.com/rmagatti/auto-session' })
|
||||
add({ source = 'https://github.com/windwp/nvim-autopairs' })
|
||||
add({ source = 'https://github.com/saghen/blink.cmp' })
|
||||
add({ source = 'https://github.com/akinsho/bufferline.nvim', depends = { 'https://github.com/nvim-tree/nvim-web-devicons' } })
|
||||
add({ source = 'https://github.com/stevearc/conform.nvim' })
|
||||
add({ source = 'https://github.com/lewis6991/gitsigns.nvim' })
|
||||
add({ source = 'https://github.com/ellisonleao/gruvbox.nvim' })
|
||||
add({ source = 'https://github.com/folke/lazydev.nvim' })
|
||||
add({ source = 'https://github.com/lmburns/lf.nvim', depends = { 'https://github.com/akinsho/toggleterm.nvim' } })
|
||||
add({ source = 'https://github.com/ray-x/lsp_signature.nvim' })
|
||||
add({ source = 'https://github.com/neovim/nvim-lspconfig' })
|
||||
add({ source = 'https://github.com/L3MON4D3/LuaSnip' })
|
||||
add({ source = 'https://github.com/mfussenegger/nvim-lint' })
|
||||
add({ source = 'https://github.com/nvim-treesitter/nvim-treesitter' })
|
||||
add({ source = 'https://github.com/MeanderingProgrammer/render-markdown.nvim', depends = { 'https://github.com/nvim-tree/nvim-web-devicons' } })
|
||||
add({ source = 'https://github.com/folke/snacks.nvim', depends = { 'https://github.com/nvim-tree/nvim-web-devicons' } })
|
||||
add({ source = 'https://github.com/nvim-telescope/telescope.nvim', depends = { 'https://github.com/nvim-lua/plenary.nvim' } })
|
||||
add({ source = 'https://github.com/folke/todo-comments.nvim', depends = { 'https://github.com/nvim-lua/plenary.nvim' } })
|
||||
add({ source = 'https://github.com/akinsho/toggleterm.nvim' })
|
||||
add({ source = 'https://github.com/folke/which-key.nvim' })
|
||||
Reference in New Issue
Block a user