dotfiles

Cross platform dotfiles for linux, mac and windows

commit 82d49e7e5a80ab99e82b77a8b64759d3eed71fac
parent e1e765a29512a897848b2065201d726ff7d09aef
Author: Bharatvaj <bharatvaj@yahoo.com>
Date: Thu, 28 Jul 2022 00:43:02 +0530

nvim: Move from vimrc to init.lua

Add: nvim: Hyper Red theme

Modify: songdl: do `mpc update` after download

Modify: lynx: video, audio, downlaod, external browser integration

NOTE: I love MY hyper-red theme. It's my new favourite. My shell
feels like home after a long time :)

BUG: Sometimes vim is sourcing neovim runtime files.
20 files changed, 217 insertions(+), 20 deletions(-)
diff --git a/.config/.gitignore b/.config/.gitignore
@@ -36,3 +36,5 @@ cmd/userenv.bat
 !wgetrc
 
 alacritty/windows.yml
+alacritty/mac.yml
+alacritty/light-theme.yml
diff --git a/.config/lynx/lynx.cfg b/.config/lynx/lynx.cfg
@@ -27,10 +27,14 @@ NO_PAUSE:TRUE
 
 USE_EXTERNALS:TRUE
 DEFAULT_USER_MODE:ADVANCED
-EXTERNAL:http:open -u %s &:TRUE
+EXTERNAL_MENU:http:browser:open -u %s &:TRUE
+# TODO use a common clipboard program
+EXTERNAL_MENU:http:copy:printf %s | pbcopy :TRUE
+EXTERNAL_MENU:http:video:mpv %s &:TRUE
+EXTERNAL_MENU:http:videodl:youtube-dl -q --no-warnings %s &:TRUE
+EXTERNAL_MENU:http:songdl:songdl %s &:TRUE
+EXTERNAL_MENU:http:wget:wget %s &:TRUE
 KEYMAP:o:ECGOTO
 KEYMAP:O:GOTO
 KEYMAP:g:HOME
 KEYMAP:G:END
-
-DOWNLOADER:wget:wget %s:TRUE
diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua
@@ -1,19 +1,53 @@
 vim.g.mapleader = ' '
 local set = vim.opt
+local g = vim.g
 
 set.packpath="$XDG_DATA_HOME/nvim"
 
 local map = require("utils").map
+require("keybindings")
 
-map("n", "<Leader>ww", ":w<CR>", { silent = true })
-map("n", "<Leader>wq", ":wq<CR>", { silent = true })
-map("n", "<Leader>qq", ":q<CR>", { silent = true })
-map("n", "<CR>", ":noh<CR>", { silent = true })
 
 set.tabstop=4
-set.exrc=false
+set.number=true
+set.laststatus=1
+set.expandtab=false
 
+set.hlsearch=true
+set.incsearch=true
+set.wrapscan=false
+set.ignorecase=true
+set.smartcase=true
 
-require'lspconfig'.pyright.setup{}
+require'lspconfig'.clangd.setup{}
 
 set.shortmess="Iat"
+
+g.netrw_banner = 0
+g.netrw_liststyle = 3
+
+require('nvim_comment').setup()
+
+vim.cmd([[
+function! s:load_plugins(t) abort
+	packadd vim-fugitive
+endfunction
+
+augroup user_cmds
+	autocmd!
+	autocmd VimEnter * call timer_start(20, function('s:load_plugins'))
+augroup END
+]])
+
+-- theme
+-- hyper-red
+-- TODO use lua api
+vim.cmd('hi StatusLine ctermbg=white ctermfg=red')
+vim.cmd('hi StatusLineNC ctermbg=white ctermfg=black')
+vim.cmd('hi LineNr ctermbg=NONE ctermfg=red')
+vim.cmd('set fillchars=vert:\\│')
+vim.cmd('hi VertSplit term=NONE cterm=NONE gui=NONE')
+vim.cmd('hi SignColumn ctermbg=NONE guibg=NONE')
+
+
+
diff --git a/.config/nvim/lua/keybindings.lua b/.config/nvim/lua/keybindings.lua
@@ -1,10 +1,113 @@
+-- keybindings
+local set = vim.opt
+
+function save_and_build()
+-- TODO require vim-dispatch
+		vim.cmd('wall')
+		vim.cmd('Make')
+end
+
+function toggle_list(is_local_buffer)
+	-- TODO implement toggle for all buffers
+	local optset=vim.o
+	if optset.list then
+		optset.list=false
+	else
+		optset.list=true
+	end
+end
+
+function file_mv_helper()
+	vim.cmd('normal! 0i"A"0y$A p0imv j0')
+end
+
+-- Run Make
 local map = require("utils").map
+-- general
+map("n", "<leader>co", ":copen<cr>", { silent = false })
+map("n", "<leader>cs", ":cdo<space>s/", { silent = false })
+map("n", "<leader>ec", ":edit $XDG_CONFIG_HOME/nvim/init.lua<cr>", { silent = true })
+map("n", "<leader>ek", ":edit $XDG_CONFIG_HOME/nvim/lua/keybindings.lua<cr>", { silent = false })
+map("n", "<leader>et", ":set expandtab<cr>", { silent = false })
+map("n", "<leader>ff", ":find *", { silent = false })
+map("n", "<leader>lb", ":ls<CR>:b<space>", { silent = false })
+map("n", "<leader>lo", ":lopen<cr>", { silent = false })
+map("n", "<leader>ls", ":ldo<space>s/", { silent = false })
+map("n", "<leader>p", ":Rg<cr>", { silent = false })
+map("n", "<leader>sc", ":source $XDG_CONFIG_HOME/nvim/init.lua<cr>", { silent = false })
+map("n", "<leader>so", ":source %<cr>", { silent = false })
+map("n", "<leader>tl", ":lua toggle_list(true)<CR>", { silent = true })
+map("n", "<leader>tt", ":tabnew<cr>", { silent = false })
+map("n", "<leader>vg", ":vimgrep<space>", { silent = false })
+
+-- quick write and quit
 map("n", "<Leader>ww", ":w<CR>", { silent = true })
 map("n", "<Leader>wq", ":wq<CR>", { silent = true })
 map("n", "<Leader>qq", ":q<CR>", { silent = true })
-map("n", "<CR>", ":noh<CR>", { silent = true })
+map("n", "<leader>cs", ":noh<CR>", { silent = true })
 
-map("n", "<leader>f", ":find ", { silent = false })
-map("n", "<leader>co", ":copen<cr>", { silent = false })
-map("n", "<leader>g", ":grep ", { silent = false})
-map("n", "<leader>ec", ":edit ~/.config/nvim/init.lua<cr>", { silent = false})
+-- buffers
+map("n", "<leader>sc", ":source ~/.config/vim/vimrc<enter>", { silent = true })
+map("n", "<leader>ss", ":split<enter>", { silent = true })
+map("n", "<leader>vv", ":vsplit<enter>", { silent = true })
+
+-- vimspector
+map("n", "<leader>dd", ":call vimspector#Launch()<CR>", { silent = true })
+map("n", "<leader>dc", ":call GotoWindow(g:vimspector_session_windows.code)<CR>", { silent = true })
+map("n", "<leader>dt", ":call GotoWindow(g:vimspector_session_windows.tagpage)<CR>", { silent = true })
+map("n", "<leader>dv", ":call GotoWindow(g:vimspector_session_windows.variables)<CR>", { silent = true })
+map("n", "<leader>dw", ":call GotoWindow(g:vimspector_session_windows.watches)<CR>", { silent = true })
+map("n", "<leader>ds", ":call GotoWindow(g:vimspector_session_windows.stack_trace)<CR>", { silent = true })
+map("n", "<leader>do", ":call GotoWindow(g:vimspector_session_windows.output)<CR>", { silent = true })
+map("n", "<leader>de", ":call vimspector#Reset()<CR>", { silent = true })
+
+map("n", "<leader>dtcb", ":call vimspector#CleanLineBreakpoint()<CR>", { silent = true })
+
+map("n", "<leader>dl", "<Plug>VimspectorStepInto", { silent = true })
+map("n", "<leader>dj", "<Plug>VimspectorStepOver", { silent = true })
+map("n", "<leader>dk", "<Plug>VimspectorStepOut", { silent = true })
+map("n", "<leader>d_", "<Plug>VimspectorRestart", { silent = true })
+map("n", "<leader>d<space>", ":call vimspector#Continue()<CR>", { silent = true })
+
+map("n", "<leader>drc", "<Plug>VimspectorRunToCursor", { silent = true })
+map("n", "<leader>dbp" , "<Plug>VimspectorToggleBreakpoint", { silent = true })
+map("n", "<leader>dcbp", "<Plug>VimspectorToggleConditionalBreakpoint", { silent = true })
+
+map("n", "<leader>bb", ":lua save_and_build()<CR>", { silent = false })
+
+-- quick navigation
+-- telscope.nvim
+map("n", "<leader><leader>", ":Telescope find_files<cr>", { silent = true })
+
+-- file helpers
+map("n", "<leader>fmv", "lua file_mv_helper()",  { silent = true })
+
+-- doc functions
+function doc_quick_underline(n)
+	if (n == 1) then
+		vim.cmd('normal! yypv$r=')
+	else
+		vim.cmd('normal! yypv$r-')
+	end
+end
+
+function reverse_date()
+	vim.cmd('normal! dt/wwpldeBP')
+end
+
+map("n", "<leader>h1", ":lua doc_quick_underline(1)<cr>", { silent = true });
+map("n", "<leader>h2", ":lua doc_quick_underline(2)<cr>", { silent = true });
+
+
+map("n", "<leader>ct", ":ChecklistToggleCheckbox<cr>", { silent = true });
+map("n", "<leader>ce", ":ChecklistEnableCheckbox<cr>", { silent = true });
+map("n", "<leader>cd", ":ChecklistDisableCheckbox<cr>", { silent = true });
+map("n", "<leader>ct", ":ChecklistToggleCheckbox<cr>", { silent = true });
+map("n", "<leader>ce", ":ChecklistEnableCheckbox<cr>", { silent = true });
+map("n", "<leader>cd", ":ChecklistDisableCheckbox<cr>", { silent = true });
+
+-- vim.g.checklist_filetypes:append('adoc', 'md')
+
+-- vim-fugitive
+map("n", "<leader>gg", ":Ggrep<space>", { silent = false });
+map("n", "<leader>lg", ":Glgrep<space>", { silent = false });
diff --git a/.config/sh/aliases b/.config/sh/aliases
@@ -36,6 +36,6 @@ alias f='find . -name '
 alias g='git'
 alias g=git
 alias l=lfcd
-alias n='nvim'
+alias n='unset_viminit_nvim'
 alias v='vim'
 alias x=extract_archive
diff --git a/.config/sh/functions b/.config/sh/functions
@@ -41,3 +41,7 @@ quickopen() {
 		${1} "$(find . -type $2 -maxdepth 3 2>/dev/null | ${FUZZER})"
 	fi
 }
+
+unset_viminit_nvim() {
+	VIMINIT="" nvim $*
+}
diff --git a/.config/tmux/tmux.conf b/.config/tmux/tmux.conf
@@ -15,10 +15,12 @@ bind s split-window -v
 # Navigation
 set-window-option -g mode-keys vi
 
-bind -n C-h select-pane -L
-bind -n C-j select-pane -D
-bind -n C-k select-pane -U
-bind -n C-l select-pane -R
+bind h select-pane -L
+bind j select-pane -D
+bind k select-pane -U
+bind l select-pane -R
+
+bind u last-window
 
 bind J resize-pane -D 5
 bind K resize-pane -U 5
diff --git a/.config/vim/vimrc b/.config/vim/vimrc
@@ -5,6 +5,7 @@ if !has('nvim')
 endif
 
 " General
+set nocompatible
 set number
 set mouse=
 set nocursorline

@@ -33,6 +34,7 @@ set shortmess=Iat
 " Search
 set hlsearch
 set incsearch
+set nowrapscan
 
 " Pro tab
 filetype plugin indent on

@@ -45,7 +47,6 @@ let g:netrw_liststyle = 3
 
 " Disable status
 set laststatus=1
-set nowrapscan
 
 set lazyredraw
 set ttyfast
diff --git a/.gitmodules b/.gitmodules
@@ -64,3 +64,36 @@
 [submodule ".local/share/vim/pack/general/start/ctrlp.vim"]
 	path = .local/share/vim/pack/general/start/ctrlp.vim
 	url = https://github.com/kien/ctrlp.vim
+[submodule ".local/share/nvim/pack/general/start/telescope.nvim"]
+	path = .local/share/nvim/pack/general/start/telescope.nvim
+	url = https://github.com/nvim-telescope/telescope.nvim
+[submodule ".local/share/nvim/pack/general/start/plenary.nvim"]
+	path = .local/share/nvim/pack/general/start/plenary.nvim
+	url = https://github.com/nvim-lua/plenary.nvim
+[submodule ".local/share/nvim/pack/general/start/vim-dispatch"]
+	path = .local/share/nvim/pack/general/start/vim-dispatch
+	url = https://github.com/tpope/vim-dispatch
+[submodule ".local/share/nvim/pack/general/start/vim-dispatch-neovim"]
+	path = .local/share/nvim/pack/general/start/vim-dispatch-neovim
+	url = https://github.com/radenling/vim-dispatch-neovim
+[submodule ".local/share/nvim/pack/general/start/vim-tmux-navigator"]
+	path = .local/share/nvim/pack/general/start/vim-tmux-navigator
+	url = https://github.com/christoomey/vim-tmux-navigator
+[submodule ".local/share/nvim/pack/development/start/nvim-dap"]
+	path = .local/share/nvim/pack/development/start/nvim-dap
+	url = https://github.com/mfussenegger/nvim-dap
+[submodule ".local/share/nvim/pack/general/start/nvim-comment"]
+	path = .local/share/nvim/pack/general/start/nvim-comment
+	url = https://github.com/terrortylor/nvim-comment
+[submodule ".local/share/nvim/pack/development/opt/vimspector"]
+	path = .local/share/nvim/pack/development/opt/vimspector
+	url = https://github.com/puremourning/vimspector
+[submodule ".local/share/vim/pack/general/start/vim-checklist"]
+	path = .local/share/vim/pack/general/start/vim-checklist
+	url = https://github.com/evansalter/vim-checklist
+[submodule ".local/share/nvim/pack/general/opt/vim-fugitive"]
+	path = .local/share/nvim/pack/general/opt/vim-fugitive
+	url = https://git::@github.com/tpope/vim-fugitive.git
+[submodule ".local/share/nvim/pack/general/start/vim-unimpaired"]
+	path = .local/share/nvim/pack/general/start/vim-unimpaired
+	url = https://github.com/tpope/vim-unimpaired
diff --git a/.local/bin/sh/songdl b/.local/bin/sh/songdl
@@ -9,3 +9,7 @@ cd "$SONGDL_HOME"
 song_name=$1
 
 youtube-dl --external-downloader aria2c --extract-audio --audio-format mp3 "$song_name"
+
+if type mpc >/dev/null; then
+	mpc update
+fi
diff --git a/.local/share/nvim/pack/development/opt/vimspector b/.local/share/nvim/pack/development/opt/vimspector
@@ -0,0 +1 @@
+Subproject commit a17d1e12450d3a2e55bb442a1091a1cff99bc5e2
diff --git a/.local/share/nvim/pack/development/start/nvim-dap b/.local/share/nvim/pack/development/start/nvim-dap
@@ -0,0 +1 @@
+Subproject commit d2fcb949cd25fcdee0481a79672297082fc6c39e
diff --git a/.local/share/nvim/pack/general/opt/vim-fugitive b/.local/share/nvim/pack/general/opt/vim-fugitive
@@ -0,0 +1 @@
+Subproject commit 9a13fc87c4ab83ea81e71ccad9b846a5eb31a998
diff --git a/.local/share/nvim/pack/general/start/nvim-comment b/.local/share/nvim/pack/general/start/nvim-comment
@@ -0,0 +1 @@
+Subproject commit 861921706a39144ea528a6200a059a549b02d8f0
diff --git a/.local/share/nvim/pack/general/start/plenary.nvim b/.local/share/nvim/pack/general/start/plenary.nvim
@@ -0,0 +1 @@
+Subproject commit 986ad71ae930c7d96e812734540511b4ca838aa2
diff --git a/.local/share/nvim/pack/general/start/telescope.nvim b/.local/share/nvim/pack/general/start/telescope.nvim
@@ -0,0 +1 @@
+Subproject commit b5833a682c511885887373aad76272ad70f7b3c2
diff --git a/.local/share/nvim/pack/general/start/vim-dispatch b/.local/share/nvim/pack/general/start/vim-dispatch
@@ -0,0 +1 @@
+Subproject commit 00e77d90452e3c710014b26dc61ea919bc895e92
diff --git a/.local/share/nvim/pack/general/start/vim-tmux-navigator b/.local/share/nvim/pack/general/start/vim-tmux-navigator
@@ -0,0 +1 @@
+Subproject commit 9ca5bfe5bd274051b5dd796cc150348afc993b80
diff --git a/.local/share/nvim/pack/general/start/vim-unimpaired b/.local/share/nvim/pack/general/start/vim-unimpaired
@@ -0,0 +1 @@
+Subproject commit efdc6475f7ea789346716dabf9900ac04ee8604a
diff --git a/.local/share/vim/pack/general/start/vim-checklist b/.local/share/vim/pack/general/start/vim-checklist
@@ -0,0 +1 @@
+Subproject commit a63f22fdd1acfff7f4db3f79641135b9dc9a36fb