commit 9a8e04f76ccdf66641163944f1429542f1847b27 Author: Edgaru089 Date: Thu Jun 5 13:35:52 2025 +0800 Initial commit diff --git a/_clang-format b/_clang-format new file mode 100644 index 0000000..b8c35ad --- /dev/null +++ b/_clang-format @@ -0,0 +1,66 @@ +--- +AccessModifierOffset: '-4' +AlignAfterOpenBracket: AlwaysBreak +AlignConsecutiveMacros: 'true' +AlignConsecutiveAssignments: 'true' +AlignConsecutiveDeclarations: 'true' +AlignEscapedNewlines: Left +AlignOperands: 'true' +AlignTrailingComments: 'true' +AllowAllArgumentsOnNextLine: 'true' +AllowAllConstructorInitializersOnNextLine: 'true' +AllowAllParametersOfDeclarationOnNextLine: 'true' +AllowShortBlocksOnASingleLine: 'true' +AllowShortCaseLabelsOnASingleLine: 'true' +AllowShortFunctionsOnASingleLine: 'true' +AllowShortIfStatementsOnASingleLine: Never +AllowShortLambdasOnASingleLine: All +AllowShortLoopsOnASingleLine: 'true' +AlwaysBreakAfterReturnType: None +AlwaysBreakBeforeMultilineStrings: 'false' +AlwaysBreakTemplateDeclarations: 'Yes' +BreakBeforeBinaryOperators: None +BreakBeforeBraces: Attach +BreakBeforeTernaryOperators: 'false' +BreakStringLiterals: 'true' +ColumnLimit: '0' +CompactNamespaces: 'false' +ConstructorInitializerAllOnOneLineOrOnePerLine: 'true' +FixNamespaceComments: 'true' +IncludeBlocks: Preserve +IndentCaseLabels: 'true' +IndentGotoLabels: 'false' +IndentPPDirectives: None +IndentWidth: '4' +IndentWrappedFunctionNames: 'true' +KeepEmptyLinesAtTheStartOfBlocks: 'false' +Language: Cpp +MaxEmptyLinesToKeep: '2' +NamespaceIndentation: None +PenaltyReturnTypeOnItsOwnLine: '1000' +PointerAlignment: Right +ReflowComments: 'true' +SortIncludes: 'false' +SortUsingDeclarations: 'false' +SpaceAfterCStyleCast: 'false' +SpaceAfterLogicalNot: 'false' +SpaceAfterTemplateKeyword: 'false' +SpaceBeforeAssignmentOperators: 'true' +SpaceBeforeCpp11BracedList: 'false' +SpaceBeforeCtorInitializerColon: 'false' +SpaceBeforeInheritanceColon: 'false' +SpaceBeforeParens: ControlStatements +SpaceBeforeRangeBasedForLoopColon: 'false' +SpaceInEmptyParentheses: 'false' +SpacesBeforeTrailingComments: '1' +SpacesInAngles: 'false' +SpacesInCStyleCastParentheses: 'false' +SpacesInContainerLiterals: 'false' +SpacesInParentheses: 'false' +SpacesInSquareBrackets: 'false' +Standard: Cpp11 +TabWidth: '4' +UseTab: ForContinuationAndIndentation + +ForEachMacros: [FOR, ROF, FCNT] +... diff --git a/coc-settings.json b/coc-settings.json new file mode 100644 index 0000000..77e84a8 --- /dev/null +++ b/coc-settings.json @@ -0,0 +1,35 @@ +{ + "coc.preferences.jumpCommand": "drop", + "list.normalMappings": { + "e": "action:drop" + }, + "go.goplsPath": "/home/edgar/.local/share/gopath/bin/gopls", + "go.goplsUseDaemon": true, + "go.goplsOptions": { + "semanticTokens": true + }, + "clangd.disableSnippetCompletion": false, + "rust-analyzer.server.path": "/usr/bin/rust-analyzer", + "rust-analyzer.diagnostics.warningsAsInfo": ["unused_imports"], + "semanticTokens.enable":true, + "java.configuration.runtimes": [ + { + "name": "JavaSE-17", + "path": "/usr/lib/jvm/java-17-openjdk/", + "default": true + } + ], + "texlab.chktex.onEdit": false, + "texlab.chktex.onOpenAndSave": false, + "texlab.latexFormatter": "none", + "typescript.format.enable": false, + "languageserver": { + "Dotnet": { + "command": "csharp-ls", + "filetypes": ["cs"], + "args": [], + "progressOnInitialization": true, + "revealOutputChannelOn": "warn" + } + } +} diff --git a/myrr.zsh-theme b/myrr.zsh-theme new file mode 100644 index 0000000..8338351 --- /dev/null +++ b/myrr.zsh-theme @@ -0,0 +1,8 @@ +local ret_status="%(?:%{$reset_color%}:%{$fg_bold[red]%})" +PROMPT='%{$fg_bold[green]%}%n@%m%{$reset_color%}:%{$fg_bold[cyan]%}%~$(git_prompt_info)${ret_status}$%{$reset_color%} ' + +ZSH_THEME_GIT_PROMPT_PREFIX=" %{$reset_color%}[%{$fg_bold[cyan]%}" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}] " +#ZSH_THEME_GIT_PROMPT_SUFFIX="%(?:%{$reset_color%}] :%{$reset_color%}])" +ZSH_THEME_GIT_PROMPT_DIRTY=" %{$fg_bold[yellow]%}DIRTY" +ZSH_THEME_GIT_PROMPT_CLEAN=" %{$fg_bold[green]%}CLEAN" diff --git a/oh.my.zshrc b/oh.my.zshrc new file mode 100644 index 0000000..7f0ab7e --- /dev/null +++ b/oh.my.zshrc @@ -0,0 +1,154 @@ +export SHELL=zsh + +# If you come from bash you might have to change your $PATH. +export PATH=$HOME/.dotnet/tools:$HOME/.local/share/gopath/bin:$HOME/.local/bin:$HOME/bin:/usr/local/bin:$PATH + +# Path to your oh-my-zsh installation. +export ZSH="/home/edgar/.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/robbyrussell/oh-my-zsh/wiki/Themes +ZSH_THEME="myrr" + +# 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 ~/.oh-my-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 the following line to disable bi-weekly auto-update checks. +DISABLE_AUTO_UPDATE="true" + +# Uncomment the following line to change how often to auto-update (in days). +export UPDATE_ZSH_DAYS=3 + +# 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. +# 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" +HIST_STAMPS="yyyy-mm-dd" + +# 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 ~/.oh-my-zsh/plugins/* +# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/ +# Example format: plugins=(rails git textmate ruby lighthouse) +# Add wisely, as too many plugins slow down shell startup. +plugins=( + git + autojump +) + +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" + +# ssh +# export SSH_KEY_PATH="~/.ssh/rsa_id" + +# 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" + +# Customized + +export EDITOR="vim" +bindkey -v + +alias cls='clear' +alias ll='ls -l' +alias la='ls -a' +alias javac="javac -J-Dfile.encoding=utf8" +alias grep="grep --color=auto" +alias rg="rg --no-heading" +alias mc='mkcpp' +alias mcv='mkcpp -V' +alias fasm='fasm -m 1677216' + +alias pacman='sudo pacman --color=auto' +alias yay='yay --color=auto' +alias sctl='sudo systemctl' + +alias gdbtui='gdb -q -tui' +alias gdb='gdb -q' + +alias -s c=vim +alias -s cpp=vim +alias -s h=vim +alias -s hpp=vim +alias -s go=vim +alias -s java=vim +alias -s txt=vim +alias -s gz='tar -xzvf' +alias -s tgz='tar -xzvf' +alias -s zip='unzip' +alias -s bz2='tar -xjvf' +alias -s xz='tar -xJvf' + + +bindkey '^[OA' history-beginning-search-backward +bindkey '^[[A' history-beginning-search-backward +bindkey '^[OB' history-beginning-search-forward +bindkey '^[[B' history-beginning-search-forward + +# autojump +[[ -s /home/edgar/.autojump/etc/profile.d/autojump.sh ]] && source /home/edgar/.autojump/etc/profile.d/autojump.sh +autoload -U compinit && compinit -u + +export LANG="zh_CN.UTF-8" +export LANGUAGE="zh_CN.UTF-8" + + +export RUSTUP_UPDATE_ROOT=https://mirrors6.tuna.tsinghua.edu.cn/rustup/rustup +export RUSTUP_DIST_SERVER=https://mirrors6.tuna.tsinghua.edu.cn/rustup diff --git a/vimrc b/vimrc new file mode 100644 index 0000000..05debba --- /dev/null +++ b/vimrc @@ -0,0 +1,344 @@ + +colorscheme vim +highlight Normal guifg=1 guibg=0 +syntax on +set bg=dark +set termguicolors + +set nocp +set ttyfast + +set guifont=ConsolasDengXianSemiBold\ 14 + +set backspace=2 +set showmatch +set ruler + +set mouse=a +set ts=4 +set sw=4 +set cindent +set cinoptions=:0,l1,g0 +set nohlsearch +set ignorecase +set smartcase + +set autochdir +set timeout timeoutlen=1000 ttimeoutlen=15 + +set title +set scroll=8 + +set guicursor=a:blinkon0-Cursor +let g:netrw_mousemaps=0 + +set nu +set signcolumn=no + +set updatetime=1000 + + + +"""""""""" Plugins """""""""" + +set nocp +filetype plugin on + +call plug#begin('~/.vim/plugged') +let g:plug_url_format='git@github.com:%s.git' + +Plug 'tpope/vim-repeat' +Plug 'Chiel92/vim-autoformat' +Plug 'tpope/vim-surround' +Plug 'elkowar/yuck.vim' +Plug 'neoclide/coc.nvim', {'branch': 'release'} +Plug 'vim-airline/vim-airline' + +call plug#end() + + + +"""""""""" Syntax highlighting overrides """""""""" + +highlight LineNr ctermfg=lightgrey guifg=#7f7f7f gui=NONE +"highlight PmenuSel ctermbg=242 ctermfg=white guibg=#6f6f6f guifg=#ffffff +highlight! Pmenu ctermbg=252 ctermfg=black guibg=#d7d7d7 guifg=#000000 gui=NONE +highlight! PmenuSel guibg=#d7d7d7 guifg=#000000 gui=NONE +highlight! Pmenu guibg=#7f002f guifg=#ffffff gui=NONE + +highlight Comment ctermfg=87 guifg=#00ffff gui=NONE + +highlight Constant ctermfg=213 guifg=#ffcfff gui=NONE +highlight String ctermfg=207 guifg=#ff5fff gui=NONE +highlight Character ctermfg=213 guifg=#ff9fff gui=NONE +highlight Number ctermfg=123 guifg=#87ffff gui=NONE +highlight! link Boolean Number + +highlight Identifier ctermfg=49 guifg=#cfffff gui=NONE +highlight Function ctermfg=49 guifg=#00ffaf + +highlight Statement ctermfg=227 guifg=#ffff8f gui=NONE +highlight! link Repeat Statement +highlight! link Label Statement +highlight! link Operator Statement +highlight! link Keyword Statement +highlight! link Exception Statement + +highlight Type ctermfg=121 guifg=#87ffaf gui=NONE +highlight! link StorageClass Type +highlight! link Structure Type +highlight! link Typedef Type + +highlight Special guifg=#ffd7d7 gui=NONE +highlight! link SpecialChar Special +highlight! link Tag Special +highlight! link Delimiter Special +highlight! link SpecialComment Special +highlight! link Debug Special + +highlight MatchParen guibg=#00ffff guifg=#000000 + +highlight Underlined guifg=#5fd7ff + +highlight TabLineFill cterm=None gui=None guibg=White guifg=Black +highlight TabLine cterm=None gui=None guibg=White guifg=Black +highlight TabLineSel cterm=None gui=None guibg=Black guifg=White + +highlight glslBuiltinFunction guifg=#ffc7c7 gui=NONE +highlight Cursor gui=NONE guibg=White guifg=Black + +highlight CocInlayHint guibg=#3f3f3f guifg=White gui=NONE +highlight Conceal guibg=#3f3f3f guifg=white gui=NONE + +highlight StatusLine cterm=NONE gui=NONE +highlight StatusLineNC cterm=NONE gui=NONE +highlight StatusLineTerm cterm=NONE gui=NONE +highlight StatusLineTermNC cterm=NONE gui=NONE + + + +"""""""""" Tabline """""""""" +" https://stackoverflow.com/a/20235008 +function MyTabLine() + let s = '' + for i in range(tabpagenr('$')) + " select the highlighting + if i + 1 == tabpagenr() + let s .= '%#TabLineSel#' + else + let s .= '%#TabLine#' + endif + " set the tab page number (for mouse clicks) + let s .= '%' . (i + 1) . 'T' + " the label is made by MyTabLabel() + let s .= ' %{MyTabLabel(' . (i + 1) . ')} ' + endfor + " after the last tab fill with TabLineFill and reset tab page nr + let s .= '%#TabLineFill#%T' + " right-align the label to close the current tab page + if tabpagenr('$') > 1 + let s .= '%=%#TabLine#%999XClose' + endif + return s +endfunction + +function MyTabLabel(n) + let buflist = tabpagebuflist(a:n) + let winnr = tabpagewinnr(a:n) + let name = bufname(buflist[winnr - 1]) + if name == "" + return "[未命名]" + else + let pathparts = split(name, '/') + if len(pathparts) == 1 + return name + else + "return pathparts[len(pathparts) - 2] . '/' . pathparts[len(pathparts) - 1] + return pathparts[len(pathparts) - 1] + endif + endif +endfunction + +"set tabline=%!MyTabLine() + + + + +"""""""""" Remaps """""""""" + +command W w +map Q ZZ + +func Semicolon() + let line = getline('.') + if match(line, "for") == -1 && match(line, "if") == -1 + return "\;" + else + return ';' + endif +endfunc + +au BufNewFile,BufRead *.frag,*.vert,*.geom,*.fp,*.vp,*.glsl setf glsl + +augroup vimrc_cmaps +autocmd FileType c,cpp,rust,typescript inoremap ; Semicolon() +autocmd FileType vim,c,cpp,go,rust,python,typescript,tex inoremap ( () +autocmd FileType vim,c,cpp,go,rust,python,typescript,tex inoremap [ [] +autocmd FileType vim,c,cpp,go,rust,python,typescript inoremap " "" +autocmd FileType vim,c,cpp,go,rust,python,typescript inoremap ' '' + +autocmd FileType c,cpp,go,rust,typescript inoremap { {} +autocmd FileType c,cpp,go,rust,typescript inoremap {} +autocmd FileType vim,tex,python inoremap { {} +autocmd FileType vim,tex,python inoremap {} + +autocmd Filetype go,rust,python,typescript map K CocAction("jumpDefinition") +autocmd FileType c,cpp map K CocAction("jumpDeclaration") +autocmd FileType c,cpp map CocAction("jumpDefinition") +augroup END + + + +let g:python3_host_prog="/usr/bin/python3" +autocmd BufWrite *.cpp,*.c,*.hpp,*.h,*.go,*.rs,*.py Autoformat +"autocmd BufWrite *.go Autoformat +let g:formatdef_autopep8_120ll = '"autopep8 --max-line-length 120 -"' +let g:formatters_python = ['autopep8_120ll'] + +autocmd TermOpen * startinsert + + +" Use to trigger completion. +if has('nvim') + inoremap coc#refresh() + inoremap coc#refresh() +else + inoremap coc#refresh() +endif + +" Press Meta-I to invoke hover +nmap :call CocAction('doHover') +"nmap CocAction('doHover') + +" Use tab for trigger completion / cycle snippet replaces. +inoremap + \ coc#pum#visible() ? coc#_select_confirm() : + \ coc#expandableOrJumpable() ? "\=coc#rpc#request('doKeymap', ['snippets-expand-jump',''])\" : + \ CheckBackSpace() ? "\" : + \ coc#refresh() + +function! CheckBackSpace() abort + let col = col('.') - 1 + return !col || getline('.')[col - 1] =~# '\s' +endfunction + +let g:coc_snippet_next = '' + +" Use `[g` and `]g` to navigate diagnostics +" Use `:CocDiagnostics` to get all diagnostics of current buffer in location list +nmap [g (coc-diagnostic-prev) +nmap ]g (coc-diagnostic-next) + +" GoTo code navigation +nmap gd :call CocAction("jumpDefinition", v:false) +nmap gy :call CocAction("jumpTypeDefinition", v:false) +nmap gi :call CocAction("jumpImplementation", v:false) +nmap gr :call CocAction("jumpUsed", v:false) +nmap gn :e . +nunmap gri +nunmap grr +nunmap gra +nunmap grn + +" Custom list invocation +"let g:coc_enable_locationlist = 0 +"autocmd User CocLocationsChange CocList --normal --auto-preview location + +" Use Meta-HJKL for Left/Down/Up/Right. +imap +imap +imap +imap + + + +"""""""""" Airline Colors """""""""" + +let g:go_highlight_trailing_whitespace_error = 0 +set showcmd +let g:airline_mode_map={'s': '选择', 'V': '可视 行', 'ni': '(插入)', 'ic': '补全', 'R': '替换', '': '选择 块', 'no': '等待', '': '可视 块', 'multi': '复合', '__': '------', 'Rv': '可视 替换', 'c': '命令', 'ix': '补全', 'i': '插入', 'n': '正常', 'S': '选择 行', 't': '终端', 'v': '可视'} + +let g:airline_section_z='共%L行 %4l行%3v列 %3p%%' + +let g:airline_symbols={'space': ' ', 'paste': '粘贴', 'maxlinenr': 'Ln', 'dirty': '!', 'crypt': '加密', 'linenr': 'Cln', 'readonly': '[只读]', 'spell': '拼写', 'modified': '*', 'notexists': '不存在', 'keymap': 'Keymap:', 'ellipsis': '...', 'branch': '分支', 'whitespace': '空格', 'executable': '+x'} + +let g:airline#extensions#whitespace#enabled = 0 +let g:airline#extensions#whitespace#trailing_format='[%s] 行尾冗余' +let g:airline#extensions#whitespace#mixed_indent_format='[%s] 缩进格式不一致' +let g:airline#extensions#whitespace#long_format='[%s] 行过长' +let g:airline#extensions#whitespace#mixed_indent_file_format='[%s] 缩进格式不一致' +let g:airline#extensions#whitespace#conflicts_format='[%s] 格式冲突' + +" Just disable it. Not working in CJK environment. +let g:airline#extensions#wordcount#enabled = 0 +let g:airline#extensions#wordcount#formatter#default#fmt='%s 单词' +let g:airline#extensions#wordcount#formatter#default#fmt_short='%s词:' + +let g:airline_filetype_overrides = { + \ 'defx': ['defx', '%{b:defx.paths[0]}'], + \ 'gundo': [ 'Gundo', '' ], + \ 'help': [ '帮助', '%f' ], + \ 'minibufexpl': [ 'MiniBufExplorer', '' ], + \ 'nerdtree': [ get(g:, 'NERDTreeStatusline', 'NERD'), '' ], + \ 'startify': [ 'startify', '' ], + \ 'vim-plug': [ '插件', '' ], + \ 'vimfiler': [ 'vimfiler', '%{vimfiler#get_status_string()}' ], + \ 'vimshell': ['vimshell','%{vimshell#get_status_string()}'], + \ } + + +"source ~/.vim/plugged/vim-airline/autoload/airline/themes/dark-ext.vim +let g:airline#themes#dark#palette.normal_modified = g:airline#themes#dark#palette.normal +let g:airline#themes#dark#palette.insert_modified = g:airline#themes#dark#palette.insert +let g:airline#themes#dark#palette.replace_modified = g:airline#themes#dark#palette.insert_modified +let g:airline#themes#dark#palette.visual_modified = g:airline#themes#dark#palette.visual +" +" For commandline mode, we use the colors from normal mode, except the mode +" indicator should be colored differently, e.g. light green +let s:airline_a_commandline = [ '#00005f' , '#0cff00' , 17 , 40 ] +let s:airline_b_commandline = [ '#ffffff' , '#444444' , 255 , 238 ] +let s:airline_c_commandline = [ '#9cffd3' , '#202020' , 85 , 234 ] +let g:airline#themes#dark#palette.commandline = airline#themes#generate_color_map(s:airline_a_commandline, s:airline_b_commandline, s:airline_c_commandline) + + + +"""""""""" Misc """""""""" + +set tags+=~/.cache/ctags + +lang zh_CN.UTF-8 + +" Uncomment the following to have Vim jump to the last position when +" reopening a file +au BufReadPost * exe "normal! g'\"" + +set noshowmode + + + +set termguicolors +set t_8f=[38:2::%lu:%lu:%lum +set t_8b=[48:2::%lu:%lu:%lum + + +command -nargs=* C !g++ %:p +command -nargs=* CR rightb 15split +term\ g++\ \ %:p\ &&\ ./a.out +command R rightb 15split +term\ ./a.out + +function MyCDB(file) + tabe '+term g++ -g '. file .' && gdbtui ./a.out' +endfunction + +command CDB call MyCDB( %:p ) + +