From 7999193a52252bf35954ed623f14b22f943804f9 Mon Sep 17 00:00:00 2001 From: Charles Cabergs Date: Wed, 7 Oct 2020 14:30:55 +0200 Subject: Added ignore dSYM, pydoc3 alias c_formatter path ssh-add --- .bashrc | 3 +++ .pluggins.vim | 6 +++++- .vimrc | 63 +++++++++++++++++++++++++++++++++++++++++++++++------------ .zprofile | 26 ++++++++++++++++++++---- .zsh_aliases | 14 +++++++------ .zshrc | 7 +++++-- 6 files changed, 93 insertions(+), 26 deletions(-) diff --git a/.bashrc b/.bashrc index 1cdb55a..a71a9df 100644 --- a/.bashrc +++ b/.bashrc @@ -28,3 +28,6 @@ export XDG_DATA_HOME="$HOME/.data/" # vim key bindings set -o vi + +# Added by c_formatter_42 +export PATH="$PATH:/Users/cacharle/git/c_formatter_42" diff --git a/.pluggins.vim b/.pluggins.vim index 333be41..883e54d 100644 --- a/.pluggins.vim +++ b/.pluggins.vim @@ -19,13 +19,14 @@ call plug#begin() Plug 'tikhomirov/vim-glsl' " glsl Plug 'cespare/vim-toml' " toml Plug 'ziglang/zig.vim' " zig + Plug 'vim-scripts/applescript.vim' " applescript " s19 at home Plug 'cacharle/vim-42header' " 42 header " themes " Plug 'joshdick/onedark.vim' " onedark - " Plug 'dracula/vim', {'as': 'vim'} " dracula + Plug 'dracula/vim', {'as': 'vim'} " dracula Plug 'altercation/vim-colors-solarized' " solarized " intresting but not used @@ -35,4 +36,7 @@ call plug#begin() " Plug 'vim-scripts/rfc-syntax' " rfc " Plug 'tacahiroy/ctrlp-funky' " extension to search function " Plug 'easymotion/vim-easymotion' " TODO very intresting + + Plug '~/git/c_formatter_42.vim' + Plug '~/git/doxy42.vim' call plug#end() diff --git a/.vimrc b/.vimrc index 76dd3e9..634e947 100644 --- a/.vimrc +++ b/.vimrc @@ -6,6 +6,7 @@ source $DOTDIR/.pluggins.vim " }}} + """"""""""" " options " """"""""""" @@ -80,24 +81,24 @@ set nofoldenable " not folded by default " colorscheme onedark " }}} " dracula {{{ -" let g:dracula_bold = 1 -" let g:dracula_italic = 1 -" let g:dracula_colorterm = 0 -" colorscheme dracula +let g:dracula_bold = 0 +let g:dracula_italic = 0 +let g:dracula_colorterm = 0 +colorscheme dracula " }}} " solarized {{{ -set t_Co=16 -let g:solarized_termcolors=16 -let g:solarized_visibility='low' " visibility of invisible chars with set list -set background=dark -colorscheme solarized +" set t_Co=16 +" let g:solarized_termcolors=16 +" let g:solarized_visibility='low' " visibility of invisible chars with set list +" set background=dark +" colorscheme solarized " }}} " lightline {{{ let g:lightline = {} " let g:lightline.colorscheme = 'solarized' " lightline theme to solarized " let g:lightline.colorscheme = 'jellybeans' " lightline theme to onedark let g:lightline = { - \ 'colorscheme': 'solarized', + \ 'colorscheme': 'dracula', \ 'active': { \ 'left': [ [ 'mode', 'paste' ], \ [ 'gitbranch', 'readonly', 'filename', 'modified' ] ] @@ -151,6 +152,9 @@ nnoremap t nnoremap cu ct_ nnoremap cp ct) nnoremap c, ct, +" write shortcut that doesn't involve +" (macos paste clipboard on enter for some reason) +nnoremap ZZ :w " }}} " buffer navigation {{{ @@ -162,7 +166,7 @@ nnoremap bl :ls " vimrc {{{ nnoremap rc :vsplit $DOTDIR/.vimrc -nnoremap src :source $MYVIMRC +nnoremap sc :source $MYVIMRC " }}} " c {{{ @@ -170,7 +174,7 @@ nnoremap src :source $MYVIMRC nnoremap gcf A{}j " initialise a school header file -function PutHeaderBoilerPlate() +function! PutHeaderBoilerPlate() let l:filename = join(split(toupper(expand('%:t')), '\.'), "_") " echom l:filename call append(12, "#ifndef " . l:filename) @@ -188,7 +192,7 @@ autocmd Filetype cpp setlocal comments=s:/**,m:**,e:*/,s:/*,m:**,e:*/ " cpp {{{ " Put Coplien Form boilerplate class -function PutCoplienFormFunc(name) +function! PutCoplienFormFunc(name) let l:default_constructor = a:name . "();\n" let l:copy_constructor = a:name . "(const " . a:name . "& other);\n" let l:copy_operator = a:name . "& operator=(const " . a:name . "& other);\n" @@ -243,6 +247,8 @@ autocmd Filetype vim setlocal foldmethod=marker autocmd FileType haskell set formatprg=stylish-haskell autocmd FileType lisp set shiftwidth=2 + +autocmd FileType python set keywordprg=pydoc3 " }}} """""""""""" @@ -278,3 +284,34 @@ let g:ctrlp_mruf_case_sensitive = 0 xmap ga (EasyAlign) nmap ga (EasyAlign) " }}} + +" c_formatter_42 {{{ +let g:c_formatter_42_set_equalprg=1 +let g:c_formatter_42_format_on_save=0 +" }}} + +function! s:CountScopeLines() + normal! mq + execute '/^}' + let l:end_brace = line('.') + execute '?^{' + let l:start_brace = line('.') + normal! k + let l:scope_len = l:end_brace - l:start_brace - 1 + let l:scope_name = substitute(getline('.'), '\t', ' ', 'g') + echom l:scope_len . ' lines in |' . l:scope_name . '|' + normal! `q +endfunction + +command! CountScopeLines call s:CountScopeLines() + +command! Norm execute '!norminette ' . expand("%") + +" disable paste on enter +" (need to be at the end or overwritted by something) +nnoremap j + +" copy/paste with system {{{ +vnoremap y:call system("pbcopy", getreg("\"")) +nnoremap :call setreg("\"",system("pbpaste"))p +" }}} diff --git a/.zprofile b/.zprofile index 16d3e16..6c37821 100755 --- a/.zprofile +++ b/.zprofile @@ -1,5 +1,23 @@ -if [[ "$(tty)" = "/dev/tty1" ]]; then - startx +# if [[ "$(tty)" = "/dev/tty1" ]]; then +# startx # xset r rate 200 40 - poweroff -fi +# poweroff +# fi + +# # Disable natural scrolling +# defaults write "Apple Global Domain" com.apple.swipescrolldirection -bool false +# +# # Enable dark theme +# osascript -e 'tell app "System Events" to tell appearance preferences to set dark mode to true' +# +# # Keyrepeat delay +# defaults write NSGlobalDomain InitialKeyRepeat -int 15 +# defaults write NSGlobalDomain KeyRepeat -int 2 +# +# # Change desktop picture +# # osascript -e "tell application \"Finder\" to set desktop picture to POSIX file \"/Users/$(whoami)/background.jpg\"" +# +# # Night shift +# defaults write com.apple.universalaccess lastNightShiftActive -int 1 +# defaults write com.apple.universalaccess lastNightShiftEnabled -int 1 +# defaults write com.apple.universalaccess lastNightShiftMode -int 0 diff --git a/.zsh_aliases b/.zsh_aliases index 758229b..0e32410 100644 --- a/.zsh_aliases +++ b/.zsh_aliases @@ -32,7 +32,7 @@ alias ta='tree -a' alias t1='tree -L 1' alias t2='tree -L 2' alias t3='tree -L 3' -alias ti="tree -I '*.pyc' -I '*.o'" +alias ti="tree --matchdirs -I '__pycache__' -I '*.o' -I '*.dSYM'" # man alias ma="man" @@ -102,7 +102,8 @@ alias ..='cd ..' alias ...='cd ../..' alias ....='cd ../../..' -alias norm='ruby -I/home/charles/git/norminette/vendor/bundle/ruby/2.7.0/gems/parseconfig-1.0.8/lib/ ~/git/norminette/norminette.rb' +# alias norm='ruby -I/home/charles/git/norminette/vendor/bundle/ruby/2.7.0/gems/parseconfig-1.0.8/lib/ ~/git/norminette/norminette.rb' +alias norm="norminette" getrfc() { curl "https://ietf.org/rfc/rfc$1.txt" > "$HOME/rfc/rfc$1.txt" @@ -139,11 +140,12 @@ pacman-url() { } grep-kill() { - ps aux | grep "$1" | tr -s ' ' | cut -d ' ' -f 2 | xargs kill + ps aux | grep "$1" | grep -v grep | tr -s ' ' | cut -d ' ' -f 2 | xargs kill -9 } -python-help() { - python3 -c "import $1; help($1)" -} +alias python='python3' +alias pydoc='pydoc3' alias filter-valgrind="sed -e 's/==[0-9]*==/==/' -e 's/0x[0-9A-F]*//'" + +alias ssh-add-me="ssh-add -K $HOME/.ssh/id_rsa" diff --git a/.zshrc b/.zshrc index 41cdcbd..ac4ab47 100644 --- a/.zshrc +++ b/.zshrc @@ -93,7 +93,7 @@ export BROWSER='chromium' export BROWSERCLI='w3m' # ignore filetypes in autocomplete -fignore=(o hi) +fignore=(o hi dSYM) # pluggins source $HOME/.zsh/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh # prompt syntax highlight @@ -114,4 +114,7 @@ export MINISHELL_TEST_BONUS=yes export MINISHELL_TEST_PAGER=vim export MINISHELL_TEST_FLAGS=-DMINISHELL_TEST -19fetch +# 19fetch + +# Added by c_formatter_42 +export PATH="$PATH:/Users/cacharle/git/c_formatter_42" -- cgit