Browse Source

Sat 16 Jul 2022 23:26:08 ACST

master
Tovi Jaeschke-Rogers 2 years ago
parent
commit
09d9c99b0d
4 changed files with 225 additions and 213 deletions
  1. +202
    -201
      .config/nvim/init.vim
  2. +1
    -1
      .local/bin/dwm-autostart
  3. +2
    -2
      .local/bin/dwm-sss
  4. +20
    -9
      .zshrc

+ 202
- 201
.config/nvim/init.vim View File

@ -16,24 +16,23 @@ endfunction
call plug#begin('~/.config/nvim/plugged')
if !exists('g:vscode')
Plug 'neoclide/coc.nvim', Cond(!exists('g:vscode'))
Plug 'neoclide/coc.nvim', Cond(!exists('g:vscode'))
Plug 'nvim-lua/popup.nvim', Cond(!exists('g:vscode'))
Plug 'nvim-lua/plenary.nvim', Cond(!exists('g:vscode'))
Plug 'nvim-telescope/telescope.nvim', Cond(!exists('g:vscode'))
Plug 'nvim-telescope/telescope-fzy-native.nvim', Cond(!exists('g:vscode'))
Plug 'nvim-lua/popup.nvim', Cond(!exists('g:vscode'))
Plug 'nvim-lua/plenary.nvim', Cond(!exists('g:vscode'))
Plug 'nvim-telescope/telescope.nvim', Cond(!exists('g:vscode'))
Plug 'nvim-telescope/telescope-fzy-native.nvim', Cond(!exists('g:vscode'))
Plug 'Rican7/php-doc-modded'
Plug 'Rican7/php-doc-modded'
Plug 'udalov/kotlin-vim'
Plug 'f-person/git-blame.nvim'
Plug 'udalov/kotlin-vim'
Plug 'f-person/git-blame.nvim'
Plug 'vimwiki/vimwiki', Cond(!exists('g:vscode'))
Plug 'vimwiki/vimwiki', Cond(!exists('g:vscode'))
Plug 'ap/vim-css-color', Cond(!exists('g:vscode'))
Plug 'ap/vim-css-color', Cond(!exists('g:vscode'))
endif
Plug 'dart-lang/dart-vim-plugin'
Plug 'fatih/vim-go', { 'do': ':GoUpdateBinaries' }
Plug 'darrikonn/vim-gofmt', { 'do': ':GoUpdateBinaries' }
@ -47,194 +46,196 @@ set incsearch
set ignorecase
autocmd BufWritePre * :%s/\s\+$//e
set go=a
set mouse=a
set smartcase
set linebreak
set noswapfile
set nobackup
set undodir=~/.config/nvim/undodir
set undofile
nnoremap c "_c
set nocompatible
filetype plugin on
syntax on
set encoding=utf-8
set number relativenumber
if !exists('g:vscode')
set go=a
set mouse=a
set smartcase
set linebreak
set noswapfile
set nobackup
set undodir=~/.config/nvim/undodir
set undofile
nnoremap c "_c
set nocompatible
filetype plugin on
syntax on
set encoding=utf-8
set number relativenumber
nnoremap <leader>vs :vsplit<Enter>
nnoremap <leader>hs :split<Enter>
" Tab 2 spaces
filetype plugin indent on
set tabstop=4 softtabstop=4 expandtab shiftwidth=4 smarttab
let g:tabStop=4
function! ToggleTabWidth()
if g:tabStop == 2
set tabstop=4 softtabstop=4 expandtab shiftwidth=4 smarttab
let g:tabStop=4
else
set tabstop=2 softtabstop=2 expandtab shiftwidth=2 smarttab
let g:tabStop=2
endif
endfunction
nnoremap <leader>t :call ToggleTabWidth()<CR>
" Disables automatic commenting on newline:
autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o
" Remember last cursor position
autocmd BufReadPost * if @% !~# '\.git[\/\\]COMMIT_EDITMSG$' && line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g`\"" | endif
" Copy entire document
noremap <leader>y <Esc>ggyG<C-o>
map <leader>y <Esc>ggyG<C-o>
" Set gohtml template files to html syntax
autocmd BufNewFile,BufRead *.gohtml set syntax=html
" Automatically save the current session whenever vim is closed
autocmd VimLeave * mksession! ~/.config/nvim/session/shutdown_session.vim
" <F7> restores that 'shutdown session'
noremap <F7> :source ~/.config/nvim/session/shutdown_session.vim<CR>
" If you really want to, this next line should restore the shutdown session
" automatically, whenever you start vim. (Commented out for now, in case
" somebody just copy/pastes this whole block)
"
" autocmd VimEnter source ~/.vim/shutdown_session.vim<CR>
" manually save a session with <F5>
noremap <F5> :mksession! ~/.config/nvim/session/manual_session.vim<cr>
" recall the manually saved session with <F6>
noremap <F6> :source ~/.config/nvim/session/manual_session.vim<cr>
" NETRW
let g:netrw_liststyle = 3
let g:netrw_banner = 0
let g:netrw_browse_split = 4
let g:netrw_winsize = 20
let g:netrw_altv = 1
let g:NetrwIsOpen=0
function! ToggleNetrw()
if g:NetrwIsOpen
let i = bufnr("$")
while (i >= 1)
if (getbufvar(i, "&filetype") == "netrw")
silent exe "bwipeout " . i
endif
let i-=1
endwhile
let g:NetrwIsOpen=0
else
let g:NetrwIsOpen=1
silent Lexplore
endif
endfunction
" Add your own mapping. For example:
noremap <silent> <C-p> :call ToggleNetrw()<CR>
" coc
highlight CocErrorSign ctermfg=Black ctermbg=Magenta
inoremap <silent><expr> <TAB>
\ pumvisible() ? "\<C-n>" :
\ <SID>check_back_space() ? "\<TAB>" :
\ coc#refresh()
inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>"
function! s:check_back_space() abort
let col = col('.') - 1
return !col || getline('.')[col - 1] =~# '\s'
endfunction
nmap <leader>gd <Plug>(coc-definition)
nmap <leader>gr <Plug>(coc-references)
nmap <leader>rr <Plug>(coc-rename)
nnoremap <leader>prw :CocSearch <C-R>=expand("<cword>")<CR><CR>
inoremap <expr> <C-j> pumvisible() ? "\<Down>" : "\<C-j>"
inoremap <expr> <C-k> pumvisible() ? "\<Up>" : "\<C-k>"
try
nmap <silent> <leader>ej :call CocAction('diagnosticNext')<cr>
nmap <silent> <leader>ek :call CocAction('diagnosticPrevious')<cr>
endtry
" Telescope remaps
lua require("telescope")
nnoremap <C-g> :lua require('telescope.builtin').grep_string({ search = vim.fn.input("Grep For > ")})<CR>
nnoremap <C-p> :lua require('telescope.builtin').git_files()<CR>
nnoremap <C-q> :lua require('telescope.builtin').find_files()<CR>
nnoremap <leader>fb <cmd>lua require('telescope.builtin').buffers()<cr>
" PHP Doc
nnoremap <leader>h :call UpdatePhpDocIfExists()<CR>
function! UpdatePhpDocIfExists()
normal! k
if getline('.') =~ '/'
normal! V%d
else
normal! j
endif
call PhpDocSingle()
normal! k^%k$
if getline('.') =~ ';'
exe "normal! $svoid"
endif
endfunction
nnoremap <C-D> :call UpdatePhpDocIfExists()<CR>
" VimWiki
let pentest_wiki = {}
let pentest_wiki.path = '~/Documents/PentestWiki/'
let pentest_wiki.path_html = '~/Documents/PentestWikiHtml/'
let pentest_wiki.syntax = 'markdown'
let pentest_wiki.ext = '.md'
let pentest_wiki.custom_wiki2html = '~/.local/bin/vimwiki_convert.py'
let g:vimwiki_list = [pentest_wiki]
let g:vimwiki_ext2syntax = {'.md': 'markdown', '.markdown': 'markdown', '.mdown': 'markdown'}
au filetype vimwiki silent! iunmap <buffer> <Tab>
" Spell-check
map <leader>o :setlocal spell! spelllang=en_au<CR>
" Shortcutting split navigation, saving a keypress:
nnoremap <C-h> <C-w>h
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-l> <C-w>l
" Replace all is aliased to S.
nnoremap <c-s> :%s//g<Left><Left>
" Navigating with guides
inoremap <leader><leader> <Esc>/<++><Enter>"_c4l
vnoremap <leader><leader> <Esc>/<++><Enter>"_c4l
map <leader><leader> <Esc>/<++><Enter>"_c4l
augroup twig_ft
au!
autocmd BufNewFile,BufRead *.docker set syntax=dockerfile
augroup END
autocmd BufWritePre * :%s/\s\+$//e
nnoremap <leader>vs :vsplit<Enter>
nnoremap <leader>hs :split<Enter>
" Tab 2 spaces
filetype plugin indent on
set tabstop=4 softtabstop=4 expandtab shiftwidth=4 smarttab
let g:tabStop=4
function! ToggleTabWidth()
if g:tabStop == 2
set tabstop=4 softtabstop=4 shiftwidth=4
let g:tabStop=4
else
set tabstop=2 softtabstop=2 shiftwidth=2
let g:tabStop=2
endif
endfunction
nnoremap <leader>t :call ToggleTabWidth()<CR>
autocmd BufNewFile,BufRead *.dart setlocal tabstop=2 softtabstop=2 shiftwidth=2
autocmd BufNewFile,BufRead *.dart let g:tabStop=2
" Disables automatic commenting on newline:
autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o
nnoremap <leader>t :call ToggleTabWidth()<CR>
" Disables automatic commenting on newline:
autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o
" Remember last cursor position
autocmd BufReadPost * if @% !~# '\.git[\/\\]COMMIT_EDITMSG$' && line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g`\"" | endif
" Automatically save the current session whenever vim is closed
autocmd VimLeave * mksession! ~/.config/nvim/session/shutdown_session.vim
" <F7> restores that 'shutdown session'
noremap <F7> :source ~/.config/nvim/session/shutdown_session.vim<CR>
" If you really want to, this next line should restore the shutdown session
" automatically, whenever you start vim. (Commented out for now, in case
" somebody just copy/pastes this whole block)
"
" autocmd VimEnter source ~/.vim/shutdown_session.vim<CR>
" manually save a session with <F5>
noremap <F5> :mksession! ~/.config/nvim/session/manual_session.vim<cr>
" recall the manually saved session with <F6>
noremap <F6> :source ~/.config/nvim/session/manual_session.vim<cr>
" Copy entire document
noremap <leader>y <Esc>ggyG<C-o>
map <leader>y <Esc>ggyG<C-o>
" Set gohtml template files to html syntax
autocmd BufNewFile,BufRead *.gohtml set syntax=html
nnoremap <leader>1 1gt
nnoremap <leader>2 2gt
nnoremap <leader>3 3gt
nnoremap <leader>4 4gt
nnoremap <leader>5 5gt
" NETRW
let g:netrw_liststyle = 3
let g:netrw_banner = 0
let g:netrw_browse_split = 4
let g:netrw_winsize = 20
let g:netrw_altv = 1
let g:NetrwIsOpen=0
function! ToggleNetrw()
if g:NetrwIsOpen
let i = bufnr("$")
while (i >= 1)
if (getbufvar(i, "&filetype") == "netrw")
silent exe "bwipeout " . i
endif
let i-=1
endwhile
let g:NetrwIsOpen=0
else
let g:NetrwIsOpen=1
silent Lexplore
endif
endfunction
" Add your own mapping. For example:
noremap <silent> <C-p> :call ToggleNetrw()<CR>
" coc
highlight CocErrorSign ctermfg=Black ctermbg=Magenta
inoremap <silent><expr> <TAB>
\ pumvisible() ? "\<C-n>" :
\ <SID>check_back_space() ? "\<TAB>" :
\ coc#refresh()
inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>"
function! s:check_back_space() abort
let col = col('.') - 1
return !col || getline('.')[col - 1] =~# '\s'
endfunction
nmap <leader>gd <Plug>(coc-definition)
nmap <leader>gr <Plug>(coc-references)
nmap <leader>rr <Plug>(coc-rename)
nnoremap <leader>prw :CocSearch <C-R>=expand("<cword>")<CR><CR>
inoremap <expr> <C-j> pumvisible() ? "\<Down>" : "\<C-j>"
inoremap <expr> <C-k> pumvisible() ? "\<Up>" : "\<C-k>"
" PHP Doc
nnoremap <leader>h :call UpdatePhpDocIfExists()<CR>
function! UpdatePhpDocIfExists()
normal! k
if getline('.') =~ '/'
normal! V%d
else
normal! j
endif
call PhpDocSingle()
normal! k^%k$
if getline('.') =~ ';'
exe "normal! $svoid"
endif
endfunction
nnoremap <C-D> :call UpdatePhpDocIfExists()<CR>
" VimWiki
au filetype vimwiki silent! iunmap <buffer> <Tab>
try
nmap <silent> <leader>ej :call CocAction('diagnosticNext')<cr>
nmap <silent> <leader>ek :call CocAction('diagnosticPrevious')<cr>
endtry
" Telescope remaps
lua require("telescope")
nnoremap <C-g> :lua require('telescope.builtin').grep_string({ search = vim.fn.input("Grep For > ")})<CR>
nnoremap <C-p> :lua require('telescope.builtin').git_files()<CR>
nnoremap <C-q> :lua require('telescope.builtin').find_files()<CR>
nnoremap <leader>fb <cmd>lua require('telescope.builtin').buffers()<cr>
" Spell-check
map <leader>o :setlocal spell! spelllang=en_au<CR>
" Shortcutting split navigation, saving a keypress:
nnoremap <C-h> <C-w>h
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-l> <C-w>l
" Replace all is aliased to S.
nnoremap <c-s> :%s//g<Left><Left>
" Navigating with guides
inoremap <leader><leader> <Esc>/<++><Enter>"_c4l
vnoremap <leader><leader> <Esc>/<++><Enter>"_c4l
map <leader><leader> <Esc>/<++><Enter>"_c4l
augroup twig_ft
au!
autocmd BufNewFile,BufRead *.docker set syntax=dockerfile
augroup END
endif

+ 1
- 1
.local/bin/dwm-autostart View File

@ -2,7 +2,7 @@
~/.local/bin/remap-keys
dunst --config ~/.config/dunst/dunstrc &
xautolock -time 10 -locker ~/.local/bin/lock_mine &
xautolock -time 10 -locker slock &
~/.local/bin/setbg
unclutter &
nohup /usr/lib/kdeconnectd >/dev/null 2>&1 &


+ 2
- 2
.local/bin/dwm-sss View File

@ -4,8 +4,8 @@ while true;
do
f=$(cat /sys/class/thermal/thermal_zone0/temp)
t=$(echo $f | cut -b -2).$(echo $f | cut -b 3-)°C
d=$(date '+%a %b %d, %H:%M:%S ')
d=$(date '+%a %b %d, %H:%M')
p=$(pacman -Qu | grep -v "\[ignored\]" | wc -l)
xsetroot -name " Pkgs: ${p} | ${d} | ${t}"
sleep 0.5;
sleep 60;
done;

+ 20
- 9
.zshrc View File

@ -6,15 +6,15 @@
# and zshoptions(1) for more details.
# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/.local/bin" ] ; then
PATH="$PATH:$(du "$HOME/.local/bin/" | cut -f2 | tr '\n' ':')"
fi
# if [ -d "$HOME/.local/bin" ] ; then
# PATH="$PATH:$(du "$HOME/.local/bin/" | cut -f2 | tr '\n' ':')"
# fi
#if [ -d "$HOME/.local/share/gem/ruby/3.0.0/bin" ]; then
# PATH="$PATH:$HOME/.local/share/gem/ruby/3.0.0/bin"
#fi
PATH="$PATH:$HOME/go/bin"
export PATH="$PATH:$HOME/go/bin"
# Correctly display UTF-8 with combining characters.
if [[ "$(locale LC_CTYPE)" == "UTF-8" ]]; then
@ -96,7 +96,7 @@ fi
#PS1="%n@%m %1~ %# "
autoload -U colors && colors # Load colors
PROMPT="%B%{$fg[red]%}[%{$fg[yellow]%}%n%{$fg[green]%}@%{$fg[blue]%}%M %{$fg[magenta]%}%~%{$fg[red]%}]%{$reset_color%}$%b "
PROMPT="%B%{$fg[red]%}[%{$fg[yellow]%}%n%{$fg[green]%}@%{$fg[blue]%}%M %{$fg[magenta]%}%1d%{$fg[red]%}]%{$reset_color%}$%b "
setopt autocd # Automatically cd into typed directory.
# Useful support for interacting with Terminal.app or other terminal programs
@ -161,11 +161,11 @@ source ~/.zsh/fsh/fast-syntax-highlighting.plugin.zsh 2>/dev/null
# Go up directory structures
up() {
up () {
cd $(printf "%0.0s../" $(seq 1 $1));
}
git-prune() {
git-prune () {
if [[ $@ == "--apply" ]]; then
command git branch --merged develop | grep -vEw "develop$|master$" | xargs git branch -d
else
@ -173,7 +173,7 @@ git-prune() {
fi
}
mkcd() {
mkcd () {
mkdir -p $@ && cd $@
}
@ -189,10 +189,14 @@ lfcd () {
}
bindkey -s '^o' 'lfcd\n'
cdv () {
cd $(xclip -selection clipboard -o)
}
export PATH="/usr/local/opt/php@7.4/bin:$PATH"
export PATH="/usr/local/opt/php@7.4/sbin:$PATH"
eval "$(starship init zsh)"
# eval "$(starship init zsh)"
export LESS='-R'
export LESSOPEN='|~/.lessfilter %s'
@ -203,3 +207,10 @@ export QT_QPA_PLATFORMTHEME="qt5ct"
#if command -v tmux &> /dev/null && [ -n "$PS1" ] && [[ ! "$TERM" =~ screen ]] && [[ ! "$TERM" =~ tmux ]] && [ -z "$TMUX" ]; then
# exec tmux
#fi
export ANDROID_SDK_ROOT='/opt/android-sdk'
export PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools/
export PATH=$PATH:$ANDROID_SDK_ROOT/tools/bin/
export PATH=$PATH:$ANDROID_ROOT/emulator
export PATH=$PATH:$ANDROID_SDK_ROOT/tools/
export PATH=$PATH:$ANDROID_HOME/cmdline-tools/latest/bin

Loading…
Cancel
Save