From: Xinqi Bao Date: Wed, 20 May 2020 01:18:55 +0000 (-0400) Subject: cleaned up .vimrc X-Git-Url: https://git.xinqibao.xyz/dotfiles.git/commitdiff_plain/875c81c3638e1b2218d8b3b6fbd5494cbe5b1a5f cleaned up .vimrc --- diff --git a/.bashrc b/.bashrc new file mode 100644 index 0000000..d837918 --- /dev/null +++ b/.bashrc @@ -0,0 +1,14 @@ +# +# ~/.bashrc +# + +# If not running interactively, don't do anything +[[ $- != *i* ]] && return + +alias ls='ls --color=auto' + +export PS1="[\[\e[36;1m\]\u@\h \[\e[32;1m\]\w\[\e[m\]]\[\e[33m\](\$(git branch 2>/dev/null | grep '^*' | colrm 1 2))\n\[\e[m\]~~~>\$ " + +export EDITOR=vim + +export TERM=xterm-256color diff --git a/.clang-format b/.clang-format new file mode 100644 index 0000000..94d2231 --- /dev/null +++ b/.clang-format @@ -0,0 +1,157 @@ +--- +Language: Cpp +# BasedOnStyle: Google +AccessModifierOffset: -4 +AlignAfterOpenBracket: Align +AlignConsecutiveMacros: false +AlignConsecutiveAssignments: true +AlignConsecutiveDeclarations: false +AlignEscapedNewlines: Left +AlignOperands: true +AlignTrailingComments: true +AllowAllArgumentsOnNextLine: true +AllowAllConstructorInitializersOnNextLine: true +AllowAllParametersOfDeclarationOnNextLine: true +AllowShortBlocksOnASingleLine: false +AllowShortCaseLabelsOnASingleLine: false +AllowShortFunctionsOnASingleLine: All +AllowShortLambdasOnASingleLine: All +AllowShortIfStatementsOnASingleLine: WithoutElse +AllowShortLoopsOnASingleLine: true +AlwaysBreakAfterDefinitionReturnType: None +AlwaysBreakAfterReturnType: None +AlwaysBreakBeforeMultilineStrings: true +AlwaysBreakTemplateDeclarations: Yes +BinPackArguments: true +BinPackParameters: true +BraceWrapping: + AfterCaseLabel: false + AfterClass: false + AfterControlStatement: false + AfterEnum: false + AfterFunction: false + AfterNamespace: false + AfterObjCDeclaration: false + AfterStruct: false + AfterUnion: false + AfterExternBlock: false + BeforeCatch: false + BeforeElse: false + IndentBraces: false + SplitEmptyFunction: true + SplitEmptyRecord: true + SplitEmptyNamespace: true +BreakBeforeBinaryOperators: None +BreakBeforeBraces: Allman +BreakBeforeInheritanceComma: false +BreakInheritanceList: BeforeColon +BreakBeforeTernaryOperators: true +BreakConstructorInitializersBeforeComma: false +BreakConstructorInitializers: BeforeColon +BreakAfterJavaFieldAnnotations: false +BreakStringLiterals: true +ColumnLimit: 80 +CommentPragmas: '^ IWYU pragma:' +CompactNamespaces: false +ConstructorInitializerAllOnOneLineOrOnePerLine: true +ConstructorInitializerIndentWidth: 4 +ContinuationIndentWidth: 4 +Cpp11BracedListStyle: true +DerivePointerAlignment: true +DisableFormat: false +ExperimentalAutoDetectBinPacking: false +FixNamespaceComments: true +ForEachMacros: + - foreach + - Q_FOREACH + - BOOST_FOREACH +IncludeBlocks: Regroup +IncludeCategories: + - Regex: '^' + Priority: 2 + - Regex: '^<.*\.h>' + Priority: 1 + - Regex: '^<.*' + Priority: 2 + - Regex: '.*' + Priority: 3 +IncludeIsMainRegex: '([-_](test|unittest))?$' +IndentCaseLabels: false +IndentPPDirectives: None +IndentWidth: 4 +IndentWrappedFunctionNames: false +JavaScriptQuotes: Leave +JavaScriptWrapImports: true +KeepEmptyLinesAtTheStartOfBlocks: false +MacroBlockBegin: '' +MacroBlockEnd: '' +MaxEmptyLinesToKeep: 1 +NamespaceIndentation: None +ObjCBinPackProtocolList: Never +ObjCBlockIndentWidth: 2 +ObjCSpaceAfterProperty: false +ObjCSpaceBeforeProtocolList: true +PenaltyBreakAssignment: 2 +PenaltyBreakBeforeFirstCallParameter: 1 +PenaltyBreakComment: 300 +PenaltyBreakFirstLessLess: 120 +PenaltyBreakString: 1000 +PenaltyBreakTemplateDeclaration: 10 +PenaltyExcessCharacter: 1000000 +PenaltyReturnTypeOnItsOwnLine: 200 +PointerAlignment: Left +RawStringFormats: + - Language: Cpp + Delimiters: + - cc + - CC + - cpp + - Cpp + - CPP + - 'c++' + - 'C++' + CanonicalDelimiter: '' + BasedOnStyle: google + - Language: TextProto + Delimiters: + - pb + - PB + - proto + - PROTO + EnclosingFunctions: + - EqualsProto + - EquivToProto + - PARSE_PARTIAL_TEXT_PROTO + - PARSE_TEST_PROTO + - PARSE_TEXT_PROTO + - ParseTextOrDie + - ParseTextProtoOrDie + CanonicalDelimiter: '' + BasedOnStyle: google +ReflowComments: true +SortIncludes: true +SortUsingDeclarations: true +SpaceAfterCStyleCast: false +SpaceAfterLogicalNot: false +SpaceAfterTemplateKeyword: true +SpaceBeforeAssignmentOperators: true +SpaceBeforeCpp11BracedList: false +SpaceBeforeCtorInitializerColon: true +SpaceBeforeInheritanceColon: true +SpaceBeforeParens: ControlStatements +SpaceBeforeRangeBasedForLoopColon: true +SpaceInEmptyParentheses: false +SpacesBeforeTrailingComments: 2 +SpacesInAngles: false +SpacesInContainerLiterals: true +SpacesInCStyleCastParentheses: false +SpacesInParentheses: false +SpacesInSquareBrackets: false +Standard: Auto +StatementMacros: + - Q_UNUSED + - QT_REQUIRE_VERSION +TabWidth: 8 +UseTab: Never +... + diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6e92f57 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +tags diff --git a/.tmux.conf b/.tmux.conf new file mode 100644 index 0000000..a5aff0c --- /dev/null +++ b/.tmux.conf @@ -0,0 +1,93 @@ +# Improve colours +set -g default-terminal 'xterm-256colour' + +# Set scrollback buffer to 10000 +set -g history-limit 10000 + +# remap prefix from 'C-b' to 'C-z' +unbind C-b +set-option -g prefix C-a +bind-key C-a send-prefix + +# split panes using | and - +bind | split-window -h +bind - split-window -v +bind-key C-a last-window +unbind '"' +unbind % + +## Status bar design +# status line +set -g status-justify left +set -g status-interval 2 + +# loud or quiet? +set-option -g visual-activity off +set-option -g visual-bell off +set-option -g visual-silence off +set-window-option -g monitor-activity off +set-option -g bell-action none + +set -g default-terminal "screen-256colour" + + +# The modes { +setw -g clock-mode-colour colour135 +setw -g mode-style fg=colour196,bg=colour238,bold +# } + + +# The panes { +set -g pane-border-style fg=colour238,bg=colour235 +set -g pane-active-border-style fg=colour51,bg=colour236 +# } + + +# The statusbar { +set -g status-position bottom +set -g status-style fg=colour137,bg=colour234,dim + +set -g status-left '' +set -g status-left-length 20 + +set -g status-right '#[fg=colour233,bg=colour245,bold] %H:%M #[fg=colour233,bg=colour253,bold] %m-%d ' +set -g status-right-length 50 + +setw -g window-status-current-style fg=colour69,bg=colour253,bold +setw -g window-status-current-format ' #I#[fg=colour250]:#[fg=colour233]#W#[fg=colour69]#F ' + +setw -g window-status-style fg=colour131,bg=colour245,none +setw -g window-status-format ' #I#[fg=colour237]:#[fg=colour233]#W#[fg=colour131]#F ' + +setw -g window-status-bell-style fg=colour255,bg=colour1,bold +# } + + +# The messages { +set -g message-style fg=colour232,bg=colour166,bold +set -g message-command-style fg=blue,bg=black +# } + +# Smart pane switching with awareness of Vim splits. +# See: https://github.com/christoomey/vim-tmux-navigator{ +is_vim="ps -o state= -o comm= -t '#{pane_tty}' \ + | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'" +bind-key -n 'C-h' if-shell "$is_vim" 'send-keys C-h' 'select-pane -L' +bind-key -n 'C-j' if-shell "$is_vim" 'send-keys C-j' 'select-pane -D' +bind-key -n 'C-k' if-shell "$is_vim" 'send-keys C-k' 'select-pane -U' +bind-key -n 'C-l' if-shell "$is_vim" 'send-keys C-l' 'select-pane -R' +tmux_version='$(tmux -V | sed -En "s/^tmux ([0-9]+(.[0-9]+)?).*/\1/p")' +if-shell -b '[ "$(echo "$tmux_version < 3.0" | bc)" = 1 ]' \ + "bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\' 'select-pane -l'" +if-shell -b '[ "$(echo "$tmux_version >= 3.0" | bc)" = 1 ]' \ + "bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\\\' 'select-pane -l'" + +bind-key -T copy-mode-vi 'C-h' select-pane -L +bind-key -T copy-mode-vi 'C-j' select-pane -D +bind-key -T copy-mode-vi 'C-k' select-pane -U +bind-key -T copy-mode-vi 'C-l' select-pane -R +bind-key -T copy-mode-vi 'C-\' select-pane -l +# } + +#enable powerline for tmux +#source /usr/lib/python3.8/site-packages/powerline/bindings/tmux/powerline.conf diff --git a/.vimrc b/.vimrc new file mode 100644 index 0000000..6ea0fdc --- /dev/null +++ b/.vimrc @@ -0,0 +1,92 @@ +syntax enable +"colorscheme wombat256mod +set background=dark + +set t_Co=256 "terminal color +set encoding=utf-8 "required for ycm +set noerrorbells +set tabstop=4 softtabstop=4 +set shiftwidth=4 +set expandtab +set smartindent +set number +set nowrap +set smartcase +set incsearch +set hlsearch +set ignorecase +set cursorline +set autochdir +set mouse=a +set laststatus=2 "always show status line +set wildmenu + +" Turn backup off +set noswapfile +set nobackup +set nowritebackup +set undodir=~/.vim/undodir +set undofile + +"ColumnLimit +set colorcolumn=80 +highlight ColorColumn ctermbg=0 guibg=lightgrey + +set tags=tags~;,tags~ +"setting gf (go file) path +set path+=/usr/include/c++/*,include;,includes;,lib; + + +call plug#begin() + +Plug 'morhetz/gruvbox' +Plug 'ycm-core/YouCompleteMe' +Plug 'kien/ctrlp.vim' +Plug 'mbbill/undotree' + +Plug 'scrooloose/nerdtree' +Plug 'rhysd/vim-clang-format' +Plug 'ludovicchabant/vim-gutentags' +Plug 'plasticboy/vim-markdown' +Plug 'christoomey/vim-tmux-navigator' + +call plug#end() + +colorscheme gruvbox + +"let g:netrw_banner = 0 +"let g:netrw_liststyle = 3 +"let g:netrw_browse_split = 4 +"let g:netrw_winsize = 25 + +let g:ctrlp_user_command = ['.git/', 'git --git-dir=%s/.git ls-files -oc --exclude-standard'] +let g:ctrlp_use_caching = 0 + +let g:ycm_global_ycm_extra_conf = '~/.vim/.ycm_extra_conf.py' +let g:ycm_enable_diagnostic_signs = 0 +let g:ycm_always_populate_location_list = 1 + +let mapleader = " " +nnoremap h +nnoremap j +nnoremap k +nnoremap l +nnoremap " viwa"bi"lel +nnoremap ' viwa'bi'lel +nnoremap u :UndotreeShow +"nnoremap pv :wincmd v :Ex :vertical resize 30 +nnoremap + :vertical resize +5 +nnoremap - :vertical resize -5 + +nnoremap gd :YcmCompleter GoTo +nnoremap gr :YcmCompleter GoToReferences + +"HighLight trailing whitespace" +highlight ExtraWhitespace ctermbg=red guibg=red +match ExtraWhitespace /\s\+$/ + +"use powerline-vim for normal use +"instead of installing for both user and root +python3 from powerline.vim import setup as powerline_setup +python3 powerline_setup() +python3 del powerline_setup diff --git a/.ycm_extra_conf.py b/.ycm_extra_conf.py new file mode 100644 index 0000000..23015c7 --- /dev/null +++ b/.ycm_extra_conf.py @@ -0,0 +1,2 @@ +def Settings(**kwargs): + return {'flags': ['-I.', '-Ilib', '-Iinclude', '-Iincludes']}