Compare commits

...

18 Commits

10 changed files with 128 additions and 33 deletions

8
bashrc
View File

@ -62,7 +62,7 @@ if [ "$color_prompt" = yes ]; then
else else
color="\033[1;35m" color="\033[1;35m"
fi fi
PS1="${color}╭── \u\033[33m::\033[34m\w\033[0m\n${color}╰▶ \033[0m" PS1="${color}┌── \u\033[33m::\033[34m\w\033[0m\n${color}└▷ \033[0m"
else else
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ ' PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
fi fi
@ -88,6 +88,12 @@ alias ll='ls -alF'
alias la='ls -A' alias la='ls -A'
alias l='ls -CF' alias l='ls -CF'
bind '"\e[A": history-search-backward'
bind '"\e[B": history-search-forward'
export PATH=~/.config/dotfiles/bin/:$PATH
alias u=update
# Add an "alert" alias for long running commands. Use like so: # Add an "alert" alias for long running commands. Use like so:
# sleep 10; alert # sleep 10; alert
alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"' alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'

0
bin/compress-pdf Normal file → Executable file
View File

19
bin/lmount Executable file
View File

@ -0,0 +1,19 @@
#!/usr/bin/env bash
if [ "$#" -ne 2 ]; then
echo -e >&2 "\x1B[1;31merror:\x1B[0;1m this program expects two arguments\x1B[0m"
echo -e >&2 "\x1B[1;33musage:\x1B[0;1m sudo lmount <drive> <mount point>"
exit 1
fi
if [ "$USER" != "root" ]; then
echo -e >&2 "\x1B[1;31merror:\x1B[0;1m this program must be run as root\x1B[0m"
echo -e >&2 "\x1B[1;33musage:\x1B[0;1m sudo lmount <drive> <mount point>"
exit 1
fi
# Mounts an encrypt external drive to a specified mount point
cryptsetup luksOpen $1 external
mount /dev/mapper/external $2

19
bin/lumount Executable file
View File

@ -0,0 +1,19 @@
#!/usr/bin/env bash
if [ "$#" -ne 1 ]; then
echo -e >&2 "\x1B[1;31merror:\x1B[0;1m this program expects one argument\x1B[0m"
echo -e >&2 "\x1B[1;33musage:\x1B[0;1m sudo lumount <mount point>"
exit 1
fi
if [ "$USER" != "root" ]; then
echo -e >&2 "\x1B[1;31merror:\x1B[0;1m this program must be run as root\x1B[0m"
echo -e >&2 "\x1B[1;33musage:\x1B[0;1m sudo lumount <mount point>"
exit 1
fi
# Mounts an encrypt external drive to a specified mount point
umount $1
cryptsetup luksClose external

15
coc-settings.json Normal file
View File

@ -0,0 +1,15 @@
{
"languageserver": {
"rust": {
"command": "rustup",
"args": ["run", "nightly", "rust-analyzer"],
"filetypes": ["rust"],
"rootPatterns": ["Cargo.toml"]
},
"elm": {
"command": "elm-language-server",
"filetypes": ["elm"],
"rootPatterns": ["elm.json"]
}
}
}

View File

@ -3,35 +3,24 @@ set nocompatible
" PLUGNIS ###########################################################{{{ " PLUGNIS ###########################################################{{{
call plug#begin() call plug#begin()
if has('nvim')
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' } " Conquer of Completion
else Plug 'neoclide/coc.nvim', {'branch': 'release'}
Plug 'Shougo/deoplete.nvim'
Plug 'roxma/nvim-yarp'
Plug 'roxma/vim-hug-neovim-rpc'
endif
" General plugins " General plugins
Plug 'vim-airline/vim-airline' Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes' Plug 'vim-airline/vim-airline-themes'
Plug 'https://gitea.tforgione.fr/tforgione/peach.git' Plug 'https://gitea.tforgione.fr/tforgione/peach.git'
Plug 'scrooloose/nerdtree' Plug 'scrooloose/nerdtree'
Plug 'w0rp/ale'
Plug 'tpope/vim-abolish' Plug 'tpope/vim-abolish'
" Language specific plugins " Language specific plugins
" C++
Plug 'Shougo/deoplete-clangx'
" Rust " Rust
Plug 'rust-lang/rust.vim' Plug 'rust-lang/rust.vim'
Plug 'racer-rust/vim-racer'
Plug 'sebastianmarkow/deoplete-rust'
" Elm " Elm
Plug 'ElmCast/elm-vim' Plug 'ElmCast/elm-vim'
Plug 'antew/vim-elm-language-server'
" Toml " Toml
Plug 'cespare/vim-toml' Plug 'cespare/vim-toml'
@ -56,6 +45,7 @@ set expandtab
set tabstop=4 set tabstop=4
set shiftwidth=4 set shiftwidth=4
set autoindent set autoindent
set tw=120
" }}} " }}}
" UI CONFIG #########################################################{{{ " UI CONFIG #########################################################{{{
@ -157,11 +147,49 @@ let g:markdown_composer_browser = 'firefox'
let g:instant_markdown_autostart = 0 let g:instant_markdown_autostart = 0
" }}} " }}}
" CODE COMPLETION ###################################################{{{ " COC CONFIG ########################################################{{{
" Use deoplete " Use `[g` and `]g` to navigate diagnostics
let g:deoplete#enable_at_startup = 1 " Use `:CocDiagnostics` to get all diagnostics of current buffer in location list.
autocmd FileType elm call deoplete#custom#buffer_option('auto_complete', v:false) nmap <silent> gp <Plug>(coc-diagnostic-prev)
nmap <silent> gn <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)
" Add `:Format` command to format current buffer.
command! -nargs=0 Format :call CocAction('format')
" 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
" Having longer updatetime (default is 4000 ms = 4 s) leads to noticeable
" delays and poor user experience.
set updatetime=300
" 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)
" Autoclose preview " Autoclose preview
autocmd CursorMovedI * if pumvisible() == 0|pclose|endif autocmd CursorMovedI * if pumvisible() == 0|pclose|endif
@ -169,19 +197,7 @@ autocmd InsertLeave * if pumvisible() == 0|pclose|endif
" Complete on tab " Complete on tab
inoremap <expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>" inoremap <expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>"
" }}} " }}}
" CUSTOM THINGS DEPENDING ON ENV ####################################{{{ " CUSTOM THINGS DEPENDING ON ENV ####################################{{{
let g:rustfmt_autosave = 1 let g:rustfmt_autosave = 1
let g:ale_linters = {}
let g:ale_c_parse_compile_commands=1
let g:ale_elm_ls_use_global = 1
let g:ale_linters_ignore = { 'elm': ['make'] }
let g:ale_lint_on_text_changed = 0
if $NVIM_DISABLE_PYTHON_LINTER == '1'
let g:ale_linters.python = []
endif
if $NVIM_DISABLE_JAVA_LINTER == '1'
let g:ale_linters.java = []
endif

View File

@ -51,11 +51,23 @@ alias bat="bat --paging=never"
alias rg="rg -uu" alias rg="rg -uu"
# Aliases for pass
alias p="pass"
alias pc="pass --clip"
# mkdir && cd # mkdir && cd
mkcd() { mkcd() {
mkdir $1 && cd $1 mkdir $1 && cd $1
} }
# which && cd
cdw() {
f=`which $1`
if [ $? -eq 0 ]; then
cd `dirname $f`
fi
}
# Initialize thefuck # Initialize thefuck
command -v thefuck > /dev/null 2>&1 command -v thefuck > /dev/null 2>&1

View File

@ -20,7 +20,7 @@ DISABLE_AUTO_TITLE="true"
# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*) # Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/me # Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/me
# Example format: plugins=(rails git textmate ruby lighthouse) # Example format: plugins=(rails git textmate ruby lighthouse)
plugins=(git myjump) plugins=(git myjump pass)
source $ZSH/oh-my-zsh.sh source $ZSH/oh-my-zsh.sh

View File

@ -27,3 +27,4 @@ export WINEDEBUG=-all
export RUST_BACKTRACE=full export RUST_BACKTRACE=full
export TERM=xterm-256color export TERM=xterm-256color
export REPORTTIME=5

View File

@ -83,11 +83,13 @@ local PR_TEMP=""
command -v vcgencmd > /dev/null && PR_TEMP=' ${PR_GREEN}$(vcgencmd measure_temp | cut -d = -f 2)${PR_NO_COLOR}' command -v vcgencmd > /dev/null && PR_TEMP=' ${PR_GREEN}$(vcgencmd measure_temp | cut -d = -f 2)${PR_NO_COLOR}'
local PR_DATE='${PR_BOLD}${PR_MAGENTA}[%D{%H:%M}]${PR_NO_COLOR}'
#PROMPT="${user_host} ${current_dir} ${rvm_ruby}${git_branch}$PR_PROMPT " #PROMPT="${user_host} ${current_dir} ${rvm_ruby}${git_branch}$PR_PROMPT "
separator='${PR_YELLOW}::${PR_NO_COLOR}' separator='${PR_YELLOW}::${PR_NO_COLOR}'
tty | read tty_value tty | read tty_value
if [[ $tty_value == *pts* ]]; then # if in a tty if [[ $tty_value == *pts* ]]; then # if in a tty
PROMPT="$PR_ARROW_UP${user_host}${separator}${PR_NO_COLOR}${current_dir} ${rvm_ruby}${git_branch}${PR_TEMP} PROMPT="$PR_ARROW_UP${PR_DATE} ${user_host}${separator}${PR_NO_COLOR}${current_dir} ${rvm_ruby}${git_branch}${PR_TEMP}
$PR_ARROW_DOWN$PR_PROMPT ${PR_NO_COLOR}" $PR_ARROW_DOWN$PR_PROMPT ${PR_NO_COLOR}"
return_code="%(?.%{$PR_GREEN%}%? ↵%{$PR_NO_COLOR%}.%{$PR_RED%}%? ↵%{$PR_NO_COLOR%})" return_code="%(?.%{$PR_GREEN%}%? ↵%{$PR_NO_COLOR%}.%{$PR_RED%}%? ↵%{$PR_NO_COLOR%})"
else else
@ -98,3 +100,8 @@ fi
RPS1=" ${return_code}" RPS1=" ${return_code}"
ZSH_THEME_GIT_PROMPT_PREFIX="%{$PR_YELLOW%}" ZSH_THEME_GIT_PROMPT_PREFIX="%{$PR_YELLOW%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$PR_NO_COLOR%}" ZSH_THEME_GIT_PROMPT_SUFFIX="%{$PR_NO_COLOR%}"
TMOUT=30
TRAPALRM() {
zle reset-prompt
}