aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRatakor <ratakor@disroot.org>2023-12-10 07:29:31 +0100
committerRatakor <ratakor@disroot.org>2023-12-10 07:29:31 +0100
commitf0be66522ac4e8d232fdf8d6537d026b9db210dd (patch)
treea71ef71f539b0657546fce2a0fc9a00ff014a67d
parent68ec6673717b3cbcf2bf69b04480c797004c82f9 (diff)
Move neovim config to lua with lazy.nvim
-rwxr-xr-x.local/bin/ex2
-rwxr-xr-x.local/bin/help2
-rw-r--r--.local/etc/nvim/.gitignore2
-rw-r--r--.local/etc/nvim/after/plugin/colors.lua143
-rw-r--r--.local/etc/nvim/after/plugin/lsp.lua (renamed from .local/etc/nvim/lsp.vim)36
-rw-r--r--.local/etc/nvim/after/plugin/misc.lua77
-rw-r--r--.local/etc/nvim/appearance.vim198
-rw-r--r--.local/etc/nvim/basics.vim48
-rw-r--r--.local/etc/nvim/header.vim151
-rw-r--r--.local/etc/nvim/init.lua37
-rw-r--r--.local/etc/nvim/init.vim130
-rw-r--r--.local/etc/nvim/lua/plugins/colorscheme.lua13
-rw-r--r--.local/etc/nvim/lua/plugins/lsp.lua32
-rw-r--r--.local/etc/nvim/lua/plugins/misc.lua62
-rw-r--r--.local/etc/nvim/lua/plugins/noice.lua40
-rw-r--r--.local/etc/nvim/lua/plugins/treesitter.lua47
-rw-r--r--.local/etc/nvim/lua/settings.lua83
-rw-r--r--.local/etc/vivid/filetypes.yml13
-rw-r--r--.local/etc/zsh/.zshrc10
19 files changed, 566 insertions, 560 deletions
diff --git a/.local/bin/ex b/.local/bin/ex
index c47f3c6..4a9b5eb 100755
--- a/.local/bin/ex
+++ b/.local/bin/ex
@@ -38,6 +38,6 @@ for file in "$@"; do
if [ -f "$file" ]; then
extract "$file"
else
- printf "%s is not a valid file\n" "$file"
+ printf "%s is not a valid file\n" "$file" 1>&2
fi
done
diff --git a/.local/bin/help b/.local/bin/help
new file mode 100755
index 0000000..e79c1a3
--- /dev/null
+++ b/.local/bin/help
@@ -0,0 +1,2 @@
+#!/bin/sh
+"$@" --help 2>&1 | bat -p -l help
diff --git a/.local/etc/nvim/.gitignore b/.local/etc/nvim/.gitignore
deleted file mode 100644
index 5c6f5fe..0000000
--- a/.local/etc/nvim/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-plugged/
-autoload/
diff --git a/.local/etc/nvim/after/plugin/colors.lua b/.local/etc/nvim/after/plugin/colors.lua
new file mode 100644
index 0000000..0ee09c6
--- /dev/null
+++ b/.local/etc/nvim/after/plugin/colors.lua
@@ -0,0 +1,143 @@
+local colors = require("gruvbox").palette
+
+vim.cmd("colorscheme gruvbox")
+
+require("hlargs").setup {
+ color = colors.neutral_orange,
+}
+
+require("scrollbar").setup({
+ marks = {
+ Search = { color = colors.neutral_orange },
+ Error = { color = colors.neutral_red },
+ Warn = { color = colors.neutral_yellow },
+ Info = { color = colors.neutral_pink },
+ Hint = { color = colors.neutral_cyan },
+ Misc = { color = colors.neutral_purple },
+ },
+ handlers = {
+ cursor = false,
+ handle = false,
+ },
+})
+
+local empty = require('lualine.component'):extend()
+function empty:draw(default_highlight)
+ self.status = ''
+ self.applied_separator = ''
+ self:apply_highlights(default_highlight)
+ self:apply_section_separators()
+ return self.status
+end
+
+-- Put proper separators and gaps between components in sections
+local function process_sections(sections)
+ for name, section in pairs(sections) do
+ local left = name:sub(9, 10) < 'x'
+ for pos = 1, name ~= 'lualine_z' and #section or #section - 1 do
+ table.insert(section, pos * 2, {
+ empty,
+ color = {
+ fg = colors.neutral_white,
+ bg = colors.neutral_white,
+ },
+ })
+ end
+ for id, comp in ipairs(section) do
+ if type(comp) ~= 'table' then
+ comp = { comp }
+ section[id] = comp
+ end
+ comp.separator = left and { right = '' } or { left = '' }
+ end
+ end
+ return sections
+end
+
+local function modified()
+ if vim.bo.modified then
+ return '+'
+ elseif vim.bo.modifiable == false or vim.bo.readonly == true then
+ return '-'
+ end
+ return ''
+end
+
+local transparent = require'lualine.themes.gruvbox'
+transparent.inactive.c.bg = 'nil'
+transparent.visual.c.bg = 'nil'
+transparent.replace.c.bg = 'nil'
+transparent.normal.c.bg = 'nil'
+transparent.insert.c.bg = 'nil'
+transparent.command.c.bg = 'nil'
+
+require('lualine').setup {
+ options = {
+ theme = transparent,
+ component_separators = '',
+ section_separators = { left = '', right = '' },
+ },
+ sections = process_sections {
+ lualine_a = {'mode'},
+ lualine_b = {
+ 'branch',
+ 'diff',
+ { 'filename', file_status = false, path = 1 },
+ {
+ 'diagnostics',
+ source = { 'nvim' },
+ sections = { 'error' },
+ symbols = { error = 'E ' },
+ diagnostics_color = {
+ error = {
+ bg = colors.neutral_red,
+ fg = colors.dark0,
+ gui = 'bold',
+ },
+ },
+ -- on_click = function()
+ -- vim.diagnostic.goto_prev()
+ -- end
+ },
+ {
+ 'diagnostics',
+ source = { 'nvim' },
+ sections = { 'warn' },
+ symbols = { warn = 'W ' },
+ diagnostics_color = {
+ warn = {
+ bg = colors.neutral_orange,
+ fg = colors.dark0,
+ gui = 'bold',
+ },
+ },
+ -- on_click = function()
+ -- vim.diagnostic.goto_next()
+ -- end
+ },
+ { modified, color = { bg = colors.neutral_purple } },
+ {
+ '%w',
+ cond = function()
+ return vim.wo.previewwindow
+ end,
+ },
+ {
+ '%r',
+ cond = function()
+ return vim.bo.readonly
+ end,
+ },
+ {
+ '%q',
+ cond = function()
+ return vim.bo.buftype == 'quickfix'
+ end,
+ },
+ },
+ lualine_c = {},
+ lualine_x = { 'fileformat' },
+ lualine_y = { 'filetype', 'progress' },
+ lualine_z = { 'location' },
+ },
+}
diff --git a/.local/etc/nvim/lsp.vim b/.local/etc/nvim/after/plugin/lsp.lua
index e0f63e2..89e1682 100644
--- a/.local/etc/nvim/lsp.vim
+++ b/.local/etc/nvim/after/plugin/lsp.lua
@@ -1,11 +1,14 @@
-set updatetime=1000
-set signcolumn=yes
-let g:completion_enable_auto_popup = 1
+vim.opt.updatetime = 1000
+vim.opt.signcolumn = "yes"
+vim.g.completion_enable_auto_popup = 1
-" auto-format on write
-"autocmd BufWritePre * lua vim.lsp.buf.format()
+-- Auto-format on write
+-- vim.api.nvim_create_autocmd("BufWritePre", {
+-- callback = function ()
+-- vim.lsp.buf.format()
+-- end,
+-- })
-lua << EOF
local lsp_capabilities = require('cmp_nvim_lsp').default_capabilities()
local lsp_attach = function(client, bufnr)
-- Enable completion triggered by <c-x><c-o>
@@ -34,8 +37,18 @@ local lsp_attach = function(client, bufnr)
end
-- https://github.com/williamboman/mason-lspconfig.nvim#available-lsp-servers
-local servers = {'zls', 'clangd', 'bashls', 'rust_analyzer', 'texlab', 'gopls',
- 'jedi_language_server', 'lua_ls', 'cssls', 'html', }
+local servers = {
+ 'bashls',
+ 'clangd',
+ 'cssls',
+ 'gopls',
+ 'html',
+ 'jedi_language_server',
+ 'lua_ls',
+ 'rust_analyzer',
+ 'texlab',
+ 'zls',
+}
for _, lsp in ipairs(servers) do
require("lspconfig")[lsp].setup ({
@@ -44,14 +57,14 @@ for _, lsp in ipairs(servers) do
})
end
--- required by cmp for using tab to choose completion
+-- Required by cmp for using tab to choose completion
local has_words_before = function()
unpack = unpack or table.unpack
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
end
--- load snippets
+-- Load snippets
require("luasnip.loaders.from_snipmate").lazy_load()
local luasnip = require("luasnip")
@@ -88,7 +101,7 @@ cmp.setup({
end, { "i", "s" }),
["<S-Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
- cmp.select_prev_item()
+ cmp.select_prev_item()
elseif luasnip.jumpable(-1) then
luasnip.jump(-1)
else
@@ -113,4 +126,3 @@ for type, icon in pairs(signs) do
local hl = "DiagnosticSign" .. type
vim.fn.sign_define(hl, { text = icon, texthl= hl, numhl = hl })
end
-EOF
diff --git a/.local/etc/nvim/after/plugin/misc.lua b/.local/etc/nvim/after/plugin/misc.lua
new file mode 100644
index 0000000..61b85b5
--- /dev/null
+++ b/.local/etc/nvim/after/plugin/misc.lua
@@ -0,0 +1,77 @@
+local map = vim.keymap.set
+
+-- lazy
+map('n', "<leader>l", "<cmd>Lazy<cr>", { desc = "Lazy" })
+
+-- Telescope
+local telescope = require("telescope.builtin")
+-- map('n', "<leader>f", telescope.find_files)
+map('n', "<C-S>", telescope.find_files)
+map('n', "<C-G>", telescope.git_files)
+
+-- NERDTree (see their README)
+map('n', "<F2>", ":NERDTreeToggle<CR>")
+vim.cmd("autocmd BufEnter * if tabpagenr('$') == 1 && winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() | quit | endif")
+
+-- Undotree
+map('n', "<F3>", ":UndotreeToggle<CR>")
+
+-- GitGutter update on write
+vim.api.nvim_create_autocmd("BufWritePost", { command = "GitGutter" })
+
+vim.g.zig_fmt_autosave = 0 -- too slow
+
+-- map("i", "<C-H>", "copilot#Accept('<CR>')", {
+-- expr = true,
+-- replace_keycodes = false,
+-- })
+-- vim.g.copilot_no_tab_map = true
+
+require("neotest").setup({
+ adapters = {
+ require("neotest-zig"),
+ },
+ summary = {
+ enabled = true,
+ animated = true,
+ follow = true,
+ expand_error = true,
+
+ mappings = {
+ expand = { "<CR>", "<2-LeftMouse>" },
+ expand_all = "e",
+ output = "o",
+ short = "O",
+ attach = "a",
+ jumpto = { "i", "<C-]>" },
+ stop = "u",
+ run = "r",
+ debug = "d",
+ mark = "m",
+ run_marked = "R",
+ debug_marked = "D",
+ clear_marked = "M",
+ target = "t",
+ clear_target = "T",
+ next_failed = "J",
+ prev_failed = "K",
+ },
+ },
+})
+
+map('n', "<C-t>", function()
+ -- require("neotest").run.run()
+ require("neotest").summary.toggle()
+ local win = vim.fn.bufwinid("Neotest Summary")
+ if win > -1 then
+ vim.api.nvim_set_current_win(win)
+ end
+end)
+
+vim.g.startify_custom_header = {
+ " ▄▄▄ ▄▄▄· ▄▄▄▄▄ ▄▄▄· ▄ •▄ ▄▄▄ ",
+ " ▀▄ █·▐█ ▀█ •██ ▐█ ▀█ █▌▄▌▪▪ ▀▄ █·",
+ " ▐▀▀▄ ▄█▀▀█ ▐█.▪▄█▀▀█ ▐▀▀▄· ▄█▀▄ ▐▀▀▄ ",
+ " ▐█•█▌▐█ ▪▐▌ ▐█▌·▐█ ▪▐▌▐█.█▌▐█▌.▐▌▐█•█▌",
+ " .▀ ▀ ▀ ▀ ▀▀▀ ▀ ▀ ·▀ ▀ ▀█▄▀▪.▀ ▀",
+}
diff --git a/.local/etc/nvim/appearance.vim b/.local/etc/nvim/appearance.vim
deleted file mode 100644
index 1702c97..0000000
--- a/.local/etc/nvim/appearance.vim
+++ /dev/null
@@ -1,198 +0,0 @@
-set background=dark
-
-lua << EOF
-local colors = require('gruvbox').palette
-
-require("dracula").setup {
- show_end_of_buffer = true,
- lualine_bg_color = "#44475a",
- transparent_bg = true,
-}
-
-require("gruvbox").setup {
- italic = {
- strings = false,
- comments = false
- },
- transparent_mode = true,
-}
-
---require("catppuccin").setup({
--- flavour = "macchiato",
--- transparent_background = true,
--- show_end_of_buffer = true,
---})
---
---require("everforest").setup({
--- transparent_background_level = 1,
---})
-
-local empty = require('lualine.component'):extend()
-function empty:draw(default_highlight)
- self.status = ''
- self.applied_separator = ''
- self:apply_highlights(default_highlight)
- self:apply_section_separators()
- return self.status
-end
-
--- Put proper separators and gaps between components in sections
-local function process_sections(sections)
- for name, section in pairs(sections) do
- local left = name:sub(9, 10) < 'x'
- for pos = 1, name ~= 'lualine_z' and #section or #section - 1 do
- table.insert(section, pos * 2, { empty, color = { fg = colors.neutral_white, bg = colors.neutral_white } })
- end
- for id, comp in ipairs(section) do
- if type(comp) ~= 'table' then
- comp = { comp }
- section[id] = comp
- end
- comp.separator = left and { right = '' } or { left = '' }
- end
- end
- return sections
-end
-
-local function modified()
- if vim.bo.modified then
- return '+'
- elseif vim.bo.modifiable == false or vim.bo.readonly == true then
- return '-'
- end
- return ''
-end
-
-local transparent = require'lualine.themes.gruvbox'
-transparent.inactive.c.bg = 'nil'
-transparent.visual.c.bg = 'nil'
-transparent.replace.c.bg = 'nil'
-transparent.normal.c.bg = 'nil'
-transparent.insert.c.bg = 'nil'
-transparent.command.c.bg = 'nil'
-
-require('lualine').setup {
- options = {
- theme = transparent,
- component_separators = '',
- section_separators = { left = '', right = '' },
- },
- sections = process_sections {
- lualine_a = { 'mode' },
- lualine_b = {
- 'branch',
- 'diff',
- { 'filename', file_status = false, path = 1 },
- {
- 'diagnostics',
- source = { 'nvim' },
- sections = { 'error' },
- symbols = {error = 'E '},
- diagnostics_color = { error = { bg = colors.neutral_red, fg = colors.dark0, gui = 'bold' } },
- --on_click = function()
- -- vim.diagnostic.goto_prev()
- -- end
- },
- {
- 'diagnostics',
- source = { 'nvim' },
- sections = { 'warn' },
- symbols = {warn = 'W '},
- diagnostics_color = { warn = { bg = colors.neutral_orange, fg = colors.dark0, gui = 'bold' } },
- --on_click = function()
- -- vim.diagnostic.goto_next()
- -- end
- },
- { modified, color = { bg = colors.neutral_purple } },
- {
- '%w',
- cond = function()
- return vim.wo.previewwindow
- end,
- },
- {
- '%r',
- cond = function()
- return vim.bo.readonly
- end,
- },
- {
- '%q',
- cond = function()
- return vim.bo.buftype == 'quickfix'
- end,
- },
- },
- lualine_c = {},
- lualine_x = { 'fileformat' },
- lualine_y = { 'filetype', 'progress' },
- lualine_z = { 'location' },
- },
-}
-
-require('hlargs').setup {
- color = colors.neutral_orange
-}
-
-require("scrollbar").setup({
- marks = {
- Search = { color = colors.neutral_orange },
- Error = { color = colors.neutral_red },
- Warn = { color = colors.neutral_yellow },
- Info = { color = colors.neutral_pink },
- Hint = { color = colors.neutral_cyan },
- Misc = { color = colors.neutral_purple },
- },
- handlers = {
- cursor = false,
- handle = false,
- },
-})
-
---vim.cmd [[highlight IndentBlanklineIndent1 guifg=#bd93f9 gui=nocombine]]
---vim.cmd [[highlight IndentBlanklineIndent2 guifg=#50fa7b gui=nocombine]]
---vim.cmd [[highlight IndentBlanklineIndent3 guifg=#8be9fd gui=nocombine]]
---vim.cmd [[highlight IndentBlanklineIndent4 guifg=#f1fa8c gui=nocombine]]
---vim.cmd [[highlight IndentBlanklineIndent5 guifg=#ffb86c gui=nocombine]]
---vim.cmd [[highlight IndentBlanklineIndent6 guifg=#ff5555 gui=nocombine]]
---
---require("indent_blankline").setup {
--- space_char_blankline = " ",
---
--- --show_current_context = true,
--- --show_current_context_start = true,
---
--- char_highlight_list = {
--- "IndentBlanklineIndent1",
--- "IndentBlanklineIndent2",
--- "IndentBlanklineIndent3",
--- "IndentBlanklineIndent4",
--- "IndentBlanklineIndent5",
--- "IndentBlanklineIndent6",
--- },
---}
-
-require("nvim-web-devicons").setup {}
-
-require("nvim-treesitter.configs").setup {
- ensure_installed = {
- "bash", "c", "comment", "css", "diff", "git_rebase",
- "gitattributes", "gitcommit", "gitignore", "go", "html",
- "latex", "lua", "make", "markdown", "python", "rust", "vim",
- "vimdoc", "zig"
- },
-
- highlight = {
- enable = true,
- },
-
- additional_vim_regex_highlighting = false,
-
- rainbow = {
- enable = true,
- extended_mode = true,
- }
-}
-EOF
-
-colorscheme gruvbox
diff --git a/.local/etc/nvim/basics.vim b/.local/etc/nvim/basics.vim
deleted file mode 100644
index 11dcd39..0000000
--- a/.local/etc/nvim/basics.vim
+++ /dev/null
@@ -1,48 +0,0 @@
-set autoindent
-set smartindent
-set tabstop=8 " n of whitespace in \t
-set shiftwidth=4 " n of whitespace for indent
-set softtabstop=4 " n of whitespace to delete with backspace
-set expandtab " \t -> whitespaces
-
-"set mouse=
-aunmenu PopUp
-
-set number
-set relativenumber
-set colorcolumn=80,100
-"set textwidth=79
-set title
-set termguicolors
-set clipboard+=unnamedplus
-set ttimeoutlen=10
-set list
-set lcs=tab:\|\ ,space:⋅ ",eol:$ "↴
-set path=.,/usr/include,/usr/local/include,,
-set nofoldenable
-autocmd FileType * setl fo-=ro fo+=tc
-
-cabbrev Q q
-cabbrev W w
-iabbrev reutnr return
-iabbrev TOOD TODO
-iabbrev cosnt const
-
-nnoremap <silent> <C-L> :nohls<C-R>=has('diff')?'<Bar>dif':''<CR><CR><C-L>
-nnoremap <C-d> <C-d>zz
-nnoremap <C-u> <C-u>zz
-nnoremap ZQ :q<CR>
-
-" Language specific
-autocmd FileType asm,make,vim,sh setl ts=8 sw=8 noet
-"autocmd FileType c,python setl ts=4 sw=4 sts=4 et
-"autocmd FileType lisp,html setl ts=2 sw=2 sts=2 et
-"autocmd FileType html,markdown setl spell
-"autocmd FileType tex setl spell spl=fr
-autocmd BufNewFile,BufRead *.zon setl ft=zig
-
-" Autoformat
-"autocmd BufWritePost *.c silent !astyle -A3 -t8 -p -xg -H -xB -U -n %:p
-"autocmd BufWritePost *.c silent !clang-format -i %:p
-"autocmd BufWritePost *.go silent !gofmt -s -w %:p
-let g:zig_fmt_autosave = 0 " too slow
diff --git a/.local/etc/nvim/header.vim b/.local/etc/nvim/header.vim
deleted file mode 100644
index 4533fb2..0000000
--- a/.local/etc/nvim/header.vim
+++ /dev/null
@@ -1,151 +0,0 @@
-" . :-. .
-" author: ratakor <ratakor@disroot.org> :*==*%%%#%+=---:
-" :#%%%*+%#=+%*:.
-" created: Sat, 06 May 2023 18:54:06 +0200 :%%%. . -*%-
-" updated: Tue, 23 May 2023 15:03:56 +0200 =## . :#%*=:.
-" -#*#%:=#%%%#-
-" description: *:*%%%%%%%#-
-" script to produce an header like this one .-#%%%%%%+
-" automaticaly for each new file %%%--%%%%*-
-" ##%= +%%=:..
-" #* #%#
-" :# -==*
-" :: .:
-
-let s:ascii = [
- \"",
- \". :-. .",
- \":*==*%%%#%+=---:",
- \" :#%%%*+%#=+%*:.",
- \" :%%%. . -*%-",
- \" =## . :#%*=:.",
- \" -#*#%:=#%%%#-",
- \" *:*%%%%%%%#-",
- \" .-#%%%%%%+",
- \" %%%--%%%%*-",
- \" ##%= +%%=:..",
- \" #* #%#",
- \" :# -==*",
- \" :: .:",
- \]
-
-let s:start = '#'
-let s:mid = '#'
-let s:end = ''
-let s:size = 20 " ascii width
-let s:length = len(s:ascii) " header length
-let s:width = 80 " header width
-let s:margin = 5
-
-let s:types = {
- \'\.c$\|\.h$\|\.cc$\|\.hh$\|\.cpp$\|\.hpp$\|\.cs$\|\.php$':
- \['/*', ' *', ' */'],
- \'\.htm$\|\.html$\|\.xml$\|\.md$':
- \['<!--', ' ', '-->'],
- \'\.js$':
- \['//', '//', ''],
- \'\.tex$':
- \['%', '%', ''],
- \'\.ml$\|\.mli$\|\.mll$\|\.mly$':
- \['(*', ' ', '*)'],
- \'\.vim$\|\vimrc$':
- \['"', '"', ''],
- \'\.f90$\|\.f95$\|\.f03$\|\.f$\|\.for$':
- \['!', '!', ''],
- \'\.zig$':
- \['///', '///', ''],
- \}
-
-function! s:filetype()
- let l:f = expand("%:t")
-
- for type in keys(s:types)
- if l:f =~ type
- let s:start = s:types[type][0]
- let s:mid = s:types[type][1]
- let s:end = s:types[type][2]
- endif
- endfor
-
-endfunction
-
-function! s:textline(txt, pos)
- let l:txt = strpart(a:txt, 0, s:width - s:margin * 2 - s:size)
-
- if a:pos == 1
- return s:start . repeat(' ', s:margin - strlen(s:start)) . l:txt . repeat(' ', s:width - s:margin * 2 - strlen(l:txt) - s:size) . s:ascii[a:pos]
- elseif a:pos == s:length
- return s:end
- else
- return s:mid . repeat(' ', s:margin - strlen(s:start)) . l:txt . repeat(' ', s:width - s:margin * 2 - strlen(l:txt) - s:size) . s:ascii[a:pos]
-endfunction
-
-function! s:line(n)
- if a:n == 2
- return s:textline("author: " . s:user() . " <" . s:mail() . ">", a:n)
-" elseif a:n == 3
-" return s:textline("license: " . "ICS license", a:n)
- elseif a:n == 4
- return s:textline("created: " . s:date(), a:n)
- elseif a:n == 5
- return s:textline("updated: " . s:date(), a:n)
- elseif a:n == 7
- return s:textline("description: ", a:n)
- else
- return s:textline('', a:n)
- endif
-endfunction
-
-function! s:user()
- let l:user = $USER
- if strlen(l:user) == 0
- let l:user = "user"
- endif
- return l:user
-endfunction
-
-function! s:mail()
- let l:mail = $MAIL
- if strlen(l:mail) == 0
- let l:mail = "user@mail.org"
- endif
- return l:mail
-endfunction
-
-function! s:date()
- return strftime("%a, %d %b %Y %H:%M:%S %z")
-endfunction
-
-function! s:insert()
- let l:line = s:length
-
- while l:line > 0
- call append(0, s:line(l:line))
- let l:line = l:line - 1
- endwhile
-endfunction
-
-function! s:update()
- let line = 0
- call s:filetype()
- if getline(5) =~ s:start . repeat(' ', s:margin - strlen(s:start)) . "updated: "
- let line = 5
- elseif getline(6) =~ s:start . repeat(' ', s:margin - strlen(s:start)) . "updated: "
- let line = 6
- endif
- if line > 0 && &mod
- call setline(line, s:line(5))
- return 0
- endif
- return 1
-endfunction
-
-function! s:header()
- if s:update()
- call s:insert()
- endif
-endfunction
-
-command! Header call s:header ()
-autocmd BufNewFile * call s:header ()
-autocmd BufWritePre * call s:update ()
diff --git a/.local/etc/nvim/init.lua b/.local/etc/nvim/init.lua
new file mode 100644
index 0000000..5eccf21
--- /dev/null
+++ b/.local/etc/nvim/init.lua
@@ -0,0 +1,37 @@
+require("settings");
+
+-- Bootstrap plugin manager
+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",
+ lazypath,
+ })
+end
+vim.opt.rtp:prepend(lazypath)
+
+require("lazy").setup("plugins", {
+ lockfile = vim.fn.stdpath("state") .. "/lazy/lock.json",
+ ui = {
+ custom_keys = {
+ ["<localleader>l"] = false,
+ ["<localleader>t"] = false,
+ },
+ },
+ performance = {
+ rtp = {
+ disabled_plugins = {
+ "gzip",
+ "netrwPlugin",
+ "tarPlugin",
+ "tohtml",
+ "tutor",
+ "zipPlugin",
+ },
+ },
+ },
+})
diff --git a/.local/etc/nvim/init.vim b/.local/etc/nvim/init.vim
deleted file mode 100644
index 511eb73..0000000
--- a/.local/etc/nvim/init.vim
+++ /dev/null
@@ -1,130 +0,0 @@
-" Automatic vim-plug installation
-if ! filereadable(system('echo -n "${XDG_CONFIG_HOME:-$HOME/.config}/nvim/autoload/plug.vim"'))
- echo "Downloading junegunn/vim-plug to manage plugins..."
- silent !mkdir -p ${XDG_CONFIG_HOME:-$HOME/.config}/nvim/autoload/
- silent !curl "https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim" > ${XDG_CONFIG_HOME:-$HOME/.config}/nvim/autoload/plug.vim
- autocmd VimEnter * PlugInstall
-endif
-
-call plug#begin(system('echo -n "${XDG_CONFIG_HOME:-$HOME/.config}/nvim/plugged"'))
-" Appearance
-Plug 'Mofiqul/dracula.nvim' " dracula theme
-Plug 'ellisonleao/gruvbox.nvim' " gruvbox theme
-Plug 'mhinz/vim-startify' " start screen
-Plug 'nvim-lualine/lualine.nvim' " bottom bar
-Plug 'kyazdani42/nvim-web-devicons' " fancy icons
-Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'} " syntax color
-Plug 'p00f/nvim-ts-rainbow' " funny brackets
-"Plug 'lukas-reineke/indent-blankline.nvim' " funny indentation
-Plug 'm-demare/hlargs.nvim' " highlight arguments
-
-" LSP, Autocompletion Engine and Snippets
-Plug 'neovim/nvim-lspconfig'
-Plug 'hrsh7th/nvim-cmp'
-Plug 'hrsh7th/cmp-nvim-lsp'
-Plug 'hrsh7th/cmp-nvim-lsp-signature-help'
-"Plug 'hrsh7th/cmp-nvim-lsp-document-symbol'
-Plug 'hrsh7th/cmp-buffer'
-Plug 'hrsh7th/cmp-path'
-Plug 'hrsh7th/cmp-calc'
-Plug 'ray-x/cmp-treesitter'
-Plug 'saadparwaiz1/cmp_luasnip'
-Plug 'L3MON4D3/LuaSnip', {'do': 'make install_jsregexp'}
-Plug 'ratakor/vim-snippets'
-
-" Misc
-Plug 'bronson/vim-trailing-whitespace' " FixWhitespace
-Plug 'airblade/vim-gitgutter' " hud for git in vim
-Plug 'nvim-lua/plenary.nvim' " dependency for telescope and neotest
-Plug 'nvim-telescope/telescope.nvim', { 'tag': '0.1.x' } " fuzzy finder
-Plug 'antoinemadec/FixCursorHold.nvim' " dependency for neotest
-Plug 'nvim-neotest/neotest'
-Plug 'lawrence-laz/neotest-zig'
-Plug 'preservim/nerdtree' " vs code be like
-Plug 'mbbill/undotree' " history visualizer
-Plug 'tpope/vim-commentary' " gc/gcc magic comment
-Plug 'tpope/vim-abolish'
-"Plug 'tpope/vim-fugitive' " git in vim
-Plug 'ziglang/zig.vim'
-Plug 'kovetskiy/sxhkd-vim'
-Plug 'petertriho/nvim-scrollbar'
-Plug 'andrewferrier/debugprint.nvim'
-"Plug 'iamcco/markdown-preview.nvim', { 'do': 'cd app && yarn install' }
-"Plug 'mfussenegger/nvim-dap'
-call plug#end()
-
-source $XDG_CONFIG_HOME/nvim/basics.vim
-"source $XDG_CONFIG_HOME/nvim/header.vim
-source $XDG_CONFIG_HOME/nvim/appearance.vim
-source $XDG_CONFIG_HOME/nvim/lsp.vim
-
-" Telescope config
-nnoremap <C-S> :Telescope find_files<CR>
-nnoremap <C-G> :Telescope git_files<CR>
-
-" NerdTree config
-nnoremap <F2> :NERDTreeToggle<CR>
-autocmd BufEnter * if tabpagenr('$') == 1 && winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() | quit | endif
-
-" Undotree config
-nnoremap <F3> :UndotreeToggle<CR>
-
-autocmd BufWritePost * GitGutter
-
-" custom vim-commentary
-autocmd FileType zig setl commentstring=//\ %s
-autocmd FileType cs setl commentstring=/*\ %s\ */
-
-lua << EOF
--- g?p or g?v
-require("debugprint").setup()
-
-require("neotest").setup({
- adapters = {
- require("neotest-zig"),
- },
- summary = {
- enabled = true,
- animated = true,
- follow = true,
- expand_error = true,
-
- mappings = {
- expand = { "<CR>", "<2-LeftMouse>" },
- expand_all = "e",
- output = "o",
- short = "O",
- attach = "a",
- jumpto = { "i", "<C-]>" },
- stop = "u",
- run = "r",
- debug = "d",
- mark = "m",
- run_marked = "R",
- debug_marked = "D",
- clear_marked = "M",
- target = "t",
- clear_target = "T",
- next_failed = "J",
- prev_failed = "K",
- },
- },
-})
-
-vim.keymap.set("n", "<C-t>", function()
- -- require("neotest").run.run()
- require("neotest").summary.toggle()
- local win = vim.fn.bufwinid("Neotest Summary")
- if win > -1 then
- vim.api.nvim_set_current_win(win)
- end
-end)
-EOF
-
-let g:startify_custom_header = [
- \" ▄▄▄ ▄▄▄· ▄▄▄▄▄ ▄▄▄· ▄ •▄ ▄▄▄ ",
- \" ▀▄ █·▐█ ▀█ •██ ▐█ ▀█ █▌▄▌▪▪ ▀▄ █·",
- \" ▐▀▀▄ ▄█▀▀█ ▐█.▪▄█▀▀█ ▐▀▀▄· ▄█▀▄ ▐▀▀▄ ",
- \" ▐█•█▌▐█ ▪▐▌ ▐█▌·▐█ ▪▐▌▐█.█▌▐█▌.▐▌▐█•█▌",
- \" .▀ ▀ ▀ ▀ ▀▀▀ ▀ ▀ ·▀ ▀ ▀█▄▀▪.▀ ▀",
- \]
diff --git a/.local/etc/nvim/lua/plugins/colorscheme.lua b/.local/etc/nvim/lua/plugins/colorscheme.lua
new file mode 100644
index 0000000..3fd6bcb
--- /dev/null
+++ b/.local/etc/nvim/lua/plugins/colorscheme.lua
@@ -0,0 +1,13 @@
+vim.opt.background = "dark"
+
+return {
+ "ellisonleao/gruvbox.nvim",
+ priority = 1000,
+ opts = {
+ italic = {
+ strings = false,
+ comments = false,
+ },
+ transparent_mode = true,
+ },
+}
diff --git a/.local/etc/nvim/lua/plugins/lsp.lua b/.local/etc/nvim/lua/plugins/lsp.lua
new file mode 100644
index 0000000..665e14f
--- /dev/null
+++ b/.local/etc/nvim/lua/plugins/lsp.lua
@@ -0,0 +1,32 @@
+return {
+ {
+ "neovim/nvim-lspconfig",
+ dependencies = {
+ -- LSP for neovim, must be loaded before lspconfig
+ { "folke/neodev.nvim", setup = true },
+ },
+ },
+ {
+ -- Autocompletion
+ "hrsh7th/nvim-cmp",
+ dependencies = {
+ -- Snippets
+ {
+ "L3MON4D3/LuaSnip",
+ build = "make install_jsregexp",
+ dependencies = {
+ "ratakor/vim-snippets",
+ },
+ },
+
+ "hrsh7th/cmp-nvim-lsp",
+ "hrsh7th/cmp-nvim-lsp-signature-help",
+ --"hrsh7th/cmp-nvim-lsp-document-symbol",
+ "hrsh7th/cmp-buffer",
+ "hrsh7th/cmp-path",
+ "hrsh7th/cmp-calc",
+ "ray-x/cmp-treesitter",
+ "saadparwaiz1/cmp_luasnip",
+ },
+ },
+}
diff --git a/.local/etc/nvim/lua/plugins/misc.lua b/.local/etc/nvim/lua/plugins/misc.lua
new file mode 100644
index 0000000..81bcf0a
--- /dev/null
+++ b/.local/etc/nvim/lua/plugins/misc.lua
@@ -0,0 +1,62 @@
+return {
+ -- Status bar
+ "nvim-lualine/lualine.nvim",
+ dependencies = {
+ { "kyazdani42/nvim-web-devicons", setup = true },
+ },
+
+ -- Starting screen
+ "mhinz/vim-startify",
+
+ -- gc/gcc magic comment
+ { "numToStr/Comment.nvim", config = true },
+
+ -- FixWhitespace
+ "bronson/vim-trailing-whitespace",
+
+ -- HUD for git in vim
+ "airblade/vim-gitgutter",
+
+ -- git in vim
+ --"tpope/vim-fugitive",
+
+ -- Fuzzy finder
+ {
+ "nvim-telescope/telescope.nvim",
+ branch = "0.1.x",
+ dependencies = {
+ "nvim-lua/plenary.nvim",
+ },
+ },
+
+ -- History visualizer
+ "mbbill/undotree",
+
+ {
+ "github/copilot.vim",
+ enabled = false,
+ },
+
+ -- Put a print statement with g?p or g?v
+ { "andrewferrier/debugprint.nvim", setup = true },
+
+ -- Testing inside vim
+ {
+ "nvim-neotest/neotest",
+ dependencies = {
+ "nvim-lua/plenary.nvim",
+ "antoinemadec/FixCursorHold.nvim",
+ "lawrence-laz/neotest-zig",
+ },
+ },
+
+ -- TODO: switch to chadtree?
+ "preservim/nerdtree",
+
+ "tpope/vim-abolish",
+ "ziglang/zig.vim",
+ "petertriho/nvim-scrollbar",
+
+ -- Debugger (TODO + not in misc)
+ --"mfussenegger/nvim-dap",
+}
diff --git a/.local/etc/nvim/lua/plugins/noice.lua b/.local/etc/nvim/lua/plugins/noice.lua
new file mode 100644
index 0000000..dbcf2c6
--- /dev/null
+++ b/.local/etc/nvim/lua/plugins/noice.lua
@@ -0,0 +1,40 @@
+return {
+ {
+ "folke/noice.nvim",
+ event = "VeryLazy",
+ opts = {
+ lsp = {
+ override = {
+ ["vim.lsp.util.convert_input_to_markdown_lines"] = true,
+ ["vim.lsp.util.stylize_markdown"] = true,
+ ["cmp.entry.get_documentation"] = true,
+ },
+ },
+ presets = {
+ bottom_search = true,
+ command_palette = true,
+ long_message_to_split = true,
+ inc_rename = false,
+ lsp_doc_border = false,
+ },
+ routes = {
+ {
+ filter = {
+ event = "msg_show",
+ kind = "",
+ },
+ opts = { skip = true },
+ },
+ },
+ },
+ dependencies = {
+ "MunifTanjim/nui.nvim",
+ {
+ "rcarriga/nvim-notify",
+ opts = {
+ background_colour = "#000000",
+ },
+ },
+ },
+ },
+}
diff --git a/.local/etc/nvim/lua/plugins/treesitter.lua b/.local/etc/nvim/lua/plugins/treesitter.lua
new file mode 100644
index 0000000..8482efc
--- /dev/null
+++ b/.local/etc/nvim/lua/plugins/treesitter.lua
@@ -0,0 +1,47 @@
+return {
+ {
+ "nvim-treesitter/nvim-treesitter",
+ build = ":TSUpdate",
+ config = function ()
+ require("nvim-treesitter.configs").setup {
+ ensure_installed = {
+ "bash",
+ "c",
+ "comment",
+ "css",
+ "diff",
+ "git_rebase",
+ "gitattributes",
+ "gitcommit",
+ "gitignore",
+ "go",
+ "html",
+ "latex",
+ "lua",
+ "make",
+ "markdown",
+ "markdown_inline",
+ "python",
+ "regex",
+ "rust",
+ "scheme",
+ "vim",
+ "vimdoc",
+ "zig",
+ },
+ highlight = {
+ enable = true,
+ },
+ additional_vim_regex_highlighting = false,
+ rainbow = {
+ enable = true,
+ extended_mode = true,
+ },
+ }
+ end,
+ dependencies = {
+ "p00f/nvim-ts-rainbow",
+ "m-demare/hlargs.nvim",
+ },
+ },
+}
diff --git a/.local/etc/nvim/lua/settings.lua b/.local/etc/nvim/lua/settings.lua
new file mode 100644
index 0000000..b9e82b6
--- /dev/null
+++ b/.local/etc/nvim/lua/settings.lua
@@ -0,0 +1,83 @@
+local map = vim.keymap.set
+
+-- Set <space> as the leader key
+vim.g.mapleader = ' '
+vim.g.maplocalleader = ' '
+
+vim.opt.autoindent = true
+vim.opt.smartindent = true
+vim.opt.tabstop = 8 -- n of whitespace in \t
+vim.opt.shiftwidth = 4 -- n of whitespace for indent
+vim.opt.softtabstop = 4 -- n of whitespace to delete with backspace
+vim.opt.expandtab = true -- \t -> whitespaces
+
+-- Restrict mouse
+vim.cmd("aunmenu PopUp")
+map({ 'n', 'v', 'i' }, "<Middlemouse>", "<Nop>")
+
+vim.opt.number = true
+vim.opt.relativenumber = true
+vim.opt.colorcolumn = { 80, 100 }
+--vim.opt.textwidth = 79
+vim.opt.title = true
+vim.opt.termguicolors = true
+vim.opt.clipboard = "unnamedplus" -- Sync with system clipboard
+vim.opt.ttimeoutlen = 10
+vim.opt.list = true
+vim.opt.listchars = "tab:| ,space:·" --,eol:$ --↴
+vim.opt.path = ".,/usr/include,/usr/local/include,,"
+vim.opt.foldenable = false
+vim.api.nvim_create_autocmd("FileType", { command = "setl fo-=ro fo+=tc" })
+
+vim.api.nvim_create_autocmd("FileType", {
+ pattern = { "asm", "make", "sh" },
+ callback = function ()
+ vim.opt_local.tabstop = 8
+ vim.opt_local.shiftwidth = 8
+ vim.opt_local.expandtab = false
+ end,
+})
+
+-- vim.api.nvim_create_autocmd("FileType", {
+-- pattern = { "html", "markdown", "tex" },
+-- callback = function () vim.opt_local.spell = true end,
+-- })
+
+vim.api.nvim_create_autocmd({ "BufNewFile", "BufRead" }, {
+ pattern = "*.zon",
+ callback = function () vim.opt_local.filetype = "zig" end,
+})
+
+
+map('n', "<C-d>", "<C-d>zz")
+map('n', "<C-u>", "<C-u>zz")
+map('n', "ZQ", ":q<CR>")
+
+-- Move to window using the <ctrl> hjkl keys
+--map('n', "<C-h>", "<C-w>h", { desc = "Go to left window", remap = true })
+--map('n', "<C-j>", "<C-w>j", { desc = "Go to lower window", remap = true })
+--map('n', "<C-k>", "<C-w>k", { desc = "Go to upper window", remap = true })
+--map('n', "<C-l>", "<C-w>l", { desc = "Go to right window", remap = true })
+
+-- https://github.com/mhinz/vim-galore#saner-behavior-of-n-and-n
+map('n', 'n', "'Nn'[v:searchforward].'zv'", { expr = true, desc = "Next search result" })
+map('x', 'n', "'Nn'[v:searchforward]", { expr = true, desc = "Next search result" })
+map('o', 'n', "'Nn'[v:searchforward]", { expr = true, desc = "Next search result" })
+map('n', "N", "'nN'[v:searchforward].'zv'", { expr = true, desc = "Prev search result" })
+map('x', "N", "'nN'[v:searchforward]", { expr = true, desc = "Prev search result" })
+map('o', "N", "'nN'[v:searchforward]", { expr = true, desc = "Prev search result" })
+
+-- better indenting
+map('v', "<", "<gv")
+map('v', ">", ">gv")
+
+local function abbrev(mode, lhs, rhs)
+ vim.cmd(mode .. "abbrev " .. lhs .. " " .. rhs)
+end
+
+abbrev('c', "Q", "q")
+abbrev('c', "W", "w")
+abbrev('i', "reutnr", "return")
+abbrev('i', "TOOD", "TODO")
+abbrev('i', "cosnt", "const")
+abbrev('i', "swtich", "switch")
diff --git a/.local/etc/vivid/filetypes.yml b/.local/etc/vivid/filetypes.yml
deleted file mode 100644
index 6d52f29..0000000
--- a/.local/etc/vivid/filetypes.yml
+++ /dev/null
@@ -1,13 +0,0 @@
-programming:
- source:
- zig:
- - .zig
- tooling:
- build:
- zig:
- - build.zig
- packaging:
- zig:
- - build.zig.zon
-
-
diff --git a/.local/etc/zsh/.zshrc b/.local/etc/zsh/.zshrc
index c6552d2..f0e0277 100644
--- a/.local/etc/zsh/.zshrc
+++ b/.local/etc/zsh/.zshrc
@@ -20,13 +20,13 @@ KEYTIMEOUT=1
timer=$(print -P %D{%s%3.})
function preexec() {
timer=$(print -P %D{%s%3.})
- echo -ne "\e[5 q" # Use beam shape cursor for each new prompt.
+ echo -ne "\x1b[6 q" # Use beam shape cursor for each new prompt.
}
function precmd() {
local now=$(($(print -P %D{%s%3.}) - 2))
[ -z "$timer" ] && timer=$now
- local d_ms=$(($now - $timer))
+ local d_ms=$((now - timer))
local d_s=$((d_ms / 1000))
local ms=$((d_ms % 1000))
local s=$((d_s % 60))
@@ -62,13 +62,13 @@ bindkey -v '^?' backward-delete-char
function zle-keymap-select() {
case $KEYMAP in
vicmd)
- echo -ne '\e[1 q' ;; # block
+ echo -ne "\x1b[2 q" ;; # block
viins|main)
- echo -ne '\e[5 q' ;; # beam
+ echo -ne "\x1b[6 q" ;; # beam
esac
}
function zle-line-init() {
- echo -ne '\e[5 q'
+ echo -ne "\x1b[6 q"
}
zle -N zle-keymap-select
zle -N zle-line-init