init.lua (7772B)
1 -- ██ 2 -- ░░ 3 -- ███████ █████ ██████ ██ ██ ██ ██████████ 4 -- ░░██░░░██ ██░░░██ ██░░░░██░██ ░██░██░░██░░██░░██ 5 -- ░██ ░██░███████░██ ░██░░██ ░██ ░██ ░██ ░██ ░██ 6 -- ░██ ░██░██░░░░ ░██ ░██ ░░████ ░██ ░██ ░██ ░██ 7 -- ███ ░██░░██████░░██████ ░░██ ░██ ███ ░██ ░██ 8 -- ░░░ ░░ ░░░░░░ ░░░░░░ ░░ ░░ ░░░ ░░ ░░ 9 -- 10 -- author ▓▒ pyratebeard <root@pyratebeard.net> 11 -- code ▓▒ https://git.pyratebeard.net/dotfiles 12 13 -- ▓▓▒░ general 14 -- security 15 vim.opt.modelines = 0 16 17 -- https://neovim.discourse.group/t/how-do-i-prevent-neovim-commenting-out-next-line-after-a-comment-line/3711/4 18 vim.opt.paste = true 19 20 -- set leader 21 vim.g.mapleader = "," 22 23 -- hide buffers 24 vim.opt.hidden = true 25 26 -- maintain undo history between sessions 27 vim.opt.undofile = true 28 vim.opt.undodir = vim.fn.stdpath("data") .. "/undo" 29 vim.opt.swapfile = false 30 31 -- fuzzy find 32 vim.opt.path:append("**") 33 34 -- lazy file name tab completion 35 vim.opt.wildmode = "list:longest,list:full" 36 vim.opt.wildmenu = true 37 vim.opt.wildignorecase = true 38 39 -- ignore files vim doesnt use 40 vim.opt.wildignore:append(".git,.hg,.svn") 41 vim.opt.wildignore:append(".aux,*.out,*.toc") 42 vim.opt.wildignore:append(".o,*.obj,*.exe,*.dll,*.manifest,*.rbc,*.class") 43 vim.opt.wildignore:append(".ai,*.bmp,*.gif,*.ico,*.jpg,*.jpeg,*.png,*.psd,*.webp") 44 vim.opt.wildignore:append(".avi,*.divx,*.mp4,*.webm,*.mov,*.m2ts,*.mkv,*.vob,*.mpg,*.mpeg") 45 vim.opt.wildignore:append(".mp3,*.oga,*.ogg,*.wav,*.flac") 46 vim.opt.wildignore:append(".eot,*.otf,*.ttf,*.woff") 47 vim.opt.wildignore:append(".doc,*.pdf,*.cbr,*.cbz") 48 vim.opt.wildignore:append(".zip,*.tar.gz,*.tar.bz2,*.rar,*.tar.xz,*.kgb") 49 vim.opt.wildignore:append(".swp,.lock,.DS_Store,._*") 50 vim.opt.wildignore:append(".,..") 51 52 -- case insensitive search 53 vim.opt.ignorecase = true 54 vim.opt.smartcase = true 55 vim.opt.infercase = true 56 57 -- make backspace behave in a sane manner 58 vim.opt.backspace = "indent,eol,start" 59 60 -- searching 61 vim.opt.hlsearch = true 62 vim.opt.incsearch = true 63 vim.opt.inccommand = "split" 64 65 -- use indents of 2 66 vim.opt.shiftwidth = 2 67 68 -- tabs are tabs 69 vim.opt.expandtab = false 70 71 -- an indentation every 2 columns 72 vim.opt.tabstop = 2 73 74 -- let backspace delete indent 75 vim.opt.softtabstop = 2 76 77 -- enable auto indentation 78 vim.opt.autoindent = true 79 80 -- disable pesky mouse 81 vim.opt.mouse = "" 82 83 -- ▓▓▒░ ui 84 -- show matching brackets/parenthesis 85 vim.opt.showmatch = true 86 87 -- disable startup message 88 vim.opt.shortmess:append("sI") 89 90 -- syntax highlighting 91 vim.opt.termguicolors = true 92 vim.opt.synmaxcol = 512 93 94 -- show line numbers 95 vim.opt.number = true 96 97 -- no line wrapping 98 vim.opt.wrap = false 99 vim.opt.linebreak = true 100 101 -- set indents when wrapped 102 vim.opt.breakindent = true 103 104 -- highlight line 105 vim.opt.cursorline = true 106 107 -- cursor always block 108 vim.opt.guicursor = "n-v-i-c:block-Cursor" 109 110 -- show invisibles 111 vim.opt.listchars = { tab = " ", trail = "·", extends = "»", precedes = "«", nbsp = "░" } 112 vim.opt.list = true 113 114 -- split directions 115 vim.opt.fillchars = { vert = "▒" } 116 vim.opt.splitright = true 117 vim.opt.splitbelow = true 118 119 -- 120 --" stop unnecessary rendering 121 --set lazyredraw 122 -- 123 --" no folding 124 --set foldlevel=99 125 --set foldminlines=99 126 -- 127 128 --" MACROS 129 --" target blank links 130 --" used in blog md files 131 --let @t='{target="_blank" rel="noreferrer"}' 132 133 -- ▓▓▒░ commands 134 local f = require("utils.functions") 135 local r = require("utils.remaps") 136 137 -- remove highlighting 138 r.noremap("n", "<esc><esc>", ":nohlsearch<cr>", "remove highlighting", { silent = true }) 139 140 -- vertical term 141 -- TODO auto append when term opens 142 r.noremap("n", "<leader>z", ":cd %:h | :vs | :set nu! | :term<cr>", "vertical terminal", { silent = true }) 143 r.noremap("n", "<leader>Z", ":cd %:h | :split | :set nu! | :term<cr>", "terminal", { silent = true }) 144 145 -- remove trailing white space 146 f.cmd("Nows", "%s/\\s\\+$//e", { desc = "remove trailing whitespace" }) 147 148 -- remove blank lines 149 f.cmd("Nobl", "g/^\\s*$/d", { desc = "remove blank lines" }) 150 151 -- the worst place in the world 152 r.noremap("n", "Q", "<nop>", "") 153 154 -- wrap and spellcheck when writing 155 -- nnoremap <C-w>w :set wrap<CR>:Spell<CR> 156 f.cmd("Sp", "setlocal spell! spell?", { desc = "toggle spell check" }) 157 r.noremap("n", "<leader>s", ":Sp<cr>", "toggle spell check") 158 r.noremap("n", "<leader>sw", ":set wrap<cr>:Sp<cr>", "wrap and toggle spell check") 159 160 -- make current buffer executable 161 f.cmd("Chmodx", "!chmod a+x %", { desc = "make current buffer executable" }) 162 r.noremap("n", "<leader>x", ":Chmodx<cr>", "chmod +x buffer") 163 164 -- telescope keymap 165 -- https://github.com/helix-editor/helix/discussions/11537 166 vim.keymap.set("n", "<space>fb", ":Telescope file_browser path=%:p:h select_buffer=true<CR>") 167 168 -- 169 -- vnoremap <silent> <leader>y :w !xsel -i -b<CR> 170 -- nnoremap <silent> <leader>y V:w !xsel -i -b<CR> 171 -- nnoremap <silent> <leader>p :silent :r !xsel -o -b<CR> 172 -- 173 -- " switch tabs 174 -- nnoremap <C-n> :tabn<CR> 175 -- nnoremap <C-p> :tabp<CR> 176 -- 177 -- " nerdtree 178 -- nnoremap <C-j> :NERDTreeToggle<CR> 179 -- 180 -- " toggle autoindent 181 -- nnoremap <F8> :setl noai<CR> 182 -- nnoremap <F9> :setl ai<CR> 183 -- 184 -- " goyo 185 -- nnoremap <C-w>g :Goyo<CR> 186 -- 187 -- " start webserver 188 -- "nnoremap <leader>h :!busybox httpd -f -h . -p 8080 189 -- 190 -- " list buffers and wait for number 191 -- nnoremap <leader>b :ls<CR>:b 192 -- 193 -- " fzf 194 -- "nnoremap <leader>f :cd $HOME/src <bar>FZF<CR> 195 -- nnoremap <leader>f :cd %:p:h <bar>FZF<CR> 196 -- 197 -- " list registers 198 -- nnoremap <leader>r :registers<CR> 199 -- 200 -- " swap ' and ` for marks 201 -- nnoremap ' ` 202 -- nnoremap ` ' 203 -- " columns 204 -- " 80 soft 120 hard 205 -- let &colorcolumn="80" 206 -- 207 -- " COMMANDS 208 -- " json pretty print 209 -- command J :%!python -mjson.tool 210 -- 211 -- " git commit shortcut 212 -- command Ga Git add % 213 -- command Gc Git commit -S 214 -- command Gac Git commit -a -S -m "updates" 215 -- command Gf Git fetch 216 -- command Gp Git push 217 -- command -nargs=* Gco Git checkout 218 -- command Gm Git merge 219 220 -- ▓▓▒░ plugins 221 -- TODO lightline 222 local pluginspath = vim.fn.stdpath("data") .. "/lazy" 223 local lazypath = pluginspath .. "/lazy.nvim" 224 225 -- install lazy 226 if not vim.loop.fs_stat(lazypath) then 227 vim.fn.system({ 228 "git", 229 "clone", 230 "--filter=blob:none", 231 "--single-branch", 232 "https://github.com/folke/lazy.nvim.git", 233 lazypath, 234 }) 235 end 236 vim.opt.runtimepath:prepend(lazypath) 237 238 -- use a protected call so we don't error out on first use 239 local status_ok, lazy = pcall(require, "lazy") 240 if not status_ok then 241 print("lazy just installed, please restart neovim") 242 return 243 end 244 245 ---- install plugins 246 lazy.setup({ 247 spec = { 248 --require("plugins.alpha"), 249 250 -- utilites 251 require("plugins.fzf"), 252 require("plugins.telescope"), 253 require("plugins.vimwiki"), 254 255 -- git 256 require("plugins.git"), 257 require("plugins.gitsigns"), 258 259 -- ui 260 require("plugins.indent"), 261 require("plugins.lualine"), 262 require("plugins.lush"), 263 264 -- colours 265 require("plugins.oldriceputin"), 266 require("plugins.sourcery"), 267 require("plugins.goblinmode"), 268 }, 269 dev = { 270 path = "~/.local/src/warez", 271 }, 272 lockfile = vim.fn.stdpath("config") .. "/lua/plugins/lazy-lock.json", 273 ui = { 274 size = { width = 0.8, height = 0.8 }, 275 wrap = true, 276 border = "shadow", 277 icons = require("utils.icons").lazy, 278 }, 279 performance = { 280 cache = { 281 enabled = true, 282 }, 283 reset_packpath = true, 284 rtp = { 285 disabled_plugins = { 286 "netrwPlugin", 287 }, 288 }, 289 }, 290 })