23 Commits

Author SHA1 Message Date
7bbf9b8c9b Update init.vim 2023-10-11 10:01:55 +02:00
f1ee5b1aff Restore old init.vim 2022-12-07 12:45:51 +01:00
db37bf1d54 u=update 2022-07-02 14:32:37 +02:00
f2ddfa9590 Adds path 2022-07-02 14:32:05 +02:00
e767ecead0 Arrows 2022-07-02 13:38:53 +02:00
9a6bc3197e Update bashrc 2022-07-02 13:37:27 +02:00
b982ecb5a5 Merge branch 'master' into dev 2022-05-17 16:25:42 +02:00
5b8c0275f3 Adds laptop hostname theme 2022-05-17 16:25:29 +02:00
7f937a2902 Merge branch 'master' into dev 2022-05-08 19:21:05 +02:00
6eed7a6523 Merge pull request 'Adds a loop in weather script to get weather for several cities at once' (#1) from feature/weather_city_loop into master
Reviewed-on: #1
2022-05-08 17:19:33 +00:00
76f6f09a67 Adds a loop in weather script to get weather for several cities a once 2022-05-08 19:09:40 +02:00
45210b6c8f Adds cdw alias 2022-04-19 11:25:37 +02:00
b35bc69b88 tw=120 2022-02-17 16:18:13 +01:00
ec14c1c073 Easy mount/umount luks encrypted partitions 2022-02-16 16:09:13 +01:00
611ab5791f Adds support for pass 2021-10-18 16:07:44 +02:00
2e567f0a65 Adds reporttime 2021-10-18 15:04:03 +02:00
409fb9bb4b Show online hours and minutes, refresh every 30 s 2021-10-18 14:55:35 +02:00
509ed9956f Adds time to prompt 2021-10-18 14:49:37 +02:00
ee50dfd355 Merge branch 'dev' of gitea.tforgione.fr:tforgione/dotfiles into dev 2021-10-11 14:10:59 +02:00
ef3986e99f Adds :Format 2021-10-11 14:10:52 +02:00
30396f438a Adds :Format 2021-10-11 14:07:45 +02:00
Nicolas Bertrand
b665d16bc5 Merge branch 'master' into dev 2021-07-02 15:38:56 +02:00
e2773fcf6c Migrate to coc 2021-06-26 22:16:10 +02:00
4 changed files with 276 additions and 204 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

365
init.vim
View File

@@ -1,203 +1,162 @@
" Pas de compatibilité a VI ! " Pas de compatibilité a VI !
set nocompatible set nocompatible
" PLUGNIS ###########################################################{{{ " PLUGNIS ###########################################################{{{
call plug#begin() call plug#begin()
" Conquer of Completion " General plugins
Plug 'neoclide/coc.nvim', {'branch': 'release'} Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
" General plugins Plug 'https://gitea.tforgione.fr/tforgione/peach.git'
Plug 'vim-airline/vim-airline' Plug 'scrooloose/nerdtree'
Plug 'vim-airline/vim-airline-themes' Plug 'tpope/vim-abolish'
Plug 'https://gitea.tforgione.fr/tforgione/peach.git'
Plug 'scrooloose/nerdtree' " Language specific plugins
Plug 'tpope/vim-abolish'
" Language specific plugins " Rust
Plug 'rust-lang/rust.vim'
" Rust
Plug 'rust-lang/rust.vim' " Elm
Plug 'ElmCast/elm-vim'
" Elm
Plug 'ElmCast/elm-vim' " Toml
Plug 'cespare/vim-toml'
" Toml
Plug 'cespare/vim-toml' " Pug
Plug 'digitaltoad/vim-pug'
" Pug
Plug 'digitaltoad/vim-pug' call plug#end()
" Spandex " Line numbers and syntaxic coloration
Plug 'rust-spandex/spandex.vim' " set nu
" syntax on
call plug#end()
" Highlight bad spaces (not working...)
" Line numbers and syntaxic coloration " }}}
" set nu
" syntax on " INDENTATION #######################################################{{{
set expandtab
" Highlight bad spaces (not working...) set tabstop=4
" }}} set shiftwidth=4
set autoindent
" INDENTATION #######################################################{{{ " }}}
set expandtab
set tabstop=4 " UI CONFIG #########################################################{{{
set shiftwidth=4 set number
set autoindent if $NVIM_LINE_NUMBER == 'rnu'
set tw=120 set rnu
" }}} endif
set showcmd
" UI CONFIG #########################################################{{{ set wildmenu
set number set lazyredraw
if $NVIM_LINE_NUMBER == 'rnu' set encoding=utf8
set rnu set clipboard=unnamedplus
endif set updatecount=50
set showcmd set mouse=a
set wildmenu set guicursor=
set lazyredraw " set ttymouse=sgr
set encoding=utf8 " Espaces insécables grrrr
set clipboard=unnamedplus set list
set updatecount=50 set listchars=tab:,trail,extends:>,precedes:<,nbsp
set mouse=a " Remove trailing spaces
set guicursor= autocmd BufWritePre * :%s/\s\+$//e
" set ttymouse=sgr
" Espaces insécables grrrr " Compile on F12
set list if executable('mars')
set listchars=tab:,trail,extends:>,precedes:<,nbsp nnoremap <silent><F12> :wa \| !mars -p %:p<CR>
" Remove trailing spaces inoremap <silent><F12> <C-O>:wa \|!mars -p %:p<CR>
autocmd BufWritePre * :%s/\s\+$//e vnoremap <silent><F12> :wa \|!mars -p %:p<CR>
elseif executable('make')
" Compile on F12 nnoremap <silent><F12> :wa \| !make -p %:p<CR>
if executable('mars') inoremap <silent><F12> <C-O>:wa \|!make -p %:p<CR>
nnoremap <silent><F12> :wa \| !mars -p %:p<CR> vnoremap <silent><F12> :wa \|!make -p %:p<CR>
inoremap <silent><F12> <C-O>:wa \|!mars -p %:p<CR> endif
vnoremap <silent><F12> :wa \|!mars -p %:p<CR>
elseif executable('make') " Escape on F1
nnoremap <silent><F12> :wa \| !make -p %:p<CR> map <F1> <Esc>
inoremap <silent><F12> <C-O>:wa \|!make -p %:p<CR> imap <F1> <Esc>
vnoremap <silent><F12> :wa \|!make -p %:p<CR> " vim airline config
endif set laststatus=2
let g:airline_powerline_fonts = 1
" Escape on F1 let g:airline#extensions#branch#format = 1
map <F1> <Esc> let g:airline_theme='dark'
imap <F1> <Esc> set t_Co=256
" vim airline config " Set textwidth for latex
set laststatus=2 " autocmd FileType tex set textwidth=79
let g:airline_powerline_fonts = 1 " }}}
let g:airline#extensions#branch#format = 1
let g:airline_theme='dark' " COLOR #############################################################{{{
set t_Co=256 set background=dark
" Set textwidth for latex syntax enable
" autocmd FileType tex set textwidth=79 try
" }}} colorscheme peach
catch
" COLOR #############################################################{{{ endtry
set background=dark highlight BadWhitespace ctermbg=red guibg=red
syntax enable match BadWhitespace / \| \+\t/
try " }}}
colorscheme peach
catch " SEARCHING #########################################################{{{
endtry set title
highlight BadWhitespace ctermbg=red guibg=red set showmatch
match BadWhitespace / \| \+\t/ set hlsearch
" }}} set noincsearch
" }}}
" SEARCHING #########################################################{{{
set title " NERDTREE ##########################################################{{{
set showmatch let NERDTreeIgnore = ['\.pyc$','__pycache__']
set hlsearch set shell=zsh
set noincsearch let g:NERDTreeIndicatorMapCustom = {
" }}} \ "Modified" : "✹",
\ "Staged" : "✚",
" NERDTREE ##########################################################{{{ \ "Untracked" : "✭",
let NERDTreeIgnore = ['\.pyc$','__pycache__'] \ "Renamed" : "➜",
set shell=zsh \ "Unmerged" : "═",
let g:NERDTreeIndicatorMapCustom = { \ "Deleted" : "✖",
\ "Modified" : "", \ "Dirty" : "",
\ "Staged" : "", \ "Clean" : "✔︎",
\ "Untracked" : "✭", \ "Unknown" : "?"
\ "Renamed" : "➜", \ }
\ "Unmerged" : "═", let g:WebDevIconsNerdTreeGitPluginForceVAlign = 1
\ "Deleted" : "✖", " }}}
\ "Dirty" : "✗",
\ "Clean" : "✔︎", " BACKUPS ###########################################################{{{
\ "Unknown" : "?" set dir=$HOME/.nvim/swp//
\ } autocmd BufWritePost * :silent execute ':w! ' ."$HOME/.nvim/backups/" . substitute(escape(substitute(expand('%:p'), "/", "%", "g"), "%"), ' ', '\\ ', 'g')
let g:WebDevIconsNerdTreeGitPluginForceVAlign = 1
" }}} if exists('+undofile')
set undofile
" BACKUPS ###########################################################{{{ set undolevels=1000
set dir=$HOME/.nvim/swp// set undoreload=10000
autocmd BufWritePost * :silent execute ':w! ' ."$HOME/.nvim/backups/" . substitute(escape(substitute(expand('%:p'), "/", "%", "g"), "%"), ' ', '\\ ', 'g') if exists('+undodir')
set undodir=$HOME/.nvim/undo
if exists('+undofile') endif
set undofile endif
set undolevels=1000 " }}}
set undoreload=10000
if exists('+undodir')
set undodir=$HOME/.nvim/undo " MARKDOWN PREVIEW ##################################################{{{
endif let g:markdown_composer_browser = 'firefox'
endif let g:instant_markdown_autostart = 0
" }}} " }}}
function! s:check_back_space() abort
" MARKDOWN PREVIEW ##################################################{{{ let col = col('.') - 1
let g:markdown_composer_browser = 'firefox' return !col || getline('.')[col - 1] =~ '\s'
let g:instant_markdown_autostart = 0 endfunction
" }}}
" COC CONFIG ########################################################{{{ " CUSTOM THINGS DEPENDING ON ENV ####################################{{{
let g:rustfmt_autosave = 1
" Use `[g` and `]g` to navigate diagnostics let g:ale_linters = {}
" Use `:CocDiagnostics` to get all diagnostics of current buffer in location list. let g:ale_c_parse_compile_commands=1
nmap <silent> gp <Plug>(coc-diagnostic-prev) let g:ale_elm_ls_use_global = 1
nmap <silent> gn <Plug>(coc-diagnostic-next) let g:ale_linters_ignore = { 'elm': ['make'] }
let g:ale_lint_on_text_changed = 0
" GoTo code navigation. if $NVIM_DISABLE_PYTHON_LINTER == '1'
nmap <silent> gd <Plug>(coc-definition) let g:ale_linters.python = []
nmap <silent> gy <Plug>(coc-type-definition) endif
nmap <silent> gi <Plug>(coc-implementation) if $NVIM_DISABLE_JAVA_LINTER == '1'
nmap <silent> gr <Plug>(coc-references) let g:ale_linters.java = []
endif
" 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
autocmd CursorMovedI * if pumvisible() == 0|pclose|endif
autocmd InsertLeave * if pumvisible() == 0|pclose|endif
" Complete on tab
inoremap <expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>"
" }}}
" CUSTOM THINGS DEPENDING ON ENV ####################################{{{
let g:rustfmt_autosave = 1

View File

@@ -0,0 +1,107 @@
# ZSH Theme - Preview: http://dl.dropbox.com/u/4109351/pics/gnzh-zsh-theme.png
# Based on bira theme
# load some modules
autoload -U colors zsh/terminfo # Used in the colour alias below
colors
setopt prompt_subst
# make some aliases for the colours: (coud use normal escap.seq's too)
for color in RED GREEN YELLOW BLUE MAGENTA CYAN WHITE; do
eval PR_$color='%{$fg[${(L)color}]%}'
done
eval PR_NO_COLOR="%{$terminfo[sgr0]%}"
eval PR_BOLD="%{$terminfo[bold]%}"
# Check the UID
if [[ $UID -ge 1000 ]]; then # normal user
# If ssh
if [[ -n "$SSH_CLIENT" || -n "$SSH2_CLIENT" ]]; then
eval PR_USER='${PR_GREEN}%n@%M${PR_NO_COLOR}'
eval PR_USER_OP='${PR_GREEN}%#${PR_NO_COLOR}'
local PR_ARROW_UP='${PR_GREEN}┌── ${PR_NO_COLOR}'
local PR_ARROW_DOWN='${PR_GREEN}└${PR_NO_COLOR}'
local PR_PROMPT='$PR_GREEN▷$PR_NO_COLOR'
else
eval PR_USER='${PR_MAGENTA}%n@%M${PR_NO_COLOR}'
eval PR_USER_OP='${PR_BLUE}%#${PR_NO_COLOR}'
local PR_PROMPT='$PR_MAGENTA▷$PR_NO_COLOR'
local PR_ARROW_UP='$PR_MAGENTA┌── ${PR_NO_COLOR}'
local PR_ARROW_DOWN='$PR_MAGENTA└${PR_NO_COLOR}'
fi
elif [[ $UID -eq 0 ]]; then # root
eval PR_USER='${PR_RED}%n${PR_NO_COLOR}'
eval PR_USER_OP='${PR_RED}%#${PR_NO_COLOR}'
local PR_ARROW_UP='${PR_RED}┌── ${PR_NO_COLOR}'
local PR_ARROW_DOWN='${PR_RED}└${PR_NO_COLOR}'
local PR_PROMPT='$PR_RED▷$PR_NO_COLOR'
fi
# Check if we are on SSH or not
if [[ -n "$SSH_CLIENT" || -n "$SSH2_CLIENT" ]]; then
eval PR_HOST='${PR_GREEN}%M${PR_NO_COLOR}' #SSH
else
eval PR_HOST='${PR_BLUE}%M${PR_NO_COLOR}' # no SSH
fi
# local return_code="%(?..%{$PR_RED%}%? ↵%{$PR_NO_COLOR%})"
truncated_pwd() {
local max_allowed_size=$(( `tput cols` - 30 ))
local path_name=$(print -rD $PWD)
local new_path_name=""
local truncated=0
while [ ${#path_name} -gt $max_allowed_size ]; do
truncated=1
new_path_name=`echo $path_name | cut -d '/' -f 2-`
if [[ "$new_path_name" == "$path_name" ]]; then
break
fi
path_name=$new_path_name
done
if [ $truncated -eq 1 ]; then
echo "~/.../"$path_name
else
echo $path_name
fi
}
local user_host='$PR_BOLD${PR_USER}$PR_BOLD'
local current_dir='$PR_BOLD%{$PR_BLUE%}$(truncated_pwd)$PR_NO_COLOR%}'
local rvm_ruby=''
if which rvm-prompt &> /dev/null; then
rvm_ruby='%{$PR_RED%}$(rvm-prompt i v g s)%{$PR_NO_COLOR%}'
else
if which rbenv &> /dev/null; then
rvm_ruby='%{$PR_RED%}$(rbenv version | sed -e "s/ (set.*$//")%{$PR_NO_COLOR%}'
fi
fi
local return_code=""
local git_branch='$(git_prompt_info)'
local PR_TEMP=""
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 "
separator='${PR_YELLOW}::${PR_NO_COLOR}'
tty | read tty_value
if [[ $tty_value == *pts* ]]; then # if in a tty
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}"
return_code="%(?.%{$PR_GREEN%}%? ↵%{$PR_NO_COLOR%}.%{$PR_RED%}%? ↵%{$PR_NO_COLOR%})"
else
eval PR_NO_COLOR="$PR_WHITE"
PROMPT="${user_host} ${current_dir} ${rvm_ruby} ${git_branch}> ${PR_NO_COLOR}"
return_code="%(?.%{$PR_GREEN%}%? <%{$PR_NO_COLOR%}.%{$PR_RED%}%? <%{$PR_NO_COLOR%})"
fi
RPS1=" ${return_code}"
ZSH_THEME_GIT_PROMPT_PREFIX="%{$PR_YELLOW%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$PR_NO_COLOR%}"
TMOUT=30
TRAPALRM() {
zle reset-prompt
}