merge changes

This commit is contained in:
James Dixon 2021-01-27 14:58:03 -05:00
commit 40030d526d
24 changed files with 444 additions and 1021 deletions

View File

@ -8,9 +8,6 @@
[user]
email = notjamesdixon@gmail.com
name = James Dixon
[credential]
username = lemonase
helper = store
[color]
ui = true
status = auto
@ -19,8 +16,6 @@
tool = vimdiff
[difftool]
prompt = false
[pull]
ff = only
[alias]
a = add
aa = add --all
@ -40,3 +35,12 @@
pl = log --all --decorate --oneline --graph
gr = log --all --decorate --oneline --graph
graph = log --all --decorate --oneline --graph
[winUpdater]
recentlySeenVersion = 2.25.0.windows.1
[filter "lfs"]
clean = git-lfs clean -- %f
smudge = git-lfs smudge -- %f
process = git-lfs filter-process
required = true
[core]
autocrlf = true

View File

@ -0,0 +1,42 @@
#--------
# Imports
#--------
# Posh
Import-Module posh-git
# Chocolatey
$ChocolateyProfile = "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1"
if (Test-Path($ChocolateyProfile)) {
Import-Module "$ChocolateyProfile"
}
# PSReadLine
Set-PSReadLineOption -EditMode Emacs
Set-PSReadLineOption -BellStyle Visual
# PSFzf
Set-PsFzfOption -PSReadlineChordProvider 'Ctrl+t' -PSReadlineChordReverseHistory 'Ctrl+r'
#----------------------
# Environment Varaibles
#----------------------
$WD = "$env:USERPROFILE\source\repos"
$GOWD = "$env:USERPROFILE\go\src\github.com\lemonase"
$GODOTWD = "$env:USERPROFILE\Google Drive\Game Dev"
$EDITOR = "gvim"
#--------
# Aliases
#--------
New-Alias so "Select-Object"
New-Alias wo "Where-Object"
New-Alias venvac ".\venv\Scripts\Activate.ps1"
#----------
# Functions
#----------
function wd { Set-Location $WD }
function gowd { Set-Location $GOWD }
function godotwd { Set-Location $GODOTWD }
function ep { Start-Process "$EDITOR" "$PROFILE" }

View File

@ -1,10 +1,8 @@
# My dotfiles
I am using [GNU Stow](https://www.gnu.org/software/stow/) to symlink
my dotfiles to their correct locations in my `$HOME` directory.
# My (Windows) dotfiles
## Instructions
<<<<<<< HEAD
```sh
$ git clone https://github.com/lemonase/dotfiles.git
$ cd dotfiles/files
@ -29,3 +27,6 @@ $ stow --restow *
```
If there are no errors, everything in that directory should be symlinked.
=======
Just copy relevant files to %USERPROFILE% dir.
>>>>>>> new-win10

View File

@ -1,8 +0,0 @@
# .bash_profile is *not sourced* when launching bash from most GUI terminal emulators
#
# .bash_profile *is sourced* for login shells like from a TTY, ssh connection, or tmux.
# For the sake of simplicity and consistency, I source my .bashrc
[ -f "$HOME/.bashrc" ] && source "$HOME/.bashrc"
# vim:ft=sh

View File

@ -1,253 +0,0 @@
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac
# history
HISTSIZE= ;
HISTFILESIZE=
HISTCONTROL="ignoreboth:erasedups"
HISTTIMEFORMAT="%F %T "
# shell options
shopt -s checkhash checkjobs checkwinsize
shopt -s dirspell extglob globstar
shopt -s cmdhist histappend
# command variables
export EDITOR="/usr/bin/vim"
export VISUAL="/usr/bin/vim"
export PAGER="less"
# command options
LS_OPTS="-F --color=auto"
GREP_OPTS="--color=auto"
## aliases ##
alias l="ls ${LS_OPTS}"
alias ls="ls ${LS_OPTS}"
alias ll="ls -lsh ${LS_OPTS}"
alias la="ls -Alsh ${LS_OPTS}"
alias al="ls -A ${LS_OPTS}"
alias sl="ls -lsSh ${LS_OPTS}"
alias sal="ls -AlsSh ${LS_OPTS}"
alias mkdir="mkdir -p"
alias grep="grep ${GREP_OPTS}"
alias fgrep="fgrep ${GREP_OPTS}"
alias egrep="egrep ${GREP_OPTS}"
alias tree="tree -C"
alias treel="tree -C | less -R"
alias lsmnt="mount | column -t"
alias df="df -h"
alias g="git"
alias groot="cd $(git rev-parse --show-toplevel 2> /dev/null || echo -n ".")"
alias tmls="tmux ls"
alias tmlsc="tmux lsc"
alias tmks="tmux kill-session -t" # kill one session
alias tmka="tmux kill-server" # aka killall
alias s="systemctl"
alias sud="sudo su"
if [ "$(grep -Ei 'debian|buntu|mint' /etc/*release)" ]; then
alias a="sudo apt"
alias aup="sudo apt update"
alias aupg="sudo apt upgrade -y"
alias alu="apt list --upgradable"
fi
alias venvac="source venv/bin/activate"
## colors ##
# color vars using tput or ANSI/VT100 Control sequences
# check if tput is available
if [ -x "$(command -v tput)" ]; then
num_colors=$(tput colors)
if [ -n "$num_colors" ]; then
if [ "$num_colors" -ge 8 ]; then
black="\[$(tput setaf 0)\]"; unesc_black="$(tput setaf 0)"
red="\[$(tput setaf 1)\]"; unesc_red="$(tput setaf 1)"
green="\[$(tput setaf 2)\]"; unesc_green="$(tput setaf 2)"
brown="\[$(tput setaf 3)\]"; unesc_brown="$(tput setaf 3)"
blue="\[$(tput setaf 4)\]"; unesc_blue="$(tput setaf 4)"
purple="\[$(tput setaf 5)\]"; unesc_purple="$(tput setaf 5)"
cyan="\[$(tput setaf 6)\]"; unesc_cyan="$(tput setaf 6)"
grey="\[$(tput setaf 7)\]"; unesc_grey="$(tput setaf 7)"
dark_grey="\[$(tput setaf 8)\]"; unesc_dark_grey="$(tput setaf 8)"
fi
if [ "$num_colors" -ge 16 ]; then
bright_red="\[$(tput setaf 9)\]"; unesc_bright_red="$(tput setaf 9)"
bright_green="\[$(tput setaf 10)\]"; unesc_bright_green="$(tput setaf 10)"
bright_yellow="\[$(tput setaf 11)\]"; unesc_bright_yellow="$(tput setaf 11)"
bright_blue="\[$(tput setaf 12)\]"; unesc_bright_blue="$(tput setaf 12)"
bright_magenta="\[$(tput setaf 13)\]"; unesc_bright_magenta="$(tput setaf 13)"
bright_cyan="\[$(tput setaf 14)\]"; unesc_bright_cyan="$(tput setaf 14)"
white="\[$(tput setaf 15)\]"; unesc_bright_white="$(tput setaf 15)"
fi
reset="\[$(tput sgr0)\]"; unesc_reset="$(tput sgr0)"
bold="\[$(tput bold)\]"; unesc_bold="$(tput bold)"
fi
else # or fallback to ANSI esacpe codes
black="\[\033[0;30m\]"; unesc_black="\033[0;30m"
red="\[\033[1;31m\]"; unesc_red="\033[1;31m"
green="\[\033[1;32m\]"; unesc_green="\033[1;32m"
brown="\[\033[1;33m\]"; unesc_brown="\033[1;33m"
blue="\[\033[1;34m\]"; unesc_blue="\033[1;34m"
purple="\[\033[1;35m\]"; unesc_purple="\033[1;35m"
cyan="\[\033[1;36m\]"; unesc_cyan="\033[1;36m"
grey="\[\033[1;37m\]"; unesc_grey="\033[1;37m"
dark_grey="\[\033[1;90m\]"; unesc_dark_grey="\033[1;90m"
bright_red="\[\033[1;91m\]"; unesc_bright_red="\033[1;91m"
bright_green="\[\033[1;92m\]"; unesc_bright_yellow="\033[1;92m"
bright_yellow="\[\033[1;93m\]"; unesc_bright_yellow="\033[1;93m"
bright_blue="\[\033[1;94m\]"; unesc_bright_blue="\033[1;94m"
bright_magenta="\[\033[1;95m\]"; unesc_bright_magenta="\033[1;95m"
bright_cyan="\[\033[1;96m\]"; unesc_bright_cyan="\033[1;96m"
white="\[\033[1;97m\]"; unesc_white="\033[1;97m"
reset="\[\033[0m\]"; unesc_reset="\033[0m"
bold="\[\033[1m\]"; unesc_bold="\033[1m"
fi
## functions ##
# common commands improved
mkcd() { mkdir -p -- "$1" && cd "$1"; }
cdd() { [ -n "$1" ] && for i in $(seq 1 "$1"); do cd ..; done; }
touchx() { touch "$@" && chmod +x "$@"; }
# tmux
tm() {
if [ "$#" -gt 0 ]; then
tmux new-session -As "$1"
else
tmux new-session
fi
}
tma() {
if [ "$#" -gt 0 ]; then
tmux attach-session -d -t "$1"
if [ "$?" -ne 0 ]; then
tmux new-session -As "$1"
fi
else
tmux attach
fi
}
# checks if directory exists and path duplication
appendpath () {
if [ -d "$1" ]; then
case ":$PATH:" in
*:"$1":*)
;;
*)
PATH="${PATH:+$PATH:}$1"
esac
fi
}
# easy backup
bkup() {
if [ -f "$1" ]; then
cp "${1}" "${1}.bkup.$(date +'%F.%R')";
fi
}
# git
lazygit() {
git commit -a -m "$*" && git push;
}
lg() {
lazygit "$*";
}
## prompt stuff ##
# git prompt function
parse_git() {
BRANCH="$(git rev-parse --abbrev-ref HEAD 2> /dev/null)"
STATUS="$(git status 2> /dev/null)"
if [[ "$?" -ne 0 ]]; then
return
else
printf "\001${unesc_reset}${unesc_bold}\002:(%s)" "${BRANCH}"
printf "\001${unesc_white}\002%s" "["
if echo "${STATUS}" | grep -c "nothing to commit" &> /dev/null; then printf "\001${unesc_bright_blue}\002%s" "="; fi
if echo "${STATUS}" | grep -c "renamed:" &> /dev/null; then printf "\001${unesc_red}\002%s" "%"; fi
if echo "${STATUS}" | grep -c "deleted:" &> /dev/null; then printf "\001${unesc_red}\002%s" "-"; fi
if echo "${STATUS}" | grep -c "new file:" &> /dev/null; then printf "\001${unesc_green}\002%s" "+"; fi
if echo "${STATUS}" | grep -c "branch is ahead:" &> /dev/null; then printf "\001${unesc_bright_yellow}\002%s" ">"; fi
if echo "${STATUS}" | grep -c "branch is behind" &> /dev/null; then printf "\001${unesc_bright_yellow}\002%s" "<"; fi
if echo "${STATUS}" | grep -c "Untracked files:" &> /dev/null; then printf "\001${unesc_bright_yellow}\002%s" "?"; fi
if echo "${STATUS}" | grep -c "modified:" &> /dev/null; then printf "\001${unesc_bright_yellow}\002%s" "*"; fi
printf "\001${unesc_reset}${unesc_bold}${unesc_white}\002%s" "]"
fi
}
# *plain prompts*
# PS1="\W \\$ "
# PS1="[\u@\h:\W]\\$ "
# PS1="\u@\h:\W\\$ "
# *color prompts*
# PS1="${bold}${blue}\W ${yellow}\\$ ${reset}"
# PS1="${bold}${purple}\u${yellow}@${cyan}\h${white}:${blue}\W ${yellow}\\$ ${reset}"
# *git color prompts*
# PS1="${bold}${blue}\W\$(parse_git)${green} \\$ ${reset}"
# PS1="${bold}${white}\t ${blue}\W\$(parse_git) ${cyan}\\$ ${reset}"
# PS1="${bold}${purple}\u${yellow}@${cyan}\h${white}:${blue}\W\$(parse_git)${green} \\$ ${reset}"
# PS1="${bold}\n${cyan}\u ${white}at ${yellow}\h ${white}in ${blue}\w ${white}on \$(parse_git)\n${yellow}\\$ ${reset}"
# bash autocompletion
if ! shopt -oq posix; then
if [ -f /usr/share/bash-completion/bash_completion ]; then
source /usr/share/bash-completion/bash_completion
elif [ -f /etc/bash_completion ]; then
source /etc/bash_completion
fi
fi
## extra paths ##
# ruby
if command -v ruby > /dev/null && command -v gem > /dev/null; then
appendpath "$(ruby -r rubygems -e 'puts Gem.user_dir')/bin"
fi
# go
if command -v go > /dev/null; then
[ -d "$HOME/go" ] && mv "$HOME/go" "$HOME/.go"
export GOPATH="$HOME/.go"
export GOWD="$GOPATH/src/github.com/lemonase"
export GOMOD="$GOPATH/pkg/mod/github.com/lemonase/"
appendpath "$(go env GOPATH)/bin"
fi
# rust
if command -v cargo > /dev/null; then
appendpath "$HOME/.cargo/bin"
fi
# local bins
appendpath "$HOME/.local/bin"
appendpath "$HOME/.local/scripts"
## extra tools ##
export FZF_DEFAULT_OPTS="--bind=ctrl-f:page-down,ctrl-b:page-up"
# local rc ##
[ -r "$HOME/.config/bashrc" ] && source "$HOME/.config/bashrc"
[ -r "$HOME/.local/bashrc" ] && source "$HOME/.local/bashrc"

View File

@ -1,25 +0,0 @@
# bash completion for hugctl
_hugctl_completions() {
local cur
cur="${COMP_WORDS[COMP_CWORD]}"
local blog_dir="$HOME/src/blog"
case ${COMP_CWORD} in
1)
OPTS="new list edit serve kill deploy"
compopt -o bashdefault -o default
COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
;;
2)
case ${COMP_CWORD[2]} in
*)
COMPREPLY=($(compgen -W "$(find $blog_dir/content/posts/ -iname '*.md' -type f | xargs -I@ basename @)" -- $cur));
;;
esac
;;
esac
return 0
}
complete -F _hugctl_completions hugctl

View File

@ -1,132 +0,0 @@
#!/bin/bash
# hugoctl -- hugo wrapper script to help manage a hugo blog
# hugo variables (local machine)
scriptname=$(basename "$0")
blog_dir="$HOME/src/blog" # or the path to your blog
local_url="http://localhost:1313/"
post_filename=""
postname=""
full_post_dir=""
full_post_url="$local_url"
set_vars() {
local arg="$1"
# handle no argument case
if [[ -z "$arg" ]]; then
echo -en "Please enter a post title: "
read -r arg
fi
# handle extraneous .md file extension
if [[ ! "$arg" =~ .md$ ]]; then
postname="$arg"
else
postname="${arg%???}"
fi
post_filename="$postname.md"
# hugo post location for server
full_post_dir="$blog_dir/content/posts/$post_filename"
# url for browser
full_post_url="$local_url/posts/$postname"
}
serve_and_open() {
killall hugo > /dev/null 2>&1
hugo serve -s "$blog_dir" -D > /dev/null 2>&1 &
xdg-open "$full_post_url"
}
edit_post() {
serve_and_open
$EDITOR "$full_post_dir" && kill %1
}
new_post() {
hugo new -s "$blog_dir" "posts/$post_filename"
edit_post
}
deploy_blog() {
if [ -z "$blog_remote_host" ]; then echo "Please set blog_remote_host variable"; exit 1; fi
if [ -z "$blog_remote_user" ]; then echo "Please set blog_remote_user variable"; exit 1; fi
if [ -z "$blog_remote_dir" ]; then echo "Please set blog_remote_dir variable (relative to \$HOME)"; exit 1; fi
green="$(tput setaf 2)"
reset="$(tput sgr0)"
printf "${green}%s\n${reset}" "Deploying..."
ssh "$blog_remote_user@$blog_remote_host" "(cd \$HOME/$blog_remote_dir && git pull && hugo)"
}
print_help() {
printf "%s\n" "Usage: "
printf "%s\n\n" "$scriptname [args]"
printf "%s\n" "Options: "
printf "\t%s:\n\t\t%s\n\n" "new-post (aliases: newpost,np,new,n) [post-name]" "create a new post, open editor and live server"
printf "\t%s:\n\t\t%s\n\n" "edit-post (alises: edit,ep,e) [post-name]" "edit a post in the content directory"
printf "\t%s:\n\t\t%s\n\n" "list-posts (aliases: list,li,lp,ls,l)" "list all posts in content directory"
printf "\t%s:\n\t\t%s\n\n" "list-drafts (alises: listdraft,ld)" "list all posts in content directory"
printf "\t%s:\n\t\t%s\n\n" "server (alises: serve,s)" "serve blog from your blog directory"
printf "\t%s:\n\t\t%s\n\n" "kill (alises: killlall,ka,k)" "kill all hugo processes"
printf "\t%s:\n\t\t%s\n\n" "deploy (aliases: dep,d)" "deploy to a remote server"
printf "\n"
}
if [[ "$#" -lt 1 ]]; then
print_help
exit 1
fi
while (($#)); do
case "$1" in
new-post|newpost|np|new|n)
shift
set_vars "$1"
new_post "$1"
break
;;
edit-post|edit|ep|e)
shift
set_vars "$1"
edit_post "$1"
break
;;
list-posts|list|li|lp|l|ls)
hugo list -s "$blog_dir" all | cut -d, -f1 | tail -n +2
# hugo list -s "$blog_dir" all | cut -f1,4 -d, | tail -n +2 | tr ',' ' ' | column -t | sort -hr
break
;;
list-drafts|listdraft|ld)
hugo list drafts -s "$blog_dir"
break
;;
server|serve|s)
serve_and_open
break
;;
kill|killall|ka|k)
killall "hugo"
break
;;
deploy|dep|d)
deploy_blog
break
;;
help|-h|--help)
print_help
break
;;
*)
print_help
break
;;
esac
done

View File

@ -1,58 +0,0 @@
# change default prefix
unbind C-b
set-option -g prefix C-a
bind-key C-a send-prefix
# emulate a color terminal emulator
set -g default-terminal "xterm-256color"
# unset the annoying delay
set -sg escape-time 0
# mouse settings
# set -g mouse on
# set -g set-clipboard on
# set -g focus-events on
# appearance
set -g status-style "bg=colour16 fg=white,bold"
set -g window-status-current-style "bg=yellow fg=colour16,bold"
set -g status-left-length 100
set -g status-right-length 100
# set -g status-right-style "bg=green fg=colour16,bold"
# set -g status-bg black
# set -g status-fg white
#==============#
# Key Bindings #
#==============#
bind -n M-j select-pane -D
bind -n M-k select-pane -U
bind -n M-h select-pane -L
bind -n M-l select-pane -R
bind -n M-Down select-pane -D
bind -n M-Up select-pane -U
bind -n M-Left select-pane -L
bind -n M-Right select-pane -R
# Resize panes - less pain
bind-key C-J resize-pane -D 5
bind-key C-K resize-pane -U 5
bind-key C-H resize-pane -L 5
bind-key C-L resize-pane -R 5
# Move windows easier
bind-key -r < swap-window -t -1
bind-key -r > swap-window -t +1
# New panes start in cwd
bind-key '"' split-window -v -c '#{pane_current_path}'
bind-key % split-window -h -c '#{pane_current_path}'
bind c new-window -c '#{pane_current_path}'
# Source conf
bind-key r source-file ~/.tmux.conf \; display-message "Sourced ~/.tmux.conf!"

View File

@ -1,6 +0,0 @@
autoload
plugged
.backup
.swap
.undo
.netrwhist

View File

@ -1,78 +0,0 @@
if has("autocmd")
"filetype functions
"------------------
function FT_halftab()
setlocal expandtab
setlocal tabstop=2
setlocal softtabstop=2
setlocal shiftwidth=2
endfunction
function FT_python()
setlocal autoindent
setlocal formatprg=yapf
iabbr false False
iabbr true True
xnoremap <leader>r <esc>:'<,'>:w !python3<CR>
endfunction
function FT_go()
set noexpandtab
let g:go_auto_type_info = 1
let g:go_imports_autosave = 1
endfunction
function FT_html()
syntax sync fromstart
endfunction
function FT_markdown()
setlocal spell
endfunction
"global autocmds
"-----------------
augroup global
autocmd!
"keep equal proportions when windows resized
autocmd VimResized * wincmd =
"save cursor position in a file
autocmd BufReadPost * if line("'\"") > 1 && line("'\"")
\ <= line("$") | exe "normal! g'\"" | endif
augroup END
"general filetype autocmds
"-------------------------
augroup emmet_group
autocmd!
autocmd FileType html,css EmmetInstall
augroup END
augroup prettier_format_group
autocmd!
autocmd FileType javascript setlocal formatprg=prettier
autocmd FileType typescript setlocal formatprg=prettier\ --parser\ typescript
autocmd FileType vue setlocal formatprg=prettier\ --parser\ vue
autocmd FileType html setlocal formatprg=prettier\ --parser\ html
autocmd FileType css setlocal formatprg=prettier\ --parser\ css
autocmd FileType scss setlocal formatprg=prettier\ --parser\ scss
autocmd FileType markdown setlocal formatprg=prettier\ --parser\ markdown
autocmd FileType json setlocal formatprg=prettier\ --parser\ json
autocmd FileType yaml setlocal formatprg=prettier\ --parser\ yaml
augroup END
augroup halftab_indent_group
autocmd!
autocmd FileType sh,bash,html,css,scss,javascript,json,toml,yaml call FT_halftab()
augroup END
"language specific autocmds
"--------------------------
augroup language_group
autocmd FileType python call FT_python()
autocmd FileType go call FT_go()
autocmd FileType html call FT_html()
autocmd FileType markdown call FT_markdown()
augroup END
endif

View File

@ -1,16 +0,0 @@
"colorschemes
" {{{
" colorscheme 1989
" colorscheme PaperColor
" colorscheme gruvbox
" colorscheme jellybeans
" colorscheme molokai
" colorscheme Benokai
" colorscheme Monokai
" colorscheme badwolf
" colorscheme wombat256
" colorscheme yuejiu
" colorscheme wargrey
" colorscheme Tomorrow-Night-Bright
" colorscheme monokai-phoenix
" }}}

View File

@ -1,10 +0,0 @@
"custom commands
"---------------{{{
"common typos and abbreviations
cnoremap w!! w !sudo tee % > /dev/null
command! W w !sudo tee % > /dev/null
command! Trim %s/\s\+$//
command! Q q
command! WQ wq
command! Q1 q!
"}}}

View File

@ -1,46 +0,0 @@
"toggle functions
"----------------{{{
function! ToggleColorColumn()
if &cc == ''
set cc=80
else
set cc=
endif
endfunction
function! ToggleLineBreak()
if &lbr == ''
set fo+=t "Autowraps text with textwidth
set fo-=l "Wraps long lines in --insert-- mode
set lbr
else
set fo-=t
set fo+=l
set lbr!
endif
endfunction
function! ToggleWrap()
if &wrap == ''
set wrap
else
set nowrap
endif
endfunction
function! ToggleNetrw() "make netrw toggleable <https://vi.stackexchange.com/questions/10988/toggle-explorer-window>
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
"}}}

View File

@ -1,2 +0,0 @@
let g:html_indent_script1 = "inc"
let g:html_indent_style1 = "inc"

View File

@ -1,91 +0,0 @@
"leader key
let mapleader=' '
"normal keybinds
"-------------{{{
"paste and search
nnoremap <silent><leader><space> :noh <BAR> :let @/ = ""<CR>
nnoremap <leader>i :set invpaste<CR>
"toggles
nnoremap <silent><leader>lb :call ToggleLineBreak()<CR>
nnoremap <silent><leader>wr :call ToggleWrap()<CR>
nnoremap <silent><leader>cc :call ToggleColorColumn()<CR>
"dates
nnoremap <leader>ts "=strftime("%F %T%z")<CR>
nnoremap <leader>dt :r !date<CR>
"rc files
nnoremap <leader>rc :vsplit $MYVIMRC<CR>
nnoremap <leader>rcs :vsplit ~/.vim/settings.vim<CR>
nnoremap <leader>rcf :vsplit ~/.vim/functions.vim<CR>
nnoremap <leader>rcc :vsplit ~/.vim/commands.vim<CR>
nnoremap <leader>rck :vsplit ~/.vim/keybinds.vim<CR>
nnoremap <leader>rcp :vsplit ~/.vim/plugins.vim<CR>
nnoremap <leader>rca :vsplit ~/.vim/autocmds.vim<CR>
nnoremap <leader>rcft :vsplit $HOME/.vim/after/ftplugin/<CR>
nnoremap <leader>rcl :vsplit ~/.config/vimrc<CR>
nnoremap <leader>so :source $MYVIMRC<CR>
"windows
nnoremap <leader>cl :close<CR>
"formatting tools
nnoremap =j :%!python -m json.tool<CR>
"}}}
"insert mode
"-----------{{{
"abbrevations
inoreabbrev <expr> #!! "#!/usr/bin/env"
"}}}
"plugin keybinds
"{{{
"netrw
nnoremap <silent><leader>e :call ToggleNetrw()<CR>
"vim-plug
nnoremap <leader>pi :source $MYVIMRC <BAR> :PlugInstall<CR>
nnoremap <leader>pu :source $MYVIMRC <BAR> :PlugUpdate<CR>
nnoremap <leader>pc :source $MYVIMRC <BAR> :PlugClean<CR>
"openbrowser
nnoremap <leader>ob :OpenBrowser
nnoremap <leader>obs :OpenBrowserSearch
nmap gx <Plug>(openbrowser-smart-search)
vmap gx <Plug>(openbrowser-smart-search)
"ale
nnoremap <leader>at :ALEToggle<CR>
nmap <leader>af <Plug>(ale_fix)
nmap <leader>aK <Plug>(ale_hover)
nmap <leader>agd <Plug>(ale_go_to_definition)
nmap <leader>agd <Plug>(ale_go_to_definition)
"vim-emmet
let g:user_emmet_leader_key = ','
"git-gutter
nnoremap <leader>ggt :GitGutterToggle<CR>
"vim-fugitive
nnoremap <leader>gw :Gwrite<CR>
nnoremap <leader>gl :Glog<CR>
nnoremap <leader>gs :Gstatus<CR>
nnoremap <leader>gd :Gdiffsplit<CR>
nnoremap <leader>gp :Gpush<CR>
nnoremap <leader>ga :Git add %<CR>
nnoremap <leader>ga. :Git add .<CR>
nnoremap <leader>gcm :Gcommit<CR>
"fzf
nnoremap <leader>gf :GitFiles<CR>
nnoremap <leader>f :Files<CR>
nnoremap <leader>b :Buffers<CR>
nnoremap <leader>h :Helptags<CR>
nnoremap <leader>m :Maps<CR>
nnoremap <leader>rg :Rg<CR>
"}}}

View File

@ -1,101 +0,0 @@
"plugins (vim-plug)
"------------------
"vim-plug paths
let plugDir = expand("$HOME/.vim/autoload/plug.vim")
let pluginDir = expand("$HOME/.vim/plugged")
let plugRemote = "https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim"
"ensure vim-plug is installed on VimEnter
if empty(glob(plugDir))
silent execute "!curl -fLo " . shellescape(expand(plugDir)) . " --create-dirs " . shellescape(plugRemote)
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif
"pre plugin settings
call plug#begin(pluginDir)
Plug 'junegunn/vim-plug'
" == quality of life ==
"normal mode keybinds
Plug 'tpope/vim-commentary'
Plug 'tpope/vim-surround'
Plug 'tpope/vim-unimpaired'
"command mode keybinds
Plug 'tpope/vim-rsi'
Plug 'tpope/vim-eunuch'
Plug 'tpope/vim-repeat'
"git
Plug 'tpope/vim-fugitive'
Plug 'tpope/vim-rhubarb'
Plug 'tpope/vim-dispatch'
Plug 'airblade/vim-gitgutter'
"fzf
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
Plug 'junegunn/fzf.vim'
" == language support ==
"go
Plug 'fatih/vim-go'
"html
Plug 'mattn/emmet-vim'
"markdown
Plug 'plasticboy/vim-markdown'
Plug 'godlygeek/tabular'
"toml
Plug 'cespare/vim-toml'
"linting and lsp
Plug 'w0rp/ale'
" == extra ==
Plug 'flazz/vim-colorschemes'
Plug 'editorconfig/editorconfig-vim'
Plug 'tyru/open-browser.vim'
call plug#end()
"post plugin settings
"---------------{{{
"netrw
let g:netrw_banner = 0
let g:netrw_winsize = 24
let g:netrw_liststyle = 3
let g:netrw_preview = 1
let g:netrw_alto = 0
let g:netrw_usetab = 1
let g:netrw_browsex_viewer = "xdg-open"
let g:NetrwIsOpen = 0 "for toggle function
let g:netrw_nogx = 1
"ale
let g:ale_linters = {
\ 'python': ['flake8', 'pylint'],
\ 'javascript': ['eslint'],
\ 'markdown': ['mdl', 'write-good']
\}
let g:ale_fixers = {
\ '*': ['remove_trailing_lines', 'trim_whitespace'],
\ 'python': ['yapf', 'black'],
\ 'javascript': ['prettier', 'eslint'],
\ 'css': ['prettier'],
\ 'scss': ['prettier'],
\ 'html': ['prettier'],
\ 'markdown': ['prettier']
\}
let g:ale_sign_error = '->'
let g:ale_sign_warning = '--'
let g:ale_lint_on_save = 1
let g:ale_fix_on_save_ignore = 1
highlight clear SignColumn
"vim-markdown
let g:vim_markdown_folding_disabled = 1
let g:vim_markdown_toc_autofit = 1
let g:vim_markdown_conceal = 0
let g:vim_markdown_frontmatter = 1
"vim-emmet
let g:user_emmet_install_global = 0
"}}}

View File

@ -1,129 +0,0 @@
"source system defaults
"----------------------{{{
if filereadable(expand('$VIMRUNTIME/defaults.vim'))
unlet! g:skip_defaults_vim
source $VIMRUNTIME/defaults.vim
endif
"}}}
"general settings
"----------------{{{
"encoding/format
set encoding=utf-8
set fileformats=unix,dos,mac
"file/buffer
set autoread
set autowrite
set confirm
"display
set background=dark
set number
set wrap
set foldmethod=marker
set listchars=tab:→\ ,extends:,precedes:,nbsp,space,trail,eol
" set list
"drawing
set lazyredraw
set regexpengine=1
set redrawtime=10000
"tab/indent
set tabstop=4
set softtabstop=4
set shiftwidth=4
set expandtab
set autoindent
"status bar
set showcmd
set wildmenu
set ruler
set laststatus=2
"search
set incsearch
set hlsearch
set ignorecase
set smartcase
"cursor behaviour
set virtualedit=block
set backspace=indent,eol,start
set scrolloff=2
set sidescrolloff=4
"input/timeout
set esckeys
set timeoutlen=1000 "for mappings
set ttimeoutlen=20 "for keycodes
"window behaviour (ltr)
set splitbelow
set splitright
"}}}
"os/gui settings
"---------------{{{
if has('win32')
let &runtimepath.=",$HOME/.vim"
endif
if has("gui_running")
set guioptions -=m
set guioptions -=T
if has("gui_gtk2")
set guifont=Inconsolata\ 12
elseif has("gui_macvim")
set guifont=Menlo\ Regular:h14
elseif has("gui_win32")
set guifont=Consolas:h10
" set guifont=Cascadia\ Code:h10
"start full-screened
augroup WINGUI
autocmd! GUIEnter * simalt ~x
augroup END
endif
endif
"}}}
"syntax/filetype/matchit
"-----------------------{{{
syntax on
filetype plugin indent on
runtime macros/matchit.vim
"}}}
"file cleanup
"------------{{{
"swap
let mySwapDir = expand("$HOME/.vim/.swap")
if !isdirectory(mySwapDir)
silent! call mkdir(mySwapDir, "p")
endif
let &directory=mySwapDir
"undo
if has('persistent_undo')
let myUndoDir = expand("$HOME/.vim/.undo")
if !isdirectory(myUndoDir)
silent! call mkdir(myUndoDir, "p")
endif
let &undodir=myUndoDir
set undofile
endif
"backup
if has('writebackup')
let myBackupDir = expand("$HOME/.vim/.backup")
if !isdirectory(myBackupDir)
silent! call mkdir(myBackupDir, "p")
endif
let &backupdir=myBackupDir
set backup
endif
"}}}

View File

@ -1,7 +0,0 @@
#!/bin/bash
main() {
echo "Hello World"
}
main

View File

@ -1,17 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="x-ua-compatible" content="ie=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Hello World</title>
<link rel="stylesheet" href="css/main.css" />
<link rel="icon" href="images/favicon.png" />
</head>
<body>
<h1>Hello World</h1>
<script src="js/main.js"></script>
</body>
</html>

View File

@ -1,8 +0,0 @@
#!/usr/bin/env python
def main():
print("Hello World")
main()

View File

@ -1,9 +0,0 @@
from flask import Flask
app = Flask(__name__)
@app.route('/')
@app.route('/index')
def index():
return "Hello, World!"

View File

@ -1,16 +0,0 @@
"__ _(_)_ __ ___ _ __ ___ "
"\ \ / / | '_ ` _ \| '__/ __|"
" \ V /| | | | | | | | | (__ "
" \_/ |_|_| |_| |_|_| \___|"
source ~/.vim/settings.vim
source ~/.vim/functions.vim
source ~/.vim/commands.vim
source ~/.vim/keybinds.vim
source ~/.vim/plugins.vim
source ~/.vim/colorschemes.vim
source ~/.vim/autocmds.vim
if filereadable(expand("~/.config/vimrc"))
source ~/.config/vimrc
endif

388
vimrc Normal file
View File

@ -0,0 +1,388 @@
"__ _(_)_ __ ___ _ __ ___
"\ \ / / | '_ ` _ \| '__/ __|
" \ V /| | | | | | | | | (__
" \_/ |_|_| |_| |_|_| \___|
"source system defaults
if filereadable(expand('$VIMRUNTIME/defaults.vim'))
unlet! g:skip_defaults_vim
source $VIMRUNTIME/defaults.vim
endif
"os settings
"-----------
if has('win32')
let &runtimepath.=",$HOME/.vim"
endif
"gui settings
"------------
if has("gui_running")
set guioptions -=m
set guioptions -=T
if has("gui_gtk2")
set guifont=Inconsolata\ 12
elseif has("gui_macvim")
set guifont=Menlo\ Regular:h14
elseif has("gui_win32")
" set guifont=Consolas:h10
set guifont=Cascadia\ Code:h10
endif
endif
"general settings
"----------------
"encoding/format
set encoding=utf-8
set fileformats=unix,dos,mac
"file/buffer
set autoread
set autowrite
set confirm
"display
set background=light
set number
set wrap
set foldmethod=marker
set listchars=tab:→\ ,extends:,precedes:,nbsp,space,trail,eol
" set list
"drawing
set lazyredraw
set regexpengine=1
set redrawtime=10000
"tab/indent
set tabstop=4
set softtabstop=4
set shiftwidth=4
set expandtab
set autoindent
"status bar
set showcmd
set wildmenu
set ruler
set laststatus=2
"search
set incsearch
set hlsearch
set ignorecase
set smartcase
"cursor behaviour
set virtualedit=block
set backspace=indent,eol,start
set showmatch
set scrolloff=2
set sidescrolloff=4
"input/timeout
set esckeys
set timeoutlen=1000 "for mappings
set ttimeoutlen=20 "for keycodes
"window behaviour (ltr)
set splitbelow
set splitright
"cleanup files created by vim
"swap
let mySwapDir = expand("$HOME/.vim/.swap")
if !isdirectory(mySwapDir)
silent! call mkdir(mySwapDir, "p")
endif
let &directory=mySwapDir
"undo
if has('persistent_undo')
let myUndoDir = expand("$HOME/.vim/.undo")
if !isdirectory(myUndoDir)
silent! call mkdir(myUndoDir, "p")
endif
let &undodir=myUndoDir
set undofile
endif
"backup
if has('writebackup')
let myBackupDir = expand("$HOME/.vim/.backup")
if !isdirectory(myBackupDir)
silent! call mkdir(myBackupDir, "p")
endif
let &backupdir=myBackupDir
set backup
endif
"plugins (vim-plug)
"------------------
"vim-plug paths
let plugDir = expand("$HOME/.vim/autoload/plug.vim")
let pluginDir = expand("$HOME/.vim/plugged")
let plugRemote = "https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim"
"ensure vim-plug is installed on VimEnter
if empty(glob(plugDir))
silent execute "!curl -fLo " . shellescape(expand(plugDir)) . " --create-dirs " . shellescape(plugRemote)
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif
call plug#begin(pluginDir)
Plug 'junegunn/vim-plug'
"quality of life
Plug 'tpope/vim-surround'
Plug 'tpope/vim-commentary'
Plug 'tpope/vim-unimpaired'
Plug 'tpope/vim-rsi'
Plug 'tpope/vim-eunuch'
Plug 'tpope/vim-repeat'
Plug 'editorconfig/editorconfig-vim'
"browser/url opener
Plug 'tyru/open-browser.vim'
"git
Plug 'tpope/vim-fugitive'
"visual
Plug 'flazz/vim-colorschemes'
"linting
Plug 'w0rp/ale'
"javascript/css/html
Plug 'pangloss/vim-javascript'
Plug 'mattn/emmet-vim'
"gdscript
Plug 'calviken/vim-gdscript3'
"go
Plug 'fatih/vim-go'
"md
Plug 'godlygeek/tabular'
Plug 'plasticboy/vim-markdown'
"toml
Plug 'cespare/vim-toml'
call plug#end()
"syntax/filetype settings
"---------------
" syntax on
" filetype plugin indent on
" runtime macros/matchit.vim
"plugin settings
"---------------
"netrw
let g:netrw_banner = 0
let g:netrw_winsize = 24
let g:netrw_liststyle = 3
let g:netrw_preview = 1
let g:netrw_alto = 0
let g:netrw_usetab = 1
let g:netrw_browsex_viewer = "xdg-open"
let g:NetrwIsOpen = 0 "for toggle function
"replace netrw gx command
let g:netrw_nogx = 1
nmap gx <Plug>(openbrowser-smart-search)
vmap gx <Plug>(openbrowser-smart-search)
"ale
let g:ale_linters = {
\ 'javascript': ['prettier', 'eslint'],
\ 'markdown': ['mdl', 'write-good']
\}
let g:ale_fixers = {
\ '*': ['remove_trailing_lines', 'trim_whitespace'],
\ 'javascript': ['eslint'],
\ 'markdown': ['prettier']
\}
let g:ale_sign_error = '->'
let g:ale_sign_warning = '--'
let g:ale_lint_on_save = 1
let g:ale_fix_on_save = 1
"vim-markdown
let g:vim_markdown_folding_disabled = 1
let g:vim_markdown_no_default_key_mappings = 1
let g:vim_markdown_toc_autofit = 1
" colorschemes
" {{{
" colorscheme 1989
" colorscheme PaperColor
" colorscheme gruvbox
" colorscheme jellybeans
" colorscheme molokai
" colorscheme Benokai
" colorscheme Monokai
" colorscheme badwolf
" colorscheme wombat256
" colorscheme yuejiu
" colorscheme wargrey
" colorscheme Tomorrow-Night-Bright
" colorscheme monokai-phoenix
" }}}
"leader key
let mapleader=' '
"normal/visual mode keybinds
"---------------------------
"paste and search
nnoremap <silent><leader><space> :let @/ = ""<CR>
nnoremap <leader>p :set invpaste<CR>
"toggles
nnoremap <silent><leader>lb :call ToggleLineBreak()<CR>
nnoremap <silent><leader>wr :call ToggleWrap()<CR>
nnoremap <silent><leader>cc :call ToggleColorColumn()<CR>
"dates
nnoremap <leader>ts "=strftime("%F %T%z")<CR>
nnoremap <leader>dt :r !date<CR>
"rc files
nnoremap <leader>rc :vsplit $MYVIMRC<CR>
nnoremap <leader>so :source $MYVIMRC<CR>
"formatting tools
nnoremap =j :%!python -m json.tool<CR>
"plugin keybinds
nnoremap <silent><leader>e :call ToggleNetrw()<CR>
nnoremap <leader>at :ALEToggle<CR>
"insert mode keybinds/abbreviations
"--------------------
inoreabbrev <expr> #!! "#!/usr/bin/env"
"custom commands
"---------------
"common typos and abbreviations
cnoremap w!! w !sudo tee % > /dev/null
command! W w !sudo tee % > /dev/null
command! Trim %s/\s\+$//
command! Q q
command! WQ wq
command! Q1 q!
"general functions
"-----------------
"toggle functions
function! ToggleColorColumn()
if &cc == ''
set cc=80
else
set cc=
endif
endfunction
function! ToggleLineBreak()
if &lbr == ''
set fo+=t "Autowraps text with textwidth
set fo-=l "Wraps long lines in --insert-- mode
set lbr
else
set fo-=t
set fo+=l
set lbr!
endif
endfunction
function! ToggleWrap()
if &wrap == ''
set wrap
else
set nowrap
endif
endfunction
function! ToggleNetrw() "make netrw toggleable <https://vi.stackexchange.com/questions/10988/toggle-explorer-window>
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
"autogroup filetype functions
"------------------
function BashSettings()
set syntax=sh
endfunction
function PythonSettings()
xnoremap <leader>r <esc>:'<,'>:w !python3<CR>
endfunction
function GoSettings()
set noexpandtab
let g:go_auto_type_info = 1
let g:go_imports_autosave = 1
endfunction
function HtmlSettings()
syntax sync fromstart
endfunction
"autogroup group functions
"-------------------------
function SpellSettings()
setlocal spell
endfunction
function HalftabSettings()
setlocal ts=2 sts=2 sw=2 expandtab
endfunction
"auto commands
"-------------
if has("autocmd")
"global
augroup global
autocmd!
"keep equal proportions when windows resized
autocmd VimResized * wincmd =
"save cursor position in a file
autocmd BufReadPost * if line("'\"") > 1 && line("'\"")
\ <= line("$") | exe "normal! g'\"" | endif
augroup END
augroup filetype_bash
autocmd! BufNewFile,BufRead *.bash call BashSettings()
augroup END
augroup filetype_python
autocmd! FileType python call PythonSettings()
augroup END
augroup filetype_go
autocmd! FileType go call GoSettings()
augroup END
augroup filetype_html
autocmd! FileType html call HtmlSettings()
augroup END
augroup filetype_spell
autocmd! FileType markdown call SpellSettings()
augroup END
augroup filetype_halftab
autocmd! FileType html,javascript,css,json,yaml,sh call HalftabSettings()
augroup END
endif