dotfiles

*nix config files
git clone git://git.pyratebeard.net/dotfiles.git
Log | Files | Refs | README

commit ccce2233dbac2775b8e6c484fd65b444c5abad7f
parent d9e1021ffaa481b1c11053dcd50e1465f7f01028
Author: pyratebeard <root@pyratebeard.net>
Date:   Thu, 30 May 2024 16:30:09 +0100

feat(neovim): switch to neovim

Diffstat:
Aneovim/.config/nvim/init.lua | 275+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Aneovim/.config/nvim/lua/plugins/alpha.lua | 63+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Aneovim/.config/nvim/lua/plugins/devicons.lua | 803+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Aneovim/.config/nvim/lua/plugins/fzf.lua | 33+++++++++++++++++++++++++++++++++
Aneovim/.config/nvim/lua/plugins/git.lua | 36++++++++++++++++++++++++++++++++++++
Aneovim/.config/nvim/lua/plugins/gitsigns.lua | 29+++++++++++++++++++++++++++++
Aneovim/.config/nvim/lua/plugins/indent.lua | 19+++++++++++++++++++
Aneovim/.config/nvim/lua/plugins/lazy-lock.json | 18++++++++++++++++++
Aneovim/.config/nvim/lua/plugins/lush.lua | 11+++++++++++
Aneovim/.config/nvim/lua/plugins/oldriceputin.lua | 10++++++++++
Aneovim/.config/nvim/lua/plugins/telescope.lua | 94+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Aneovim/.config/nvim/lua/plugins/vimwiki.lua | 11+++++++++++
Aneovim/.config/nvim/lua/utils/duplicates.lua | 73+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Aneovim/.config/nvim/lua/utils/functions.lua | 126+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Aneovim/.config/nvim/lua/utils/icons.lua | 69+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Aneovim/.config/nvim/lua/utils/remaps.lua | 60++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mtmux/.config/tmux/tmux.conf | 1+
Mzsh/.config/zsh/aliases.zsh | 8++++----
18 files changed, 1735 insertions(+), 4 deletions(-)

diff --git a/neovim/.config/nvim/init.lua b/neovim/.config/nvim/init.lua @@ -0,0 +1,275 @@ +-- ██ +-- ░░ +-- ███████ █████ ██████ ██ ██ ██ ██████████ +-- ░░██░░░██ ██░░░██ ██░░░░██░██ ░██░██░░██░░██░░██ +-- ░██ ░██░███████░██ ░██░░██ ░██ ░██ ░██ ░██ ░██ +-- ░██ ░██░██░░░░ ░██ ░██ ░░████ ░██ ░██ ░██ ░██ +-- ███ ░██░░██████░░██████ ░░██ ░██ ███ ░██ ░██ +-- ░░░ ░░ ░░░░░░ ░░░░░░ ░░ ░░ ░░░ ░░ ░░ +-- +-- author ▓▒ pyratebeard <root@pyratebeard.net> +-- code ▓▒ https://git.pyratebeard.net/dotfiles + +-- ▓▓▒░ general +-- security +vim.opt.modelines = 0 + +-- https://neovim.discourse.group/t/how-do-i-prevent-neovim-commenting-out-next-line-after-a-comment-line/3711/4 +vim.opt.paste = true + +-- set leader +vim.g.mapleader = "," + +-- hide buffers +vim.opt.hidden = true + +-- maintain undo history between sessions +vim.opt.undofile = true +vim.opt.undodir = vim.fn.stdpath("data") .. "/undo" +vim.opt.swapfile = false + +-- fuzzy find +vim.opt.path:append("**") + +-- lazy file name tab completion +vim.opt.wildmode = "list:longest,list:full" +vim.opt.wildmenu = true +vim.opt.wildignorecase = true + +-- ignore files vim doesnt use +vim.opt.wildignore:append(".git,.hg,.svn") +vim.opt.wildignore:append(".aux,*.out,*.toc") +vim.opt.wildignore:append(".o,*.obj,*.exe,*.dll,*.manifest,*.rbc,*.class") +vim.opt.wildignore:append(".ai,*.bmp,*.gif,*.ico,*.jpg,*.jpeg,*.png,*.psd,*.webp") +vim.opt.wildignore:append(".avi,*.divx,*.mp4,*.webm,*.mov,*.m2ts,*.mkv,*.vob,*.mpg,*.mpeg") +vim.opt.wildignore:append(".mp3,*.oga,*.ogg,*.wav,*.flac") +vim.opt.wildignore:append(".eot,*.otf,*.ttf,*.woff") +vim.opt.wildignore:append(".doc,*.pdf,*.cbr,*.cbz") +vim.opt.wildignore:append(".zip,*.tar.gz,*.tar.bz2,*.rar,*.tar.xz,*.kgb") +vim.opt.wildignore:append(".swp,.lock,.DS_Store,._*") +vim.opt.wildignore:append(".,..") + +-- case insensitive search +vim.opt.ignorecase = true +vim.opt.smartcase = true +vim.opt.infercase = true + +-- make backspace behave in a sane manner +vim.opt.backspace = "indent,eol,start" + +-- searching +vim.opt.hlsearch = true +vim.opt.incsearch = true +vim.opt.inccommand = "split" + +-- use indents of 2 +vim.opt.shiftwidth = 2 + +-- tabs are tabs +vim.opt.expandtab = false + +-- an indentation every 2 columns +vim.opt.tabstop = 2 + +-- let backspace delete indent +vim.opt.softtabstop = 2 + +-- enable auto indentation +vim.opt.autoindent = true + +-- disable pesky mouse +vim.opt.mouse = "" + +-- ▓▓▒░ ui +-- show matching brackets/parenthesis +vim.opt.showmatch = true + +-- disable startup message +vim.opt.shortmess:append("sI") + +-- syntax highlighting +vim.opt.termguicolors = true +vim.opt.synmaxcol = 512 + +-- show line numbers +vim.opt.number = true + +-- no line wrapping +vim.opt.wrap = false +vim.opt.linebreak = true + +-- set indents when wrapped +vim.opt.breakindent = true + +-- highlight line +vim.opt.cursorline = true + +-- cursor always block +vim.opt.guicursor = "n-v-i-c:block-Cursor" + +-- show invisibles +vim.opt.listchars = { tab = " ", trail = "·", extends = "»", precedes = "«", nbsp = "░" } +vim.opt.list = true + +-- split directions +vim.opt.fillchars = { vert = "▒" } +vim.opt.splitright = true +vim.opt.splitbelow = true + +-- +--" stop unnecessary rendering +--set lazyredraw +-- +--" no folding +--set foldlevel=99 +--set foldminlines=99 +-- + +--" MACROS +--" target blank links +--" used in blog md files +--let @t='{target="_blank" rel="noreferrer"}' + +-- ▓▓▒░ commands +local f = require("utils.functions") +local r = require("utils.remaps") + +-- remove highlighting +r.noremap("n", "<esc><esc>", ":nohlsearch<cr>", "remove highlighting", { silent = true }) + +-- vertical term +-- TODO auto append when term opens +r.noremap("n", "<leader>z", ":cd %:h | :vs | :set nu! | :term<cr>", "vertical terminal", { silent = true }) +r.noremap("n", "<leader>Z", ":cd %:h | :split | :set nu! | :term<cr>", "terminal", { silent = true }) + +-- remove trailing white space +f.cmd("Nows", "%s/\\s\\+$//e", { desc = "remove trailing whitespace" }) + +-- remove blank lines +f.cmd("Nobl", "g/^\\s*$/d", { desc = "remove blank lines" }) + +-- the worst place in the world +r.noremap("n", "Q", "<nop>", "") + +-- wrap and spellcheck when writing +-- nnoremap <C-w>w :set wrap<CR>:Spell<CR> +f.cmd("Sp", "setlocal spell! spell?", { desc = "toggle spell check" }) +r.noremap("n", "<leader>s", ":Sp<cr>", "toggle spell check") +r.noremap("n", "<leader>ww", ":set wrap<cr>:Sp<cr>", { desc = "wrap and toggle spell check" }) + +-- make current buffer executable +f.cmd("Chmodx", "!chmod a+x %", { desc = "make current buffer executable" }) +r.noremap("n", "<leader>x", ":Chmodx<cr>", "chmod +x buffer") + +-- +-- vnoremap <silent> <leader>y :w !xsel -i -b<CR> +-- nnoremap <silent> <leader>y V:w !xsel -i -b<CR> +-- nnoremap <silent> <leader>p :silent :r !xsel -o -b<CR> +-- +-- " switch tabs +-- nnoremap <C-n> :tabn<CR> +-- nnoremap <C-p> :tabp<CR> +-- +-- " nerdtree +-- nnoremap <C-j> :NERDTreeToggle<CR> +-- +-- " toggle autoindent +-- nnoremap <F8> :setl noai<CR> +-- nnoremap <F9> :setl ai<CR> +-- +-- " goyo +-- nnoremap <C-w>g :Goyo<CR> +-- +-- " start webserver +-- "nnoremap <leader>h :!busybox httpd -f -h . -p 8080 +-- +-- " list buffers and wait for number +-- nnoremap <leader>b :ls<CR>:b +-- +-- " fzf +-- "nnoremap <leader>f :cd $HOME/src <bar>FZF<CR> +-- nnoremap <leader>f :cd %:p:h <bar>FZF<CR> +-- +-- " list registers +-- nnoremap <leader>r :registers<CR> +-- +-- " swap ' and ` for marks +-- nnoremap ' ` +-- nnoremap ` ' +-- " columns +-- " 80 soft 120 hard +-- let &colorcolumn="80" +-- +-- " COMMANDS +-- " json pretty print +-- command J :%!python -mjson.tool +-- +-- " git commit shortcut +-- command Ga Git add % +-- command Gc Git commit -S +-- command Gac Git commit -a -S -m "updates" +-- command Gf Git fetch +-- command Gp Git push +-- command -nargs=* Gco Git checkout +-- command Gm Git merge + +-- ▓▓▒░ plugins +-- TODO lightline +local pluginspath = vim.fn.stdpath("data") .. "/lazy" +local lazypath = pluginspath .. "/lazy.nvim" + +-- install lazy +if not vim.loop.fs_stat(lazypath) then + vim.fn.system({ + "git", + "clone", + "--filter=blob:none", + "--single-branch", + "https://github.com/folke/lazy.nvim.git", + lazypath, + }) +end +vim.opt.runtimepath:prepend(lazypath) + +-- use a protected call so we don't error out on first use +local status_ok, lazy = pcall(require, "lazy") +if not status_ok then + print("lazy just installed, please restart neovim") + return +end + +---- install plugins +lazy.setup({ + spec = { + --require("plugins.alpha"), + require("plugins.fzf"), + require("plugins.git"), + require("plugins.gitsigns"), + require("plugins.indent"), + require("plugins.lush"), + require("plugins.oldriceputin"), + require("plugins.telescope"), + require("plugins.vimwiki"), + }, + dev = { + path = "~/.local/src/warez", + }, + lockfile = vim.fn.stdpath("config") .. "/lua/plugins/lazy-lock.json", + ui = { + size = { width = 0.8, height = 0.8 }, + wrap = true, + border = "shadow", + icons = require("utils.icons").lazy, + }, + performance = { + cache = { + enabled = true, + }, + reset_packpath = true, + rtp = { + disabled_plugins = { + "netrwPlugin", + }, + }, + }, +}) diff --git a/neovim/.config/nvim/lua/plugins/alpha.lua b/neovim/.config/nvim/lua/plugins/alpha.lua @@ -0,0 +1,63 @@ +return { + 'goolord/alpha-nvim', + event = 'VimEnter', + opts = function() + local dashboard = require('alpha.themes.dashboard') + require("alpha.term") + dashboard.section.terminal.command = vim.fn.stdpath("config") .. "/nvim-logo -t" + dashboard.section.terminal.width = 70 + dashboard.section.terminal.height = 10 + dashboard.section.terminal.opts.redraw = true + dashboard.section.terminal.opts.window_config.zindex = 1 + -- offset placment for screenshots + -- dashboard.section.terminal.opts.window_config.col = math.floor((vim.o.columns - 70) / 2 + 20) + -- vim.cmd [[autocmd! User AlphaClosed]] + + dashboard.section.buttons.val = { + dashboard.button('i', ' new file', ':ene <BAR> startinsert<CR>'), + dashboard.button('o', ' old files', ':Telescope oldfiles<CR>'), + dashboard.button('f', '󰥨 find file', ':Telescope file_browser<CR>'), + dashboard.button('g', '󰱼 find text', ':Telescope live_grep_args<CR>'), + dashboard.button('h', ' browse git', ':Flog<CR>'), + dashboard.button('l', '󰒲 lazy', ':Lazy<CR>'), + dashboard.button('m', '󱌣 mason', ':Mason<CR>'), + dashboard.button('p', '󰄉 profile', ':Lazy profile<CR>'), + dashboard.button('q', '󰭿 quit', ':qa<CR>'), + } + for _, button in ipairs(dashboard.section.buttons.val) do + button.opts.hl = 'Normal' + button.opts.hl_shortcut = 'Function' + end + dashboard.section.footer.opts.hl = "Special" + dashboard.opts.layout = { + dashboard.section.terminal, + { type = "padding", val = 4 }, + dashboard.section.buttons, + dashboard.section.footer, + } + return dashboard + end, + config = function(_, dashboard) + -- close lazy and re-open when the dashboard is ready + if vim.o.filetype == 'lazy' then + vim.cmd.close() + vim.api.nvim_create_autocmd('User', { + pattern = 'AlphaReady', + callback = function() + require('lazy').show() + end, + }) + end + require('alpha').setup(dashboard.opts) + + vim.api.nvim_create_autocmd('User', { + pattern = 'LazyVimStarted', + callback = function() + local stats = require('lazy').stats() + local ms = (math.floor(stats.startuptime * 100 + 0.5) / 100) + dashboard.section.footer.val = '󱐋 ' .. stats.count .. ' plugins loaded in ' .. ms .. 'ms' + pcall(vim.cmd.AlphaRedraw) + end, + }) + end, +} diff --git a/neovim/.config/nvim/lua/plugins/devicons.lua b/neovim/.config/nvim/lua/plugins/devicons.lua @@ -0,0 +1,803 @@ +return { + "nvim-tree/nvim-web-devicons", + event = "VeryLazy", + config = function() + require("nvim-web-devicons").setup({ + -- yes, this is all the icons w/ an extra space + override = { + ["default_icon"] = { + icon = "󱔗 ", + }, + [".babelrc"] = { + icon = " ", + }, + [".bash_profile"] = { + icon = " ", + }, + [".bashrc"] = { + icon = " ", + }, + [".ds_store"] = { + icon = " ", + }, + [".eslintrc"] = { + icon = " ", + }, + [".gitattributes"] = { + icon = " ", + }, + [".gitconfig"] = { + icon = " ", + }, + [".gitignore"] = { + icon = " ", + }, + [".gitlab-ci.yml"] = { + icon = " ", + }, + [".gitmodules"] = { + icon = " ", + }, + [".gvimrc"] = { + icon = " ", + }, + [".npmignore"] = { + icon = " ", + }, + [".npmrc"] = { + icon = " ", + }, + [".settings.json"] = { + icon = " ", + }, + [".vimrc"] = { + icon = " ", + }, + [".zprofile"] = { + icon = " ", + }, + [".zshenv"] = { + icon = " ", + }, + [".zshrc"] = { + icon = " ", + }, + ["brewfile"] = { + icon = " ", + }, + ["cmakelists.txt"] = { + icon = " ", + }, + ["commit_editmsg"] = { + icon = " ", + }, + ["containerfile"] = { + icon = "󰡨 ", + }, + ["copying"] = { + icon = " ", + }, + ["copying.lesser"] = { + icon = " ", + }, + ["docker-compose.yml"] = { + icon = "󰡨 ", + }, + ["docker-compose.yaml"] = { + icon = "󰡨 ", + }, + [".dockerignore"] = { + icon = "󰡨 ", + }, + ["gemfile$"] = { + icon = " ", + }, + ["vagrantfile$"] = { + icon = " ", + }, + ["_gvimrc"] = { + icon = " ", + }, + ["_vimrc"] = { + icon = " ", + }, + ["package.json"] = { + icon = " ", + }, + ["package-lock.json"] = { + icon = " ", + }, + ["node_modules"] = { + icon = " ", + }, + ["favicon.ico"] = { + icon = " ", + }, + ["mix.lock"] = { + icon = " ", + }, + [".env"] = { + icon = " ", + }, + ["gruntfile"] = { + icon = " ", + }, + ["gulpfile"] = { + icon = " ", + }, + ["rakefile"] = { + icon = " ", + }, + ["procfile"] = { + icon = " ", + }, + ["dockerfile"] = { + icon = "󰡨 ", + }, + ["build"] = { + icon = " ", + }, + ["workspace"] = { + icon = " ", + }, + ["unlicense"] = { + icon = " ", + }, + ["ai"] = { + icon = " ", + }, + ["awk"] = { + icon = " ", + }, + ["bash"] = { + icon = " ", + }, + ["bat"] = { + icon = " ", + }, + ["bazel"] = { + icon = " ", + }, + ["bzl"] = { + icon = " ", + }, + ["bmp"] = { + icon = " ", + }, + ["c"] = { + icon = " ", + }, + ["c++"] = { + icon = " ", + }, + ["cbl"] = { + icon = "⚙ ", + }, + ["cc"] = { + icon = " ", + }, + ["cfg"] = { + icon = " ", + }, + ["cjs"] = { + icon = " ", + }, + ["clj"] = { + icon = " ", + }, + ["cljc"] = { + icon = " ", + }, + ["cljs"] = { + icon = " ", + }, + ["cljd"] = { + icon = " ", + }, + ["cmake"] = { + icon = " ", + }, + ["cob"] = { + icon = "⚙ ", + }, + ["cobol"] = { + icon = "⚙ ", + }, + ["coffee"] = { + icon = " ", + }, + ["conf"] = { + icon = " ", + }, + ["config.ru"] = { + icon = " ", + }, + ["cp"] = { + icon = " ", + }, + ["cpp"] = { + icon = " ", + }, + ["cpy"] = { + icon = "⚙ ", + }, + ["cr"] = { + icon = " ", + }, + ["cs"] = { + icon = "󰌛 ", + }, + ["csh"] = { + icon = " ", + }, + ["cson"] = { + icon = " ", + }, + ["css"] = { + icon = " ", + }, + ["csv"] = { + icon = "󰈙 ", + }, + ["cxx"] = { + icon = " ", + }, + ["d"] = { + icon = " ", + }, + ["dart"] = { + icon = " ", + }, + ["db"] = { + icon = " ", + }, + ["desktop"] = { + icon = " ", + }, + ["diff"] = { + icon = " ", + }, + ["doc"] = { + icon = "󰈬 ", + }, + ["docx"] = { + icon = "󰈬 ", + }, + ["drl"] = { + icon = " ", + }, + ["dropbox"] = { + icon = " ", + }, + ["dump"] = { + icon = " ", + }, + ["edn"] = { + icon = " ", + }, + ["eex"] = { + icon = " ", + }, + ["ejs"] = { + icon = " ", + }, + ["elm"] = { + icon = " ", + }, + ["epp"] = { + icon = " ", + }, + ["erb"] = { + icon = " ", + }, + ["erl"] = { + icon = " ", + }, + ["ex"] = { + icon = " ", + }, + ["exs"] = { + icon = " ", + }, + ["f#"] = { + icon = " ", + }, + ["f90"] = { + icon = "󱈚 ", + }, + ["fnl"] = { + icon = "🌜 ", + }, + ["fish"] = { + icon = " ", + }, + ["fs"] = { + icon = " ", + }, + ["fsi"] = { + icon = " ", + }, + ["fsscript"] = { + icon = " ", + }, + ["fsx"] = { + icon = " ", + }, + ["gd"] = { + icon = " ", + }, + ["gemspec"] = { + icon = " ", + }, + ["gif"] = { + icon = " ", + }, + ["git"] = { + icon = " ", + }, + ["glb"] = { + icon = " ", + }, + ["go"] = { + icon = " ", + }, + ["godot"] = { + icon = " ", + }, + ["graphql"] = { + icon = " ", + }, + ["gql"] = { + icon = " ", + }, + ["h"] = { + icon = " ", + }, + ["haml"] = { + icon = " ", + }, + ["hbs"] = { + icon = " ", + }, + ["heex"] = { + icon = " ", + }, + ["hh"] = { + icon = " ", + }, + ["hpp"] = { + icon = " ", + }, + ["hrl"] = { + icon = " ", + }, + ["hs"] = { + icon = " ", + }, + ["htm"] = { + icon = " ", + }, + ["html"] = { + icon = " ", + }, + ["hxx"] = { + icon = " ", + }, + ["ico"] = { + icon = " ", + }, + ["import"] = { + icon = " ", + }, + ["ini"] = { + icon = " ", + }, + ["java"] = { + icon = " ", + }, + ["jl"] = { + icon = " ", + }, + ["jpeg"] = { + icon = " ", + }, + ["jpg"] = { + icon = " ", + }, + ["js"] = { + icon = " ", + }, + ["test.js"] = { + icon = " ", + }, + ["spec.js"] = { + icon = " ", + }, + ["json"] = { + icon = " ", + }, + ["json5"] = { + icon = " ", + }, + ["jsx"] = { + icon = " ", + }, + ["test.jsx"] = { + icon = " ", + }, + ["spec.jsx"] = { + icon = " ", + }, + ["ksh"] = { + icon = " ", + }, + ["kt"] = { + icon = " ", + }, + ["kts"] = { + icon = " ", + }, + ["leex"] = { + icon = " ", + }, + ["less"] = { + icon = " ", + }, + ["lhs"] = { + icon = " ", + }, + ["license"] = { + icon = " ", + }, + ["lua"] = { + icon = " ", + }, + ["luau"] = { + icon = " ", + }, + ["gnumakefile"] = { + icon = " ", + }, + ["makefile"] = { + icon = " ", + }, + ["mk"] = { + icon = " ", + }, + ["markdown"] = { + icon = " ", + }, + ["material"] = { + icon = "󰔉 ", + }, + ["md"] = { + icon = " ", + }, + ["mdx"] = { + icon = " ", + }, + ["mint"] = { + icon = "󰌪 ", + }, + ["mjs"] = { + icon = " ", + }, + ["ml"] = { + icon = "λ ", + }, + ["mli"] = { + icon = "λ ", + }, + ["mo"] = { + icon = "∞ ", + }, + ["mustache"] = { + icon = " ", + }, + ["nim"] = { + icon = " ", + }, + ["nix"] = { + icon = " ", + }, + ["opus"] = { + icon = "󰈣 ", + }, + ["org"] = { + icon = " ", + }, + ["otf"] = { + icon = " ", + }, + ["pck"] = { + icon = " ", + }, + ["pdf"] = { + icon = " ", + }, + ["php"] = { + icon = " ", + }, + ["pl"] = { + icon = " ", + }, + ["pm"] = { + icon = " ", + }, + ["png"] = { + icon = " ", + }, + ["pp"] = { + icon = " ", + }, + ["ppt"] = { + icon = "󰈧 ", + }, + ["pro"] = { + icon = " ", + }, + ["ps1"] = { + icon = "󰨊 ", + }, + ["psd1"] = { + icon = "󰨊 ", + }, + ["psm1"] = { + icon = "󰨊 ", + }, + ["psb"] = { + icon = " ", + }, + ["psd"] = { + icon = " ", + }, + ["py"] = { + icon = " ", + }, + ["pyc"] = { + icon = " ", + }, + ["pyd"] = { + icon = " ", + }, + ["pyo"] = { + icon = " ", + }, + ["query"] = { + icon = " ", + }, + ["r"] = { + icon = "󰟔 ", + }, + ["rake"] = { + icon = " ", + }, + ["rb"] = { + icon = " ", + }, + ["README"] = { + icon = "󰑇 ", + }, + ["README.md"] = { + icon = "󰑇 ", + }, + ["res"] = { + icon = " ", + }, + ["resi"] = { + icon = " ", + }, + ["rlib"] = { + icon = " ", + }, + ["rmd"] = { + icon = " ", + }, + ["robots.txt"] = { + icon = "󱚤 ", + }, + ["rproj"] = { + icon = "󰗆 ", + }, + ["rs"] = { + icon = " ", + }, + ["rss"] = { + icon = " ", + }, + ["sass"] = { + icon = " ", + }, + ["sbt"] = { + icon = " ", + }, + ["scala"] = { + icon = " ", + }, + ["scm"] = { + icon = "󰘧 ", + }, + ["scss"] = { + icon = " ", + }, + ["sh"] = { + icon = " ", + }, + ["sig"] = { + icon = "λ ", + }, + ["slim"] = { + icon = " ", + }, + ["sln"] = { + icon = " ", + }, + ["sml"] = { + icon = "λ ", + }, + ["sql"] = { + icon = " ", + }, + ["sqlite"] = { + icon = " ", + }, + ["sqlite3"] = { + icon = " ", + }, + ["styl"] = { + icon = " ", + }, + ["sublime"] = { + icon = " ", + }, + ["suo"] = { + icon = " ", + }, + ["sv"] = { + icon = "󰍛 ", + }, + ["svelte"] = { + icon = " ", + }, + ["svh"] = { + icon = "󰍛 ", + }, + ["svg"] = { + icon = "󰜡 ", + }, + ["swift"] = { + icon = " ", + }, + ["t"] = { + icon = " ", + }, + ["tbc"] = { + icon = "󰛓 ", + }, + ["tcl"] = { + icon = "󰛓 ", + }, + ["terminal"] = { + icon = " ", + }, + ["tex"] = { + icon = "󰙩 ", + }, + ["tf"] = { + icon = " ", + }, + ["tfvars"] = { + icon = " ", + }, + ["toml"] = { + icon = " ", + }, + ["tres"] = { + icon = " ", + }, + ["ts"] = { + icon = " ", + }, + ["test.ts"] = { + icon = " ", + }, + ["spec.ts"] = { + icon = " ", + }, + ["tscn"] = { + icon = "󰎁 ", + }, + ["tsx"] = { + icon = " ", + }, + ["test.tsx"] = { + icon = " ", + }, + ["spec.tsx"] = { + icon = " ", + }, + ["twig"] = { + icon = " ", + }, + ["txt"] = { + icon = "󰈙 ", + }, + ["v"] = { + icon = "󰍛 ", + }, + ["vala"] = { + icon = " ", + }, + ["vh"] = { + icon = "󰍛 ", + }, + ["vhd"] = { + icon = "󰍛 ", + }, + ["vhdl"] = { + icon = "󰍛 ", + }, + ["vim"] = { + icon = " ", + }, + ["vue"] = { + icon = " ", + }, + ["webmanifest"] = { + icon = " ", + }, + ["webp"] = { + icon = " ", + }, + ["webpack"] = { + icon = "󰜫 ", + }, + ["xcplayground"] = { + icon = " ", + }, + ["xls"] = { + icon = "󰈛 ", + }, + ["xlsx"] = { + icon = "󰈛 ", + }, + ["xml"] = { + icon = "󰗀 ", + }, + ["xul"] = { + icon = " ", + }, + ["yaml"] = { + icon = " ", + }, + ["yml"] = { + icon = " ", + }, + ["zig"] = { + icon = " ", + }, + ["zsh"] = { + icon = " ", + }, + ["sol"] = { + icon = "󰞻 ", + }, + ["prisma"] = { + icon = "󰔶 ", + }, + ["lock"] = { + icon = " ", + }, + ["log"] = { + icon = "󰌱 ", + }, + ["wasm"] = { + icon = " ", + }, + ["liquid"] = { + icon = " ", + }, + }, + }) + end, +} diff --git a/neovim/.config/nvim/lua/plugins/fzf.lua b/neovim/.config/nvim/lua/plugins/fzf.lua @@ -0,0 +1,33 @@ +return { + 'ibhagwan/fzf-lua', + event = "VeryLazy", + dependencies = { 'nvim-tree/nvim-web-devicons' }, + keys = { + { "<leader>/b", function() require("fzf-lua").buffers() end, desc = "List buffers" }, + { "<leader>/c", function() require("fzf-lua").commands() end, desc = "Search commands" }, + { "<leader>/C", function() require("fzf-lua").command_history() end, desc = "Search command history" }, + { "<leader>/f", function() require("fzf-lua").files() end, desc = "Find files" }, + { "<leader>/o", function() require("fzf-lua").oldfiles() end, desc = "Find files" }, + { "<leader>/h", function() require("fzf-lua").highlights() end, desc = "Search highlights" }, + { "<leader>/M", function() require("fzf-lua").marks() end, desc = "Search marks" }, + { "<leader>/k", function() require("fzf-lua").keymaps() end, desc = "Search keymaps" }, + { "<leader>/t", function() require("fzf-lua").treesitter() end, desc = "Search treesitter" }, + { "<leader>/gf", function() require("fzf-lua").git_files() end, desc = "Find git files" }, + { "<leader>/gb", function() require("fzf-lua").git_branches() end, desc = "Search git branches" }, + { "<leader>/gc", function() require("fzf-lua").git_commits() end, desc = "Search git commits" }, + { "<leader>/gC", function() require("fzf-lua").git_bcommits() end, desc = "Search git buffer commits" }, + { "<leader>bc", function() require("fzf-lua").git_bcommits() end, desc = "Search git buffer commits" }, + { "<leader>//", function() require("fzf-lua").resume() end, desc = "Resume FZF" }, + }, + config = function() + local fzf = require('fzf-lua') + fzf.setup({ + keymap = { + fzf = { + ['CTRL-Q'] = 'select-all+accept', + }, + }, + }) + fzf.register_ui_select() + end, +} diff --git a/neovim/.config/nvim/lua/plugins/git.lua b/neovim/.config/nvim/lua/plugins/git.lua @@ -0,0 +1,36 @@ +return { + "rbong/vim-flog", + event = "VeryLazy", + dependencies = { + "tpope/vim-fugitive", + }, + cmd = { + "Flog", + "G", + "GBrowse", + "GDelete", + "GMove", + "GRemove", + "GRename", + "GUnlink", + "Gcd", + "Gclog", + "Gdiffsplit", + "Gdrop", + "Gedit", + "Ggrep", + "Ghdiffsplit", + "Git", + "Glcd", + "Glgrep", + "Gllog", + "Gpedit", + "Gread", + "Gsplit", + "Gtabedit", + "Gvdiffsplit", + "Gvsplit", + "Gwq", + "Gwrite", + }, +} diff --git a/neovim/.config/nvim/lua/plugins/gitsigns.lua b/neovim/.config/nvim/lua/plugins/gitsigns.lua @@ -0,0 +1,29 @@ +return { + "lewis6991/gitsigns.nvim", + config = function() + local gitsigns = require("gitsigns") + gitsigns.setup({ + signs = { + add = { text = '░' }, + change = { text = '░' }, + delete = { text = '░' }, + topdelete = { text = '░' }, + changedelete = { text = '░' }, + untracked = { text = '░' }, + }, + signcolumn = true, -- Toggle with `:Gitsigns toggle_signs` + linehl = false, -- Toggle with `:Gitsigns toggle_linehl` + numhl = false, -- Toggle with `:Gitsigns toggle_nunhl` + word_diff = false, -- Toggle with `:Gitsigns toggle_word_diff` + sign_priority = 9, + watch_gitdir = { + interval = 1000, + }, + attach_to_untracked = false, + }) +-- if pcall(require, "scrollbar") then +-- require("scrollbar.handlers.gitsigns").setup() +-- end + end, + event = { "BufReadPre", "BufNewFile" }, +} diff --git a/neovim/.config/nvim/lua/plugins/indent.lua b/neovim/.config/nvim/lua/plugins/indent.lua @@ -0,0 +1,19 @@ +return { + "lukas-reineke/indent-blankline.nvim", + event = "VeryLazy", + config = function() + require("ibl").setup({ + scope = { + show_start = false, + }, + indent = { + char = "┊", + tab_char = "┊", + smart_indent_cap = true, + }, + whitespace = { + remove_blankline_trail = true, + }, + }) + end, +} diff --git a/neovim/.config/nvim/lua/plugins/lazy-lock.json b/neovim/.config/nvim/lua/plugins/lazy-lock.json @@ -0,0 +1,17 @@ +{ + "fzf-lua": { "branch": "main", "commit": "b92220ec838c195eb1c711daa69c905b1d7b8d8c" }, + "gitsigns.nvim": { "branch": "main", "commit": "af3fdad8ddcadbdad835975204f6503310526fd9" }, + "indent-blankline.nvim": { "branch": "master", "commit": "d98f537c3492e87b6dc6c2e3f66ac517528f406f" }, + "lazy.nvim": { "branch": "main", "commit": "24fa2a97085ca8a7220b5b078916f81e316036fd" }, + "lush.nvim": { "branch": "main", "commit": "7c0e27f50901481fe83b974493c4ea67a4296aeb" }, + "nvim-web-devicons": { "branch": "master", "commit": "b77921fdc44833c994fdb389d658ccbce5490c16" }, + "plenary.nvim": { "branch": "master", "commit": "a3e3bc82a3f95c5ed0d7201546d5d2c19b20d683" }, + "shipwright.nvim": { "branch": "master", "commit": "e596ab48328c31873f4f4d2e070243bf9de16ff3" }, + "telescope-file-browser.nvim": { "branch": "master", "commit": "4d5fd21bae12ee6e9a79232e1c377f43c419d0c5" }, + "telescope-live-grep-args.nvim": { "branch": "master", "commit": "4122e146d199c0d6d1cfb359c76bc1250d522460" }, + "telescope-undo.nvim": { "branch": "main", "commit": "95b61c01ea3a4c9e8747731148e905bbcf0ccaee" }, + "telescope.nvim": { "branch": "master", "commit": "2df52609a1632de5d77a0b2416db6ad9cf32e463" }, + "vim-flog": { "branch": "master", "commit": "2f0836128cac9368176a564b237382d1766723f0" }, + "vim-fugitive": { "branch": "master", "commit": "4f59455d2388e113bd510e85b310d15b9228ca0d" }, + "vimwiki": { "branch": "dev", "commit": "69318e74c88ef7677e2496fd0a836446ceac61e8" } +} +\ No newline at end of file diff --git a/neovim/.config/nvim/lua/plugins/lush.lua b/neovim/.config/nvim/lua/plugins/lush.lua @@ -0,0 +1,11 @@ +return { + "rktjmp/lush.nvim", + lazy = true, + dependencies = { + "rktjmp/shipwright.nvim", + }, + cmd = { + "Lushify", + "Shipwright", + }, +} diff --git a/neovim/.config/nvim/lua/plugins/oldriceputin.lua b/neovim/.config/nvim/lua/plugins/oldriceputin.lua @@ -0,0 +1,10 @@ +return { + "oldriceputin", + name = "oldriceputin", + lazy = false, + dev = { true }, + priority = 1000, + config = function() + vim.cmd("colorscheme oldriceputin") + end, +} diff --git a/neovim/.config/nvim/lua/plugins/telescope.lua b/neovim/.config/nvim/lua/plugins/telescope.lua @@ -0,0 +1,94 @@ +return { + "nvim-telescope/telescope.nvim", + event = "VeryLazy", + dependencies = { + "nvim-lua/plenary.nvim", + "debugloop/telescope-undo.nvim", + "nvim-telescope/telescope-file-browser.nvim", + "nvim-telescope/telescope-live-grep-args.nvim", + }, + config = function() + local telescope = require("telescope") + local tele_actions = require("telescope.actions") + local lga_actions = require("telescope-live-grep-args.actions") + local lga_shortcuts = require("telescope-live-grep-args.shortcuts") + local undo_actions = require("telescope-undo.actions") + local r = require("utils.remaps") + local i = require("utils.icons") + telescope.setup({ + defaults = { + layout_config = { + anchor = "center", + height = 0.8, + width = 0.9, + preview_width = 0.6, + prompt_position = "bottom", + }, + borderchars = i.telescope, + mappings = { + i = { + ["<esc>"] = tele_actions.close, + }, + }, + }, + extensions = { + undo = { + use_delta = true, + side_by_side = true, + entry_format = "󰣜 #$ID, $STAT, $TIME", + layout_strategy = "flex", + mappings = { + i = { + ["<cr>"] = undo_actions.yank_additions, + ["§"] = undo_actions.yank_deletions, -- term mapped to shift+enter + ["<c-\\>"] = undo_actions.restore, + }, + }, + }, + live_grep_args = { + auto_quoting = true, + mappings = { + i = { + ["<c-\\>"] = lga_actions.quote_prompt({ postfix = " --hidden " }), + }, + }, + }, + file_browser = { + depth = 1, + auto_depth = false, + hidden = { file_browser = true, folder_browser = true }, + hide_parent_dir = false, + collapse_dirs = false, + prompt_path = false, + quiet = false, + dir_icon = "󰉓 ", + dir_icon_hl = "Default", + display_stat = { date = true, size = true, mode = true }, + git_status = true, + }, + }, + }) + r.noremap("n", "<leader>u", ":Telescope undo<cr>", "undo tree") + r.noremap("n", "\\", function() + telescope.extensions.live_grep_args.live_grep_args({ + prompt_title = 'grep', + additional_args = '-i', + }) + end, "live grep") + r.noremap("n", "<leader>o", ":Telescope oldfiles<cr>", "old files") + r.noremap("n", "<leader>gc", function() + lga_shortcuts.grep_word_under_cursor({ postfix = " --hidden " }) + end, "grep under cursor") + r.noremap("n", "<leader>f", function() + telescope.extensions.file_browser.file_browser() + end, "browse files") + r.noremap("n", "<leader>.", function() + telescope.extensions.file_browser.file_browser({ + path = vim.fn.stdpath("config") + }) + end, "nvim dotfiles") + telescope.load_extension("undo") + telescope.load_extension("file_browser") + telescope.load_extension("live_grep_args") + end, +} diff --git a/neovim/.config/nvim/lua/plugins/vimwiki.lua b/neovim/.config/nvim/lua/plugins/vimwiki.lua @@ -0,0 +1,11 @@ +return { + { + "vimwiki/vimwiki", + init = function() + vim.g.vimwiki_list = { + { path = "~src/grimoire", syntax = "markdown", ext = ".md", links_space_char = "_" } + } + vim.g.vimwiki_ext2syntax = { ['.md'] = 'markdown', ['.markdown'] = 'markdown', ['.mdown'] = 'markdown' } + end, + }, +} diff --git a/neovim/.config/nvim/lua/utils/duplicates.lua b/neovim/.config/nvim/lua/utils/duplicates.lua @@ -0,0 +1,73 @@ +local functions = require("utils.functions") + +local X = {} + +local duplicates_n = {} +local duplicates_v = {} +local duplicates_i = {} +local duplicates_s = {} +local duplicates_x = {} + +local function check_and_set_duplicates(input, description, check, table) + if check then + local found = table[input] + + if found ~= nil then + if found ~= description then + print(input .. " already mapped (" .. found .. " so we cannot re-map (" .. description .. ")") + end + end + + table[input] = description + end +end + +X.check_duplicates = function(type, input, description) + local check_n = false + local check_v = false + local check_i = false + local check_s = false + local check_x = false + + if functions.is_table(type) then + if type["n"] then + check_n = true + end + if type["v"] then + check_v = true + end + if type["i"] then + check_i = true + end + if type["s"] then + check_s = true + end + if type["x"] then + check_x = true + end + else + if type == "n" then + check_n = true + end + if type == "v" then + check_v = true + end + if type == "i" then + check_i = true + end + if type == "s" then + check_s = true + end + if type == "x" then + check_x = true + end + end + + check_and_set_duplicates(input, description, check_n, duplicates_n) + check_and_set_duplicates(input, description, check_v, duplicates_v) + check_and_set_duplicates(input, description, check_i, duplicates_i) + check_and_set_duplicates(input, description, check_s, duplicates_s) + check_and_set_duplicates(input, description, check_x, duplicates_x) +end + +return X diff --git a/neovim/.config/nvim/lua/utils/functions.lua b/neovim/.config/nvim/lua/utils/functions.lua @@ -0,0 +1,126 @@ +local vim = vim + +local X = {} + +---@param on_attach fun(client, buffer) +function X.on_attach(on_attach) + vim.api.nvim_create_autocmd("LspAttach", { + callback = function(args) + local buffer = args.buf + local client = vim.lsp.get_client_by_id(args.data.client_id) + on_attach(client, buffer) + end, + }) +end + +function X.starts_with(str, start) + return str:sub(1, #start) == start +end + +function X.is_table(to_check) + return type(to_check) == "table" +end + +function X.has_key(t, key) + for t_key, _ in pairs(t) do + if t_key == key then + return true + end + end + return false +end + +function X.has_value(t, val) + for _, value in ipairs(t) do + if value == val then + return true + end + end + return false +end + +function X.tprint(table) + print(vim.inspect(table)) +end + +function X.tprint_keys(table) + for k in pairs(table) do + print(k) + end +end + +X.reload = function() + local presentReload, reload = pcall(require, "plenary.reload") + if presentReload then + local counter = 0 + + for moduleName in pairs(package.loaded) do + if X.starts_with(moduleName, "lt.") then + reload.reload_module(moduleName) + counter = counter + 1 + end + end + -- clear nvim-mapper keys + vim.g.mapper_records = nil + vim.notify("Reloaded " .. counter .. " modules!") + end +end + +function X.is_macunix() + return vim.fn.has("macunix") +end + +function X.link_highlight(from, to, override) + local hl_exists, _ = pcall(vim.api.nvim_get_hl_by_name, from, false) + if override or not hl_exists then + -- vim.cmd(("highlight link %s %s"):format(from, to)) + vim.api.nvim_set_hl(0, from, { link = to }) + end +end + +X.highlight = function(group, opts) + vim.api.nvim_set_hl(0, group, opts) +end + +X.highlight_bg = function(group, col) + vim.api.nvim_set_hl(0, group, { bg = col }) +end + +-- Define fg color +-- @param group Group +-- @param color Color +X.highlight_fg = function(group, col) + vim.api.nvim_set_hl(0, group, { fg = col }) +end + +-- Define bg and fg color +-- @param group Group +-- @param fgcol Fg Color +-- @param bgcol Bg Color +X.highlight_fg_bg = function(group, fgcol, bgcol) + vim.api.nvim_set_hl(0, group, { bg = bgcol, fg = fgcol }) +end + +X.from_highlight = function(hl) + local result = {} + local list = vim.api.nvim_get_hl_by_name(hl, true) + for k, v in pairs(list) do + local name = k == "background" and "bg" or "fg" + result[name] = string.format("#%06x", v) + end + return result +end + +X.get_color_from_terminal = function(num, default) + local key = "terminal_color_" .. num + return vim.g[key] and vim.g[key] or default +end + +X.cmd = function(name, command, desc) + vim.api.nvim_create_user_command(name, command, desc) +end + +X.autocmd = function(evt, opts) + vim.api.nvim_create_autocmd(evt, opts) +end +return X diff --git a/neovim/.config/nvim/lua/utils/icons.lua b/neovim/.config/nvim/lua/utils/icons.lua @@ -0,0 +1,69 @@ +return { + diagnostics = { + error = " ", + hint = " ", + information = " ", + other = " ", + warning = " ", + }, + git = { + Added = " ", + Modified = " ", + Removed = " ", + }, + dap = { + breakpoint = " ", + breakpoint_condition = " ", + log_point = " ", + stopped = " ", + breakpoint_rejected = " ", + pause = " ", + play = " ", + step_into = " ", + step_over = " ", + step_out = " ", + step_back = " ", + run_last = " ", + terminate = " ", + }, + lazy = { + cmd = " ", + config = "", + event = "", + ft = " ", + init = " ", + import = " ", + keys = " ", + lazy = "󰒲 ", + loaded = "󱄲", + not_loaded = "󱄯", + plugin = " ", + runtime = " ", + source = " ", + start = "", + task = "✔ ", + list = { + "󱄰", + "➜", + "★", + "‒", + }, + }, + mason = { + package_installed = "󱄲", + package_pending = "󱄰", + package_uninstalled = "󱄯", + }, + borders = { + dashed = { "┄", "┊", "┄", "┊", "╭", "╮", "╯", "╰", }, + double = { "═", "║", "═", "║", "╔", "╗", "╝", "╚", }, + single = { "─", "│", "─", "│", "╭", "╮", "╯", "╰", }, + blocks = { "▀", "▐", "▄", "▌", "▛", "▜", "▟", "▙", }, + blocky = { "▀", "▐", "▄", "▌", "▄", "▄", "▓", "▀", }, + }, + telescope = { + prompt = { "┄", "┊", "┄", "┊", "╭", "╮", "╯", "╰", }, + results = { "┄", " ", "┄", "┊", "╭", "┄", "┄", "╰", }, + preview = { "┄", "┊", "┄", "┊", "┄", "╮", "╯", "╰", }, + }, +} diff --git a/neovim/.config/nvim/lua/utils/remaps.lua b/neovim/.config/nvim/lua/utils/remaps.lua @@ -0,0 +1,60 @@ +local keymap = vim.keymap +local check_duplicates = require("utils.duplicates").check_duplicates + +local X = {} + +local which_key_lazy_registers = nil +local function lazy_register_which_key(input, description) + if which_key_lazy_registers == nil then + which_key_lazy_registers = {} + end + + which_key_lazy_registers[input] = description +end + +local function try_add_to_which_key_by_input(input, description) + local present_which_key, which_key = pcall(require, "which-key") + + local has_leader = string.find(input, "<leader>") + if has_leader then + if present_which_key then + if which_key_lazy_registers ~= nil then + which_key.register(which_key_lazy_registers) + which_key_lazy_registers = nil + end + which_key.register({ + [input] = description, + }) + else + lazy_register_which_key(input, description) + end + end +end + +function X.map(type, input, output, description, additional_options) + local options = { remap = true, desc = description } + if additional_options then + options = vim.tbl_deep_extend("force", options, additional_options) + end + keymap.set(type, input, output, options) + check_duplicates(type, input, description) +end + +function X.noremap(type, input, output, description, additional_options) + local options = { remap = false } + if additional_options then + options = vim.tbl_deep_extend("force", options, additional_options) + end + X.map(type, input, output, description, options) +end + +function X.map_virtual(input, description) + check_duplicates(type, input, description) + try_add_to_which_key_by_input(input, description) +end + +function X.which_key(input, description) + try_add_to_which_key_by_input(input, description) +end + +return X diff --git a/tmux/.config/tmux/tmux.conf b/tmux/.config/tmux/tmux.conf @@ -43,6 +43,7 @@ set -g history-limit 4096 # allow terminal scrolling set-option -g terminal-overrides 'xterm*:smcup@:rmcup@' +set-option -sa terminal-features ",rxvt-unicode-256color:RGB" # vim style copy paste mode #unbind [ diff --git a/zsh/.config/zsh/aliases.zsh b/zsh/.config/zsh/aliases.zsh @@ -75,9 +75,9 @@ command -v gmake >/dev/null && alias make='gmake' # ▓▓▒░ almighty text editor alias \ - v="vim" \ - vi="vim" \ - emacs="vim" + v="nvim" \ + vi="nvim" \ + emacs="nvim" # ▓▓▒░ git @@ -177,7 +177,7 @@ command -v gmake >/dev/null && alias make='gmake' # ▓▓▒░ suffix alias -s \ - md=vim \ + md=nvim \ {png,jpg,jpeg}=sxiv \ pdf=zathura \ mp4=mpv