├── .gdbinit ├── .vimrc ├── LICENSE ├── README.md └── install.sh /.gdbinit: -------------------------------------------------------------------------------- 1 | source ~/.pwndbg/gdbinit.py 2 | source ~/.splitmind/gdbinit.py 3 | 4 | set context-clear-screen off 5 | set debug-events off 6 | 7 | python 8 | 9 | sections = "regs" 10 | 11 | mode = input("source/disasm/mixed mode:?(s/d/m)") or "d" 12 | 13 | import splitmind 14 | 15 | spliter = splitmind.Mind() 16 | 17 | spliter.select("main").right(display="regs", size="50%") 18 | 19 | # 全局的变量设置 20 | gdb.execute("set context-stack-lines 10") 21 | 22 | legend_on = "code" 23 | if mode == "d": 24 | legend_on = "disasm" 25 | sections += " disasm" 26 | spliter.select("main").above(display="disasm", size="70%", banner="none") 27 | gdb.execute("set context-code-lines 30") 28 | 29 | elif mode == "s": 30 | sections += " code" 31 | spliter.select("main").above(display="code", size="70%", banner="none") 32 | gdb.execute("set context-source-code-lines 30") 33 | 34 | else: 35 | sections += " disasm code" 36 | spliter.select("main").above(display="code", size="70%") 37 | spliter.select("code").below(display="disasm", size="40%") 38 | gdb.execute("set context-code-lines 8") 39 | gdb.execute("set context-source-code-lines 20") 40 | 41 | 42 | sections += " args stack backtrace expressions" 43 | 44 | spliter.show("legend", on=legend_on) 45 | spliter.show("stack", on="regs") 46 | spliter.show("backtrace", on="regs") 47 | spliter.show("args", on="regs") 48 | spliter.show("expressions", on="args") 49 | 50 | gdb.execute("set context-sections \"%s\"" % sections) 51 | gdb.execute("set show-retaddr-reg on") 52 | 53 | spliter.build() 54 | 55 | end 56 | -------------------------------------------------------------------------------- /.vimrc: -------------------------------------------------------------------------------- 1 | call plug#begin() 2 | " The default plugin directory will be as follows: 3 | " - Vim (Linux/macOS): '~/.vim/plugged' 4 | " - Vim (Windows): '~/vimfiles/plugged' 5 | " - Neovim (Linux/macOS/Windows): stdpath('data') . '/plugged' 6 | " You can specify a custom plugin directory by passing it as the argument 7 | " - e.g. `call plug#begin('~/.vim/plugged')` 8 | " - Avoid using standard Vim directory names like 'plugin' 9 | 10 | " Make sure you use single quotes 11 | 12 | " Initialize plugin system 13 | " - Automatically executes `filetype plugin indent on` and `syntax enable`. 14 | 15 | Plug 'vim-airline/vim-airline' 16 | Plug 'preservim/nerdtree' 17 | Plug 'ryanoasis/vim-devicons' 18 | Plug 'ycm-core/YouCompleteMe' 19 | Plug 'w0rp/ale' 20 | Plug 'majutsushi/tagbar' 21 | Plug 'altercation/vim-colors-solarized' 22 | Plug 'ojroques/vim-oscyank', {'branch': 'main'} 23 | 24 | " vim-oscyank 25 | vnoremap c :OSCYank 26 | 27 | 28 | " solarized 29 | let g:solarized_termcolors=256 30 | syntax enable 31 | set background=dark 32 | colorscheme solarized 33 | 34 | 35 | " tagbar 36 | let g:tagbar_autoshowtag = 1 37 | map :TagbarToggle 38 | 39 | 40 | " NERDTree 41 | " Start NERDTree and put the cursor back in the other window. 42 | autocmd VimEnter * NERDTree | wincmd p 43 | 44 | autocmd BufEnter * if tabpagenr('$') == 1 && winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() | quit | endif 45 | 46 | 47 | " Open the existing NERDTree on each new tab. 48 | autocmd BufWinEnter * if &buftype != 'quickfix' && getcmdwintype() == '' | silent NERDTreeMirror | endif 49 | " Open the existing NERDTree on each new tab. 50 | " autocmd BufWinEnter * if getcmdwintype() == '' | silent NERDTreeMirror |endif 51 | " nnoremap :NERDTreeMirror:NERDTreeFocus 52 | nnoremap n :NERDTreeFocus 53 | nnoremap :NERDTree 54 | nnoremap :NERDTreeToggle 55 | nnoremap :NERDTreeFind 56 | "let NERDTreeCustomOpenArgs = {'file':{'where': 't', 'keepopen': '1'}} 57 | let NERDTreeCustomOpenArgs={'file': {'reuse': 'all', 'where': 't', 'keepopen': '1'}, 'dir': {}} 58 | 59 | " YCM 60 | nnoremap gd :YcmCompleter GoToDefinition 61 | nnoremap gD :YcmCompleter GoToDeclaration 62 | nnoremap gr :YcmCompleter GoToReferences 63 | nnoremap jf :YcmCompleter GoToCallers 64 | nnoremap js :YcmCompleter GoToCallees 65 | nnoremap gh (YCMHover) 66 | let g:ycm_collect_identifiers_from_tags_files = 1 67 | " 不使用语法检测 68 | let g:ycm_show_diagnostics_ui = 0 69 | " 从注释、字符串、tag文件中收集 70 | let g:ycm_collect_identifiers_from_comments_and_strings = 1 71 | let g:ycm_collect_identifiers_from_tags_files = 1 72 | let g:ycm_auto_hover = "" 73 | let g:ycm_autoclose_preview_window_after_completion = 1 74 | let g:ycm_max_num_candidates = 15 75 | let g:ycm_seed_identifiers_with_syntax = 1 76 | 77 | " ale 78 | let g:ale_sign_column_always = 1 79 | nmap (ale_previous_wrap) 80 | nmap (ale_next_wrap) 81 | " Write this in your vimrc file 82 | let g:ale_lint_on_text_changed = 'never' 83 | let g:ale_lint_on_insert_leave = 0 84 | " You can disable this option too 85 | " if you don't want linters to run on opening a file 86 | let g:ale_lint_on_enter = 1 87 | " 使用quickfix,禁用loclist 88 | let g:ale_set_loclist = 0 89 | let g:ale_set_quickfix = 1 90 | " Set this. Airline will handle the rest. 91 | let g:airline#extensions#ale#enabled = 1 92 | " 始终显示标志栏 93 | let g:ale_sign_column_always = 1 94 | let g:ale_open_list = 0 95 | " Set this if you want to. 96 | " This can be useful if you are combining ALE with 97 | " some other plugin which sets quickfix errors, etc. 98 | let g:ale_keep_list_window_open = 0 99 | "关闭ALE的补全 100 | let g:ale_completion_enabled = 0 101 | let g:ale_hover_cursor = 0 102 | let g:ale_virtualtext_cursor = 1 103 | 104 | call plug#end() 105 | " You can revert the settings after the call like so: 106 | " filetype indent off " Disable file-type-specific indentation 107 | " syntax off " Disable syntax highlighting 108 | 109 | set encoding=UTF-8 110 | set ts=4 111 | set softtabstop=4 112 | set expandtab 113 | set shiftwidth=4 114 | 115 | set nu 116 | set backspace=2 117 | if has("autocmd") 118 | au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif 119 | endif 120 | set updatetime=500 121 | 122 | set splitbelow 123 | 124 | set previewheight=15 125 | 126 | au BufEnter ?* call PreviewHeightWorkAround() 127 | 128 | function! PreviewHeightWorkAround() 129 | if &previewwindow 130 | exec 'setlocal winheight='.&previewheight 131 | endif 132 | endfunc 133 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 OneShell 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # OwnConfigs 2 | some useful configs 3 | - `.vimrc`: vim config, c/c++/python simply use supported 4 | - `.gdbinit`: gdb config, source/disasm/mixed modes supported 5 | -------------------------------------------------------------------------------- /install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # define colors 4 | RED='\033[0;31m' 5 | GREEN='\033[0;32m' 6 | YELLOW='\033[1;33m' 7 | NC='\033[0m' 8 | 9 | ESSENTIAL_PACKAGES="build-essential tmux git vim curl wget zsh gdb gdb-multiarch python3 python3-pip python3-dev net-tools openssh-server" 10 | 11 | print_message() { 12 | local indent=$1 13 | local type=$2 14 | local message=$3 15 | local spaces=$(printf '%*s' $indent) 16 | case $type in 17 | "info") 18 | echo -e "${spaces}${YELLOW}[*] ${message}${NC}" 19 | ;; 20 | "success") 21 | echo -e "${spaces}${GREEN}[+] ${message}${NC}" 22 | ;; 23 | "error") 24 | echo -e "${spaces}${RED}[!] ${message}${NC}" 25 | ;; 26 | *) 27 | echo -e "${spaces}${message}" 28 | ;; 29 | esac 30 | } 31 | 32 | 33 | # update source list and install essential packages 34 | print_message 0 "info" "Updating source list and installing essential packages" 35 | sudo apt-get update -y 36 | sudo apt-get install -y ${ESSENTIAL_PACKAGES} 37 | 38 | CURRENT_DIR=$(pwd) 39 | 40 | # install and config oh-my-zsh 41 | 42 | print_message 0 "info" "Installing oh-my-zsh" 43 | echo "Y" | sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" 44 | sed -i 's/^ZSH_THEME="robbyrussell"/ZSH_THEME="ys"/' $HOME/.zshrc 45 | sed -i '/^PROMPT=/{N;s/\n//}' $HOME/.oh-my-zsh/themes/ys.zsh-theme 46 | source $HOME/.zshrc 47 | 48 | # install and config vim 49 | install_vim() { 50 | print_message 0 "info" "Installing vim" 51 | curl -fLo ~/.vim/autoload/plug.vim --create-dirs \ 52 | https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim 53 | git clone https://github.com/altercation/vim-colors-solarized.git $HOME/.vim/plugged/vim-colors-solarized 54 | cp $CURRENT_DIR/.vimrc $HOME/.vimrc 55 | mkdir -p $HOME/.vim/colors 56 | cp $HOME/.vim/plugged/vim-colors-solarized/colors/solarized.vim $HOME/.vim/colors/ 57 | vim +PlugInstall +qall 58 | $HOME/.vim/plugged/YouCompleteMe/install.sh 59 | } 60 | # install and config tmux 61 | install_tmux() { 62 | print_message 0 "info" "Installing tmux" 63 | git clone https://github.com/gpakosz/.tmux.git $HOME/.tmux 64 | ln -s -f $HOME/.tmux/.tmux.conf $HOME/.tmux.conf 65 | cp $HOME/.tmux/.tmux.conf.local $HOME/ 66 | sed -i '/set -g prefix2 C-a/s/^/#/' $HOME/.tmux/.tmux.conf 67 | sed -i '/bind C-a send-prefix -2/s/^/#/' $HOME/.tmux/.tmux.conf 68 | } 69 | # install and config gdb 70 | install_gdb(){ 71 | print_message 0 "info" "Installing gdb" 72 | git clone https://github.com/pwndbg/pwndbg.git $HOME/.pwndbg 73 | cd $HOME/.pwndbg && ./setup.sh && cd $CURRENT_DIR 74 | git clone https://github.com/jerdna-regeiz/splitmind.git $HOME/.splitmind 75 | cp $CURRENT_DIR/.gdbinit $HOME/.gdbinit 76 | } 77 | 78 | install_vim 79 | install_tmux 80 | install_gdb 81 | --------------------------------------------------------------------------------