Compare commits

...

3 Commits

Author SHA1 Message Date
randomuser 2d8d1733be misc vim changes 2023-01-14 20:18:45 -06:00
randomuser 346fda912e misc changes 2023-01-14 20:17:33 -06:00
randomuser 6abaea7a5b port neovim configuration over 2023-01-14 20:17:04 -06:00
9 changed files with 150 additions and 2967 deletions

1
.gitignore vendored
View File

@ -17,3 +17,4 @@ htop/htop
tridactyl/tridactyl
nvim/autoload/plug.vim.old
nvim/spell/
nvim/plugin

View File

@ -7,7 +7,10 @@ install: .environment
location_setup:
mkdir -p $(LOCATION)/
install_theme:
mkdir -p $(HOME)/.themes
mkdir -p $(HOME)/.local/share/firefox/.themes
ln -sf $(CURDIR)/earth $(HOME)/.themes/
ln -sf $(CURDIR)/earth $(HOME)/.local/share/firefox/.themes
install_bspwm:
ln -sf $(CURDIR)/bspwm $(LOCATION)/
install_nvim:

View File

@ -75,7 +75,8 @@ record() {
printf "> written to %s\n" "$tmp.mp4"
while true; do
result=$(printf "delete\nupload to pastebin\nreview footage\nquit\n" | fzy --prompt="what next?")
set -x
result=$(printf "delete\nmove to home directory\nupload to pastebin\nreview footage\nquit\n" | fzy --prompt="what next? ")
case "$result" in
*upload*)
paste "$tmp.mp4" | xclip -i
@ -87,6 +88,11 @@ record() {
rm "$tmp.mp4"
return
;;
*home*)
name=$(echo "capture.mp4" | fzy --prompt="name please? ")
mv "$tmp.mp4" "$HOME/$name.mp4"
return
;;
*quit*)
return
;;

View File

@ -23,4 +23,4 @@ bspc rule -a statusbar border=off sticky=on state=floating manage=off
bspc rule -a tmenu-prompt border=on sticky=on state=floating
bspc rule -a Xmessage border=on state=floating
bspc rule -a Zathura state=tiled
bspc rule -a generic-st-window state=floating
bspc rule -a generic-st-window state=floating manage=on sticky=on border=on

File diff suppressed because it is too large Load Diff

137
nvim/init.lua Normal file
View File

@ -0,0 +1,137 @@
-- randomuser's
-- _ _ _ _
-- (_)_ __ (_) |_ | |_ _ __ _
-- | | '_ \| | __| | | | | |/ _` |
-- | | | | | | |_ _| | |_| | (_| |
-- |_|_| |_|_|\__(_)_|\__,_|\__,_|
-- helper functions {{{
function nnoremap(l, r)
vim.keymap.set('n', l, r) -- noremap is implied
end
function inoremap(l, r)
vim.keymap.set('i', l, r)
end
function tnoremap(l, r)
vim.keymap.set('t', l, r)
end
-- }}}
-- custom mappings {{{
vim.g.mapleader = ' '
nnoremap(';', ':')
nnoremap(':', ';')
nnoremap('<leader><leader>', ':')
-- source init.vim
nnoremap('<leader>rr', function()
vim.cmd.source('~/.config/nvim/init.lua')
end)
-- edit init.vim
nnoremap('<leader>re', function()
vim.cmd.edit('~/.config/nvim/init.lua')
end)
-- openup netrw
nnoremap('<leader>fs', function()
vim.cmd.Lexplore()
end)
inoremap('qp', '<c-g>u<Esc>[s1z=`]a<c-g>u')
inoremap("<C-a>", "<Esc>mZ0i<Tab><Esc>`ZlA")
tnoremap('<Esc>', '<C-\\><C-n>')
-- }}}
-- autocommands {{{
-- swapfile handler
vim.api.nvim_create_autocmd({"SwapExists"}, {
pattern = {"*"},
callback = function()
vim.fn.system("vim-swap-handler " .. vim.api.nvim_buf_get_name(0))
print(vim.v.shell_error)
if (vim.v.shell_error == 0) then
vim.v.swapchoice = 'o'
print("opened in other place. you should have teleported there")
elseif (vim.v.shell_error == 1) then
vim.v.swapchoice = 'o'
print("file opened readonly. orphaned swap file?")
end
end
})
-- autocmds for sxhkd and bspwm config files
vim.api.nvim_create_autocmd({"BufWrite"}, {
pattern = {"bspwmrc"},
callback = function()
vim.fn.system("bspc wm -r")
end
})
vim.api.nvim_create_autocmd({"BufWrite"}, {
pattern = {"sxhkdrc"},
callback = function()
vim.fn.system("killall sxhkd -USR1")
end
})
-- autocmds for python
vim.api.nvim_create_autocmd({"Filetype"}, {
pattern = {"python"},
callback = function()
vim.bo.expandtab = true
vim.bo.tabstop = 4
vim.bo.shiftwidth = 4
end
})
-- }}}
-- vim options {{{
vim.o.compatible = false
vim.o.number = true
vim.o.foldmethod = 'marker'
vim.o.encoding = 'utf8'
vim.o.list = true
vim.o.lcs = 'tab:->,trail:_,eol:^'
vim.o.clipboard = 'unnamedplus'
vim.o.spell = true
vim.o.spelllang = "en_us"
vim.o.title = true
vim.o.ts = 2
vim.o.sw = 2
vim.o.hlsearch = true
vim.o.incsearch = true
vim.o.ignorecase = true
vim.o.smartcase = true
vim.o.inccommand = 'nosplit'
vim.o.hidden = true
vim.opt.path:append {'**'}
vim.cmd.colorscheme('earth')
vim.o.statusline="%f %r%m%q%h%=%y 0x%02B %04l:%03c:%03p"
vim.api.nvim_exec("let &titlestring='%{expand(\"%:p\")}'", true)
-- }}}
-- packer.nvim {{{
-- taken from packer.nvim readme
local ensure_packer = function()
local fn = vim.fn
local install_path = fn.stdpath('data') .. '/site/pack/packer/start/packer.nvim'
if fn.empty(fn.glob(install_path)) > 0 then
fn.system({'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path})
vim.cmd [[packadd packer.nvim]]
return true
end
return false
end
local packer_bootstrap = ensure_packer()
return require('packer').startup(function(use)
use 'wbthomason/packer.nvim'
use 'vimwiki/vimwiki'
if packer_bootstrap then
require('packer').sync()
end
end)
-- }}}

View File

@ -1,116 +0,0 @@
" randomuser's vimrc
" vim-plug {{{
call plug#begin()
Plug 'tridactyl/vim-tridactyl'
Plug 'vimwiki/vimwiki'
cal plug#end()
" }}}
" misc {{{
nnoremap ; :
nnoremap : ;
let mapleader = " "
set nocompatible
" }}}
" defined settings {{{
set number
set foldmethod=marker
set encoding=utf8
set list
set lcs=tab:->,trail:_,eol:^
set clipboard=unnamedplus
set spell
set spelllang=en_us
set title
set ts=2
set sw=2
set hlsearch
set incsearch
set ignorecase
set smartcase
set inccommand=nosplit
set nocompatible
set hidden
set path+=**
set wildmenu
colorscheme earth
" }}}
" shortcuts {{{
" toggle line numbers and listchars
nnoremap <Leader>ym :set number!<CR>:set list!<CR>
" vimrc thing
nnoremap <Leader>rr :source ~/.config/nvim/init.vim<CR>
nnoremap <Leader>re :edit ~/.config/nvim/init.vim<CR>
" show the file explorer
nnoremap <Leader>fs :Lexplore<CR>
" show the shortcuts in the vimrc
nnoremap <Leader>ke :e ~/.config/nvim/init.vim <CR>ggzR/shortcuts<CR>z<CR>
" jk to escape insert mode
inoremap jk <esc>
" go back to the previous error, then correct
inoremap <C-d> <c-g>u<Esc>[s1z=`]a<c-g>u
inoremap qp <c-g>u<Esc>[s1z=`]a<c-g>u
inoremap <C-s> <Esc>zgi
inoremap qo <Esc>zgi
nnoremap <C-s> zg
tnoremap <Esc> <C-\><C-n>
nnoremap <Leader>wl <C-w>\<
nnoremap <Leader>wr <C-w>\>
nnoremap <Leader>wd <C-w>-
nnoremap <Leader>wu <C-w>+
nnoremap <Leader>mk :make<CR>:spl<CR>:terminal ./main<CR>
nnoremap <Leader>w<Leader>I :VimwikiDiaryIndex<CR>
inoremap <C-a> <Esc>mZ0i<Tab><Esc>`ZlA
" }}}
" autocmds {{{
au Filetype python setl et ts=4 sw=4
function SwapExistsHandler()
silent !vim-swap-handler "%:p"
if v:shell_error == 0
let v:swapchoice='o'
return
elseif v:shell_error == 1
let v:swapchoice='o'
echom "The file has been opened read-only, as there is not another vim instance editing this file."
elseif v:shell_error == 127
echom "The vim-swap-handler command doesn't exist."
else
echom "An unknown error occurred."
endif
endfunction
autocmd SwapExists * call SwapExistsHandler()
au BufWrite bspwmrc !bspc wm -r
au BufWrite sxhkdrc !killall sxhkd -USR1
" }}}
" statusline {{{
set statusline=%f
set statusline+=\
set statusline+=%r%m%q%h
set statusline+=%=
set statusline+=%y\ 0x%02B\ %04l:%03c:%03p
" }}}
" titlebar {{{
let &titlestring='%{expand("%:p")}'
" }}}
" netrw {{{
let g:netrw_banner=0
" }}}
" ultisnips {{{
let g:UltiSnipsExpandTrigger = '<tab>'
let g:UltiSnipsJumpForwardTrigger="<c-b>"
let g:UltiSnipsJumpBackwardTrigger="<c-z>"
" }}}

View File

@ -1,37 +0,0 @@
noremap = { noremap = true }
function nnoremap(l, r)
vim.keymap.set('n', l, r, noremap)
end
vim.env.mapleader = ' '
nnoremap(';', ':')
nnoremap(':', ';')
-- nnoremap('<leader>ym', ':set number!<CR>:set list!<CR>')
-- nnoremap('<leader>rr', function() vim.cmd.source('~/.config/nvim/init.lua') end)
-- nnoremap('<leader>re', function() vim.cmd.edit('~/.config/nvim/init.lua') end)
vim.keymap.set('n', '<leader>rr', function() vim.cmd.source('~/.config/nvim/init.lua') end)
-- conf.nocompatible = true
-- not sure why this does not work
-- will checkout later
vim.o.number = true
vim.o.foldmethod = 'marker'
vim.o.encoding = 'utf8'
vim.o.list = true
vim.o.lcs = 'tab:->,trail:_,eol:^'
vim.o.clipboard = 'unnamedplus'
vim.o.spell = true
vim.o.spelllang = "en_us"
vim.o.title = true
vim.o.ts = 2
vim.o.sw = 2
vim.o.hlsearch = true
vim.o.incsearch = true
vim.o.ignorecase = true
vim.o.smartcase = true
vim.o.inccommand = 'nosplit'
vim.o.hidden = true
vim.opt.path:append {'**'}
vim.cmd.colorscheme('earth')

View File

@ -3,6 +3,7 @@ setxkbmap -option caps:super
killall xcape
xcape -e 'Super_L=Escape'
xset -q | grep "Caps Lock:\s*on" && xdotool key Caps_Lock
xset r rate 200 40
# start the wm
sxhkd &