junikimm717
3 years ago
commit
73c0a672e4
5 changed files with 512 additions and 0 deletions
-
28asroot.sh
-
104asuser.sh
-
134dotfiles/.zshrc
-
220dotfiles/init.vim
-
26graphical.sh
@ -0,0 +1,28 @@ |
|||
#!/bin/sh |
|||
|
|||
# script must start at home directory |
|||
cd "$HOME" || exit 1; |
|||
|
|||
#DIR="$(realpath "$(dirname "$0")")" |
|||
|
|||
usertest() { |
|||
if test "$(id -u)" -ne 0; then |
|||
echo "You must run this script as root."; |
|||
exit 1; |
|||
fi |
|||
} |
|||
|
|||
createjunikim() { |
|||
# create junikim |
|||
adduser -g "Juni Kim" junikim |
|||
adduser junikim video |
|||
adduser junikim input |
|||
adduser junikim wheel |
|||
} |
|||
|
|||
installdoas() { |
|||
apk add doas |
|||
echo "permit persist :wheel" >> /etc/doas.conf |
|||
} |
|||
|
|||
usertest && createjunikim && installdoas |
@ -0,0 +1,104 @@ |
|||
#!/bin/sh |
|||
|
|||
# script must start at home directory |
|||
cd "$HOME" || exit 1; |
|||
|
|||
DIR="$(realpath "$(dirname "$0")")" |
|||
|
|||
usertest() { |
|||
if test "$(id -u)" -eq 0; then |
|||
echo "You cannot run this script as root."; |
|||
exit 1; |
|||
fi |
|||
if ! (getent passwd junikim 2>&1) > /dev/null; then |
|||
echo "User junikim must exist."; |
|||
exit 1 |
|||
fi |
|||
|
|||
if ! (apk list | grep 'doas'); then |
|||
echo "doas is not installed."; |
|||
exit 1 |
|||
fi |
|||
} |
|||
|
|||
dev() { |
|||
echo "Developer tools..." |
|||
doas apk add git make python3 nodejs npm neovim |
|||
} |
|||
|
|||
sysinfo() { |
|||
echo "Dylan Araps scripts" |
|||
cd "$HOME" || exit 1; |
|||
mkdir -p repos |
|||
git clone https://github.com/dylanaraps/pfetch "$HOME/repos/pfetch" |
|||
git clone https://github.com/dylanaraps/neofetch "$HOME/repos/neofetch" |
|||
git clone https://github.com/dylanaraps/fff "$HOME/repos/fff" |
|||
|
|||
cd "$HOME/repos/pfetch" || exit 1; |
|||
doas make install || exit 2; |
|||
cd "$HOME" || exit 1; |
|||
|
|||
cd "$HOME/repos/neofetch" || exit 1; |
|||
doas make install || exit 2; |
|||
cd "$HOME" || exit 1; |
|||
|
|||
cd "$HOME/repos/fff" || exit 1; |
|||
doas make install || exit 2; |
|||
cd "$HOME" || exit 1; |
|||
} |
|||
|
|||
shell() { |
|||
echo "zsh installation and configuration as login shell" |
|||
doas apk add zsh |
|||
# set user permissions |
|||
awk -F ':' -v OFS=':' '{ |
|||
if ($1 == "junikim") { |
|||
print $1,$2,$3,$4,$5,$6,"/bin/zsh" |
|||
} else { |
|||
print $1,$2,$3,$4,$5,$6,$7 |
|||
}}' /etc/passwd > passwd.tmp |
|||
doas mv passwd.tmp /etc/passwd |
|||
# add starship and oh my zsh |
|||
doas apk add starfish |
|||
} |
|||
|
|||
# neovim must be installed. |
|||
plugins() { |
|||
# install vim-plug, oh-my-zsh, and zsh-syntax-highlighting |
|||
sh -c 'curl -fLo "${XDG_DATA_HOME:-$HOME/.local/share}"/nvim/site/autoload/plug.vim --create-dirs \ |
|||
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim' |
|||
sh -c "$(wget -O- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" |
|||
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git \ |
|||
"${ZSH_CUSTOM:-~/.oh-my-zsh/custom}"/plugins/zsh-syntax-highlighting |
|||
} |
|||
|
|||
dotfiles() { |
|||
echo "Adding vim and zsh configs" |
|||
if ! test -d "$DIR/dotfiles"; then |
|||
echo "$DIR/dotfiles folder not found."; |
|||
exit 1; |
|||
fi |
|||
mkdir -p "$HOME/.config/nvim" |
|||
cp "$DIR/dotfiles/.zshrc" "$HOME/.zshrc" |
|||
cp "$DIR/dotfiles/init.vim" "$HOME/.config/nvim/init.vim" |
|||
} |
|||
|
|||
competitiveprogramming() { |
|||
echo "CP Compilers..." |
|||
doas apk add g++ |
|||
doas apk add clang-dev |
|||
cd "$HOME" || exit 1; |
|||
git clone https://git.junickim.me/junikimm717/linuxcp "$HOME/cp" |
|||
} |
|||
|
|||
(usertest && dev && sysinfo && shell && plugins && dotfiles) || exit 1 |
|||
|
|||
cat <<EOF |
|||
Stuff you should do now: |
|||
|
|||
- run :PlugInstall |
|||
- add coc extensions |
|||
|
|||
- add in the competitive programming scripts (if you intend) by running the |
|||
competitiveprogramming function |
|||
EOF |
@ -0,0 +1,134 @@ |
|||
# If you come from bash you might have to change your $PATH. |
|||
# export PATH=$HOME/bin:/usr/local/bin:$PATH |
|||
|
|||
# Path to your oh-my-zsh installation. |
|||
export ZSH="$HOME/.oh-my-zsh" |
|||
|
|||
# Set name of the theme to load --- if set to "random", it will |
|||
# load a random theme each time oh-my-zsh is loaded, in which case, |
|||
# to know which specific one was loaded, run: echo $RANDOM_THEME |
|||
# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes |
|||
ZSH_THEME="robbyrussell" |
|||
|
|||
# Set list of themes to pick from when loading at random |
|||
# Setting this variable when ZSH_THEME=random will cause zsh to load |
|||
# a theme from this variable instead of looking in $ZSH/themes/ |
|||
# If set to an empty array, this variable will have no effect. |
|||
# ZSH_THEME_RANDOM_CANDIDATES=( "robbyrussell" "agnoster" ) |
|||
|
|||
# Uncomment the following line to use case-sensitive completion. |
|||
# CASE_SENSITIVE="true" |
|||
|
|||
# Uncomment the following line to use hyphen-insensitive completion. |
|||
# Case-sensitive completion must be off. _ and - will be interchangeable. |
|||
# HYPHEN_INSENSITIVE="true" |
|||
|
|||
# Uncomment one of the following lines to change the auto-update behavior |
|||
# zstyle ':omz:update' mode disabled # disable automatic updates |
|||
# zstyle ':omz:update' mode auto # update automatically without asking |
|||
# zstyle ':omz:update' mode reminder # just remind me to update when it's time |
|||
|
|||
# Uncomment the following line to change how often to auto-update (in days). |
|||
# zstyle ':omz:update' frequency 13 |
|||
|
|||
# Uncomment the following line if pasting URLs and other text is messed up. |
|||
# DISABLE_MAGIC_FUNCTIONS="true" |
|||
|
|||
# Uncomment the following line to disable colors in ls. |
|||
# DISABLE_LS_COLORS="true" |
|||
|
|||
# Uncomment the following line to disable auto-setting terminal title. |
|||
# DISABLE_AUTO_TITLE="true" |
|||
|
|||
# Uncomment the following line to enable command auto-correction. |
|||
# ENABLE_CORRECTION="true" |
|||
|
|||
# Uncomment the following line to display red dots whilst waiting for completion. |
|||
# You can also set it to another string to have that shown instead of the default red dots. |
|||
# e.g. COMPLETION_WAITING_DOTS="%F{yellow}waiting...%f" |
|||
# Caution: this setting can cause issues with multiline prompts in zsh < 5.7.1 (see #5765) |
|||
# COMPLETION_WAITING_DOTS="true" |
|||
|
|||
# Uncomment the following line if you want to disable marking untracked files |
|||
# under VCS as dirty. This makes repository status check for large repositories |
|||
# much, much faster. |
|||
# DISABLE_UNTRACKED_FILES_DIRTY="true" |
|||
|
|||
# Uncomment the following line if you want to change the command execution time |
|||
# stamp shown in the history command output. |
|||
# You can set one of the optional three formats: |
|||
# "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd" |
|||
# or set a custom format using the strftime function format specifications, |
|||
# see 'man strftime' for details. |
|||
# HIST_STAMPS="mm/dd/yyyy" |
|||
|
|||
# Would you like to use another custom folder than $ZSH/custom? |
|||
# ZSH_CUSTOM=/path/to/new-custom-folder |
|||
|
|||
# Which plugins would you like to load? |
|||
# Standard plugins can be found in $ZSH/plugins/ |
|||
# Custom plugins may be added to $ZSH_CUSTOM/plugins/ |
|||
# Example format: plugins=(rails git textmate ruby lighthouse) |
|||
# Add wisely, as too many plugins slow down shell startup. |
|||
plugins=(git zsh-syntax-highlighting) |
|||
|
|||
source $ZSH/oh-my-zsh.sh |
|||
|
|||
# User configuration |
|||
|
|||
# export MANPATH="/usr/local/man:$MANPATH" |
|||
|
|||
# You may need to manually set your language environment |
|||
# export LANG=en_US.UTF-8 |
|||
|
|||
# Preferred editor for local and remote sessions |
|||
# if [[ -n $SSH_CONNECTION ]]; then |
|||
# export EDITOR='vim' |
|||
# else |
|||
# export EDITOR='mvim' |
|||
# fi |
|||
|
|||
# Compilation flags |
|||
# export ARCHFLAGS="-arch x86_64" |
|||
|
|||
# Set personal aliases, overriding those provided by oh-my-zsh libs, |
|||
# plugins, and themes. Aliases can be placed here, though oh-my-zsh |
|||
# users are encouraged to define aliases within the ZSH_CUSTOM folder. |
|||
# For a full list of active aliases, run `alias`. |
|||
# |
|||
# Example aliases |
|||
# alias zshconfig="mate ~/.zshrc" |
|||
# alias ohmyzsh="mate ~/.oh-my-zsh" |
|||
|
|||
set -o vi |
|||
alias gac='git add . && git commit' |
|||
alias v='nvim' |
|||
alias s='ls' |
|||
#alias sy='systemctl' |
|||
#alias j='journalctl' |
|||
#alias r='source ranger' |
|||
alias c='clear' |
|||
alias e='exit' |
|||
alias o='xdg-open' |
|||
#alias ec='emacsclient' |
|||
alias cp='cp -r' |
|||
alias vc='nvim ~/.config/nvim/init.vim' |
|||
|
|||
|
|||
# ~/.zshrc |
|||
|
|||
eval "$(starship init zsh)" |
|||
|
|||
f() { |
|||
fff "$@" |
|||
cd "$(cat "${XDG_CACHE_HOME:=${HOME}/.cache}/fff/.fff_d")" |
|||
} |
|||
|
|||
export EDITOR=nvim |
|||
export PATH=~/cp:$PATH |
|||
|
|||
resetcursor() { |
|||
printf '\033]50;CursorShape=1\x7' |
|||
} |
|||
export PS1="$(resetcursor)$PS1" |
|||
|
@ -0,0 +1,220 @@ |
|||
call plug#begin(stdpath('data') . '/plugged') |
|||
" The default plugin directory will be as follows: |
|||
" - Vim (Linux/macOS): '~/.vim/plugged' |
|||
" - Vim (Windows): '~/vimfiles/plugged' |
|||
" - Neovim (Linux/macOS/Windows): stdpath('data') . '/plugged' |
|||
" You can specify a custom plugin directory by passing it as the argument |
|||
" - e.g. `call plug#begin('~/.vim/plugged')` |
|||
" - Avoid using standard Vim directory names like 'plugin' |
|||
|
|||
" Make sure you use single quotes |
|||
|
|||
" Shorthand notation; fetches https://github.com/junegunn/vim-easy-align |
|||
Plug 'tpope/vim-sensible' |
|||
Plug 'vim-airline/vim-airline' |
|||
Plug 'vim-airline/vim-airline-themes' |
|||
Plug 'Townk/vim-autoclose' |
|||
Plug 'neoclide/coc.nvim', {'branch': 'release'} |
|||
"let g:airline_powerline_fonts = 1 |
|||
|
|||
map j gj |
|||
map k gk |
|||
|
|||
" Initialize plugin system |
|||
call plug#end() |
|||
|
|||
let g:airline_them ='base16_atelier_heath_light' |
|||
|
|||
set number |
|||
set wrap |
|||
set linebreak |
|||
|
|||
" use indents of 4 spaces, and have them copied down lines: |
|||
set shiftwidth=2 |
|||
set tabstop=2 |
|||
set softtabstop=2 |
|||
set expandtab |
|||
set smarttab |
|||
set autoindent |
|||
set textwidth=80 |
|||
filetype indent off |
|||
|
|||
" enable filetype detection: |
|||
filetype on |
|||
|
|||
autocmd FileType markdown,tex,text set nosmarttab noautoindent |
|||
" for C-like programming, have automatic indentation: |
|||
autocmd FileType c,cpp,slang set cindent |
|||
" * Keystrokes -- Insert Mode |
|||
autocmd Filetype python set shiftwidth=4 tabstop=4 softtabstop=4 |
|||
|
|||
"Coc Stuff |
|||
|
|||
set encoding=utf-8 |
|||
|
|||
" TextEdit might fail if hidden is not set. |
|||
set hidden |
|||
|
|||
" Some servers have issues with backup files, see #649. |
|||
set nobackup |
|||
set nowritebackup |
|||
|
|||
" Give more space for displaying messages. |
|||
set cmdheight=2 |
|||
|
|||
" Having longer updatetime (default is 4000 ms = 4 s) leads to noticeable |
|||
" delays and poor user experience. |
|||
set updatetime=300 |
|||
|
|||
" Don't pass messages to |ins-completion-menu|. |
|||
set shortmess+=c |
|||
|
|||
" Always show the signcolumn, otherwise it would shift the text each time |
|||
" diagnostics appear/become resolved. |
|||
if has("nvim-0.5.0") || has("patch-8.1.1564") |
|||
" Recently vim can merge signcolumn and number column into one |
|||
set signcolumn=number |
|||
else |
|||
set signcolumn=yes |
|||
endif |
|||
|
|||
" Use tab for trigger completion with characters ahead and navigate. |
|||
" NOTE: Use command ':verbose imap <tab>' to make sure tab is not mapped by |
|||
" other plugin before putting this into your config. |
|||
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 |
|||
|
|||
" Use <c-space> to trigger completion. |
|||
if has('nvim') |
|||
inoremap <silent><expr> <c-space> coc#refresh() |
|||
else |
|||
inoremap <silent><expr> <c-@> coc#refresh() |
|||
endif |
|||
|
|||
" Make <CR> auto-select the first completion item and notify coc.nvim to |
|||
" format on enter, <cr> could be remapped by other vim plugin |
|||
inoremap <silent><expr> <cr> pumvisible() ? coc#_select_confirm() |
|||
\: "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>" |
|||
|
|||
" Use `[g` and `]g` to navigate diagnostics |
|||
" Use `:CocDiagnostics` to get all diagnostics of current buffer in location list. |
|||
nmap <silent> [g <Plug>(coc-diagnostic-prev) |
|||
nmap <silent> ]g <Plug>(coc-diagnostic-next) |
|||
|
|||
" GoTo code navigation. |
|||
nmap <silent> gd <Plug>(coc-definition) |
|||
nmap <silent> gy <Plug>(coc-type-definition) |
|||
nmap <silent> gi <Plug>(coc-implementation) |
|||
nmap <silent> gr <Plug>(coc-references) |
|||
|
|||
" Use K to show documentation in preview window. |
|||
nnoremap <silent> K :call <SID>show_documentation()<CR> |
|||
|
|||
function! s:show_documentation() |
|||
if (index(['vim','help'], &filetype) >= 0) |
|||
execute 'h '.expand('<cword>') |
|||
elseif (coc#rpc#ready()) |
|||
call CocActionAsync('doHover') |
|||
else |
|||
execute '!' . &keywordprg . " " . expand('<cword>') |
|||
endif |
|||
endfunction |
|||
|
|||
" Highlight the symbol and its references when holding the cursor. |
|||
autocmd CursorHold * silent call CocActionAsync('highlight') |
|||
|
|||
" Symbol renaming. |
|||
nmap <leader>rn <Plug>(coc-rename) |
|||
|
|||
" Formatting selected code. |
|||
xmap <leader>f <Plug>(coc-format-selected) |
|||
nmap <leader>f <Plug>(coc-format-selected) |
|||
|
|||
augroup mygroup |
|||
autocmd! |
|||
" Setup formatexpr specified filetype(s). |
|||
autocmd FileType typescript,json setl formatexpr=CocAction('formatSelected') |
|||
" Update signature help on jump placeholder. |
|||
autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp') |
|||
augroup end |
|||
|
|||
" Applying codeAction to the selected region. |
|||
" Example: `<leader>aap` for current paragraph |
|||
xmap <leader>a <Plug>(coc-codeaction-selected) |
|||
nmap <leader>a <Plug>(coc-codeaction-selected) |
|||
|
|||
" Remap keys for applying codeAction to the current buffer. |
|||
nmap <leader>ac <Plug>(coc-codeaction) |
|||
" Apply AutoFix to problem on the current line. |
|||
nmap <leader>qf <Plug>(coc-fix-current) |
|||
|
|||
" Run the Code Lens action on the current line. |
|||
nmap <leader>cl <Plug>(coc-codelens-action) |
|||
|
|||
" Map function and class text objects |
|||
" NOTE: Requires 'textDocument.documentSymbol' support from the language server. |
|||
xmap if <Plug>(coc-funcobj-i) |
|||
omap if <Plug>(coc-funcobj-i) |
|||
xmap af <Plug>(coc-funcobj-a) |
|||
omap af <Plug>(coc-funcobj-a) |
|||
xmap ic <Plug>(coc-classobj-i) |
|||
omap ic <Plug>(coc-classobj-i) |
|||
xmap ac <Plug>(coc-classobj-a) |
|||
omap ac <Plug>(coc-classobj-a) |
|||
|
|||
" Remap <C-f> and <C-b> for scroll float windows/popups. |
|||
if has('nvim-0.4.0') || has('patch-8.2.0750') |
|||
nnoremap <silent><nowait><expr> <C-f> coc#float#has_scroll() ? coc#float#scroll(1) : "\<C-f>" |
|||
nnoremap <silent><nowait><expr> <C-b> coc#float#has_scroll() ? coc#float#scroll(0) : "\<C-b>" |
|||
inoremap <silent><nowait><expr> <C-f> coc#float#has_scroll() ? "\<c-r>=coc#float#scroll(1)\<cr>" : "\<Right>" |
|||
inoremap <silent><nowait><expr> <C-b> coc#float#has_scroll() ? "\<c-r>=coc#float#scroll(0)\<cr>" : "\<Left>" |
|||
vnoremap <silent><nowait><expr> <C-f> coc#float#has_scroll() ? coc#float#scroll(1) : "\<C-f>" |
|||
vnoremap <silent><nowait><expr> <C-b> coc#float#has_scroll() ? coc#float#scroll(0) : "\<C-b>" |
|||
endif |
|||
|
|||
" Use CTRL-S for selections ranges. |
|||
" Requires 'textDocument/selectionRange' support of language server. |
|||
nmap <silent> <C-s> <Plug>(coc-range-select) |
|||
xmap <silent> <C-s> <Plug>(coc-range-select) |
|||
|
|||
" Add `:Format` command to format current buffer. |
|||
command! -nargs=0 Format :call CocActionAsync('format') |
|||
|
|||
" Add `:Fold` command to fold current buffer. |
|||
command! -nargs=? Fold :call CocAction('fold', <f-args>) |
|||
|
|||
" Add `:OR` command for organize imports of the current buffer. |
|||
command! -nargs=0 OR :call CocActionAsync('runCommand', 'editor.action.organizeImport') |
|||
|
|||
" Add (Neo)Vim's native statusline support. |
|||
" NOTE: Please see `:h coc-status` for integrations with external plugins that |
|||
" provide custom statusline: lightline.vim, vim-airline. |
|||
set statusline^=%{coc#status()}%{get(b:,'coc_current_function','')} |
|||
|
|||
" Mappings for CoCList |
|||
" Show all diagnostics. |
|||
nnoremap <silent><nowait> <space>a :<C-u>CocList diagnostics<cr> |
|||
" Manage extensions. |
|||
nnoremap <silent><nowait> <space>e :<C-u>CocList extensions<cr> |
|||
" Show commands. |
|||
nnoremap <silent><nowait> <space>c :<C-u>CocList commands<cr> |
|||
" Find symbol of current document. |
|||
nnoremap <silent><nowait> <space>o :<C-u>CocList outline<cr> |
|||
" Search workspace symbols. |
|||
nnoremap <silent><nowait> <space>s :<C-u>CocList -I symbols<cr> |
|||
" Do default action for next item. |
|||
nnoremap <silent><nowait> <space>j :<C-u>CocNext<CR> |
|||
" Do default action for previous item. |
|||
nnoremap <silent><nowait> <space>k :<C-u>CocPrev<CR> |
|||
" Resume latest coc list. |
|||
nnoremap <silent><nowait> <space>p :<C-u>CocListResume<CR> |
|||
|
|||
" END Coc |
@ -0,0 +1,26 @@ |
|||
#!/bin/sh |
|||
|
|||
usertest() { |
|||
if test "$(id -u)" -eq 0; then |
|||
echo "You cannot run this script as root."; |
|||
exit 1; |
|||
fi |
|||
if ! (getent passwd junikim 2>&1) > /dev/null; then |
|||
echo "User junikim must exist."; |
|||
exit 1 |
|||
fi |
|||
|
|||
if ! (apk list | grep 'doas'); then |
|||
echo "doas is not installed."; |
|||
exit 1 |
|||
fi |
|||
} |
|||
|
|||
usertest |
|||
|
|||
echo "setting up xorg and xfce desktop environment" |
|||
|
|||
doas setup-xorg-base |
|||
apk add xfce4 xfce4-terminal dbus |
|||
|
|||
echo "exec startxfce4" >> "$HOME/.xinitrc" |
Write
Preview
Loading…
Cancel
Save
Reference in new issue