From 8c4a6f932b129df4f9a63b7b2e2bcaea6f215866 Mon Sep 17 00:00:00 2001 From: Ibrahim Mkusa Date: Sun, 28 Jul 2024 23:05:45 -0400 Subject: Took snapshot of my main dotfiles --- vim/.vimrc | 241 ++++++++++++++++++++++++++++++++++++++++++++ vim/.vimrc.plug | 68 +++++++++++++ vim/.vimrc.plugins.settings | 160 +++++++++++++++++++++++++++++ vim/.ycm_extra_conf.py | 220 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 689 insertions(+) create mode 100644 vim/.vimrc create mode 100644 vim/.vimrc.plug create mode 100644 vim/.vimrc.plugins.settings create mode 100644 vim/.ycm_extra_conf.py (limited to 'vim') diff --git a/vim/.vimrc b/vim/.vimrc new file mode 100644 index 0000000..670b1e8 --- /dev/null +++ b/vim/.vimrc @@ -0,0 +1,241 @@ +" Vi improved, gotta be first +set nocompatible +" enable filetype extension +filetype on +filetype plugin on +filetype indent on " auto file type based indentation +syntax enable +" Settings +set noerrorbells " No beeps +set number " Show line numbers +" indent allow backspacing over autoident +" eol allow backspacing over line breaks (join lines) +" start allow backspacing over the start of insert; CTRL-W and CTRL-U stop once +" at the start of insert +set backspace=indent,eol,start " Makes backspace key more powerful. +set showcmd " Show me what I'm typing +set showmode " Show current mode. +set noswapfile " Don't use swapfile +set nobackup " Don't create annoying backup files +set nowritebackup " Don't waste disk io writing backup files +set splitright " Split vertical windows right to the current windows +set splitbelow " Split horizontal windows below to the current windows +set encoding=utf-8 " Set default encoding to UTF-8 +if has('unix') + set t_Co=256 " use 256 colors in vim +endif +set autowrite " Automatically save before :next, :make etc. +set autoread " Automatically reread changed files without asking me anything +set laststatus=2 +set hidden +set ruler " Show the cursor position all the time +au FocusLost * :wa " Set vim to save the file on focus out. +set fileformats=unix,dos,mac " Prefer Unix over Windows over OS 9 formats +set showmatch " Show matching brackets by flickering +set noshowmode " We show the mode with airline or lightline +set incsearch " Shows the match while typing +set hlsearch " Highlight found searches +set ignorecase " Search case insensitive... +set smartcase " ... but not when search pattern contains upper case characters +set clipboard=unnamedplus " use 'global register for copy' + + "speed up vim +" set ttyfast " indicates a fast terminal connection. More chars sent to screen + " for redrawing +" set ttyscroll=3 " Maximum no. of lines to scroll the screen. If more screen is + " is redrawn. In a terminal where scrolling is slow but + " redraw is fast a small number like 3 speeds up displaying +set lazyredraw " does not redraw the screen on nontyped commands +set updatetime=250 " git gutter faster updates + +set cursorline + + +" speed up syntax highlighting on slow computer +" set nocursorcolumn " Don't highlight the screen column of the cursor +" set nocursorline " Don't highlight the screen line of the cursor + +" syntax sync minlines=256 +" set synmaxcol=300 +" set re=1 + +" open help vertically +" command! -nargs=* -complete=help Help vertical belowright help +" autocmd FileType help wincmd L + +" automatic automcomplete for html files +" autocmd FileType html set omnifunc=htmlcomplete#CompleteTags + +" Make Vim to handle long lines nicely. +set wrap " wrap wrong lines that extend beyond visible screen +set textwidth=79 " was 79 +set formatoptions=qn1 " :h fo-table for details add r for auto insert comment leader +set colorcolumn=80 " was 80 +"set relativenumber +"set norelativenumber + +" mail line wrapping +au BufRead /tmp/mutt-* set tw=72 + +set autoindent " copy indent from current when starting a new line. Typing + " in insert mode or 'o' 'O' in normal triggers it + +" set complete-=i +set smarttab " insert blanks according to shiftwidth, tabstop, softtab, BS will + " delete shiftwidth + +" default tab settings based on google style guide +"set tabstop=8 " 8 spaces for a tab +set shiftwidth=8 " 8 spaces for identation +set expandtab " insert space characters whenever tab is pressed +set softtabstop=8 " number of spaces that a counts for while performing + " editing operations like inserting a or using + +" Shortcut to rapidly toggle `set list` +" nmap m :set list! +" set listchars=tab:▸\ ,eol:¬,trail:· " show tabs, eols and trailing spaces + + +" Unrecogised extensions fix +au BufRead,BufNewFile *.rockspec set filetype=lua +au BufRead,BufNewFile *.md set filetype=markdown +au Bufread,BufNewFile *.org.txt set filetype=org + +" Ask to clean all trailing white-spaces upon saving +" autocmd BufWritePre * :%s/\s\+$//ec + +" Use specific spacing for different formats +" expandtab, et: -> spaces +" tabstop, ts: length of a +" shiftwidth, sw: spaces for autoindent +" softtabstop, sts: how many spaces a inserts or removes +au FileType verilog,matlab setl et ts=4 sw=4 sts=4 +au FileType lua setl et ts=3 sw=3 sts=2 +au FileType c,cuda,tex,bib setl et ts=4 sw=2 sts=2 +au FileType make set noexpandtab shiftwidth=8 softtabstop=0 + +" >>> ended here refactoring +set nrformats-=octal +set shiftround + +" Time out on key codes but not mappings. +" Basically this makes terminal Vim work sanely. +set notimeout +set ttimeout +set ttimeoutlen=10 + +" Better Completion +set complete=.,w,b,u,t,i +set completeopt=longest,menuone + +let mapleader=" " " set map leader key to comma + +" configure wildmenu tab completion +set wildmode=list:longest,full +set wildignorecase + +" turn off search highlight +nnoremap :nohlsearch + +" folding support +set foldenable " enable folding +set foldlevelstart=10 " open most folds by default +set foldnestmax=10 " 10 nested fold max +" space open/closes folds +nnoremap za +set foldmethod=indent " fold based on indent level + +" move vertically by visual line not ignoring wrapped lines +nnoremap j gj +nnoremap k gk + +" save session +nnoremap s :mksession + +" open ag.vim +nnoremap a :Ack + + + +" number of commands that are remembered +if &history < 1000 + set history=50 +endif + +" set maximum number of tabs +if &tabpagemax < 50 + set tabpagemax=50 +endif + +" create viminfo on exit to resume where you left off +if !empty(&viminfo) + set viminfo^=! +endif + +" number of lines visible above the cursor +if !&scrolloff + set scrolloff=1 +endif + +" minimum number of screen columns to keep to the right and left of the cursor +if !&sidescrolloff + set sidescrolloff=5 +endif + +" last line that doesn't fit on window will be displayed as much as possible +set display+=lastline + +" gvim specific settings +set guioptions-=m "menu bar +set guioptions-=T "toolbar +set guioptions-=r "scrollbar + +" Center the screen +nnoremap zz + +" C-d to delete in insert mode +inoremap + +" persistent undo survives vim exits +if has("persistent_undo") + set undodir=~/.vim/undodir/ + silent call system('mkdir -p ' . &undodir) + set undofile +endif + +" use mouse if available +if has('mouse') + set mouse=a +endif + +" When editing a file, always jump to the last known cursor position. +" Don't do it when the position is invalid or when inside an event handler +" (happens when dropping a file on gvim). +" autocmd BufReadPost * +" \ if line("'\"") >= 1 && line("'\"") <= line("$") | +" \ exe "normal! g`\"" | +" \ endif +augroup resCur + autocmd! + autocmd BufReadPost * call setpos(".", getpos("'\"")) +augroup END + +autocmd FileType make set noexpandtab shiftwidth=8 softtabstop=0 + +" Allow saving of files as sudo when i forgot to start vim using sudo +cmap w!! w !sudo tee > /dev/null % + +" keeps the visual selection active after indenting +vmap > >gv +vmap < fzf#install() }} +Plug 'junegunn/fzf.vim' " FZF +Plug 'junegunn/goyo.vim' "distraction free writing in vim +Plug 'junegunn/limelight.vim' " highlight focused paragraph +Plug 'junegunn/vim-easy-align' " alignment like tabular +Plug 'kien/ctrlp.vim' " fuzzy file finder +Plug 'majutsushi/tagbar' " Tagbar + +Plug 'mbbill/undotree' , { 'on': 'UndotreeToggle' } " Edits graph +Plug 'mhinz/vim-startify' "fancy startup for vim +Plug 'mileszs/ack.vim' " built in grep for vim +Plug 'ntpeters/vim-better-whitespace' " Whitespace +Plug 'terryma/vim-multiple-cursors' " multiple selections for vim +Plug 'timakro/vim-searchant' " improved search highlighting +Plug 'tpope/vim-fugitive' " Git interface +Plug 'tpope/vim-speeddating' " vim-orgmode depend +Plug 'tpope/vim-surround' " manipulate comments +Plug 'vim-airline/vim-airline' " Status line +Plug 'vim-airline/vim-airline-themes' " Status line themes +Plug 'kien/rainbow_parentheses.vim' " color parenthes +Plug 'pelodelfuego/vim-swoop' " search results in one buffer +"Plug 'xuhdev/vim-latex-live-preview', { 'for': 'tex' } +Plug 'lervag/vimtex' +Plug 'preservim/vim-indent-guides' +" Plug 'Chiel92/vim-autoformat' +call plug#end() diff --git a/vim/.vimrc.plugins.settings b/vim/.vimrc.plugins.settings new file mode 100644 index 0000000..e70fb54 --- /dev/null +++ b/vim/.vimrc.plugins.settings @@ -0,0 +1,160 @@ +" Goyo +autocmd! User GoyoEnter Limelight +autocmd! User GoyoLeave Limelight! +" +" Limelight 1 go +map :Goyo :Limelight!! + +" fix airline +"let g:airline_powerline_fonts = 1 +set laststatus=2 + +""" Plugin configurations +" appearance +silent! colorscheme molokai + +" if running gui use different background like emacs +" set to dark for complete dark +" set to light for more light +if has('gui_running') + set background=dark +else + set background=dark +endif + +" gitgutter +let g:gitgutter_override_sign_column_highlight = 0 +set signcolumn=yes + +" airline +" use powerline patched font +let g:airline_powerline_fonts = 1 + +" just use :StripWhitespace +let g:better_whitespace_enabled = 0 + +" recognize all Markdown files +autocmd BufNewFile,BufReadPost *.md set filetype=markdown +let g:markdown_fenced_languages = ['c', 'cpp', 'csharp=cs', 'bash=sh', 'json'] + +" use solarized dark airline theme +let g:airline_theme='molokai' + + +""" easy motion +" f{char} to move to {char} +map fc (easymotion-bd-f) +nmap fc (easymotion-overwin-f) +" s{char}{char} to move to {char}{char} +nmap s (easymotion-overwin-f2) +" Move to line +map L (easymotion-bd-jk) +nmap L (easymotion-overwin-line) +" Move to word +map w (easymotion-bd-w) +nmap w (easymotion-overwin-w) + +" tagbar +nmap :TagbarToggle + +" undotree +nmap :UndotreeToggle + +" Nerd tree +map :NERDTreeToggle + +" UltiSnips config +" Trigger configuration. Do not use if you use +" https://github.com/Valloric/YouCompleteMe. +" was c-k, c-b, c-z +let g:UltiSnipsExpandTrigger="" +let g:UltiSnipsJumpForwardTrigger="" +let g:UltiSnipsJumpBackwardTrigger="" +" If you want :UltiSnipsEdit to split your window. +let g:UltiSnipsEditSplit="vertical" + +" youcompleteme +let g:ycm_global_ycm_extra_conf = '~/.ycm_global_ycm_extra_conf' +let g:ycm_confirm_extra_conf = 0 +" let g:ycm_server_python_interpreter = '/usr/bin/python2' + + +" vim-javascript +let g:javascript_plugin_jsdoc = 1 +let g:javascript_plugin_ngdoc = 1 +let g:javascript_plugin_flow = 1 + +" NumberToggle +let g:NumberToggleTrigger="" + +" vim-markdown +let g:vim_markdown_folding_disabled = 1 + +" vim-fswitch settings +nnoremap fsh :FSSplitLeft +nnoremap fsj :FSSplitBelow +nnoremap fsk :FSSplitAbove +nnoremap fsl :FSSplitRight +nnoremap h : FSSplitRight + +" tmuxline settings +"let g:tmuxline_preset = 'full' " nightly_fox, tmux + +" limelight settings +let g:limelight_conceal_ctermfg = 256 + +" ack +if executable('ag') + let g:ackprg = 'ag --nogroup --nocolor --column --smart-case' +elseif executable('ack-grep') + let g:ackprg="ack-grep -H --nocolor --nogroup --column" +elseif executable('ack') + let g:ackprg='ack ' +endif + +" vim-easy-align +" Start interactive EasyAlign in visual mode (e.g. vipga) +xmap ga (EasyAlign) +" Start interactive EasyAlign for a motion/text object (e.g. gaip) +nmap ga (EasyAlign) + +" CTrl-P +let g:ctrlp_match_window = 'bottom,order:ttb' +let g:ctrlp_switch_buffer = 0 +let g:ctrlp_working_path_mode = 0 +let g:ctrlp_user_command = 'ag %s -l --nocolor --hidden -g ""' + +" transparent vim +hi Normal ctermbg=none +hi NonText ctermbg=none + +" vim latex preview +let g:livepreview_previewer = 'zathura' +autocmd Filetype tex setl updatetime=1 + +" FZF shortcuts +" File searches +nnoremap f :Files +" Buffers list +nnoremap b :Files +" Silver searcher +nnoremap ag :Ag +" Rip grep +nnoremap rg :Rg +" Current File content only +nnoremap g :Gfiles? +" list files in the current git repository +nnoremap gf :Gfiles +" search through previous git commits +nnoremap gc :Commits +" switch branches real quick +nnoremap gb :Branches +" search through tags +nnoremap t :Tags +" history recent files +nnoremap h :History +" list and jump to marks in your vim session +nnoremap m :Marks + +" lervag/vimtex +let g:vimtex_view_method = 'zathura' diff --git a/vim/.ycm_extra_conf.py b/vim/.ycm_extra_conf.py new file mode 100644 index 0000000..d970148 --- /dev/null +++ b/vim/.ycm_extra_conf.py @@ -0,0 +1,220 @@ +# This file is NOT licensed under the GPLv3, which is the license for the rest +# of YouCompleteMe. +# +# Here's the license text for this file: +# +# This is free and unencumbered software released into the public domain. +# +# Anyone is free to copy, modify, publish, use, compile, sell, or +# distribute this software, either in source code form or as a compiled +# binary, for any purpose, commercial or non-commercial, and by any +# means. +# +# In jurisdictions that recognize copyright laws, the author or authors +# of this software dedicate any and all copyright interest in the +# software to the public domain. We make this dedication for the benefit +# of the public at large and to the detriment of our heirs and +# successors. We intend this dedication to be an overt act of +# relinquishment in perpetuity of all present and future rights to this +# software under copyright law. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +# IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR +# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +# OTHER DEALINGS IN THE SOFTWARE. +# +# For more information, please refer to + +from sysconfig import get_path +import platform +import os.path as p +import subprocess + +DIR_OF_THIS_SCRIPT = p.abspath( p.dirname( __file__ ) ) +DIR_OF_THIRD_PARTY = p.join( DIR_OF_THIS_SCRIPT, 'third_party' ) +DIR_OF_WATCHDOG_DEPS = p.join( DIR_OF_THIRD_PARTY, 'watchdog_deps' ) +SOURCE_EXTENSIONS = [ '.cpp', '.cxx', '.cc', '.c', '.m', '.mm' ] + +database = None + +# These are the compilation flags that will be used in case there's no +# compilation database set (by default, one is not set). +# CHANGE THIS LIST OF FLAGS. YES, THIS IS THE DROID YOU HAVE BEEN LOOKING FOR. +flags = [ +'-Wall', +'-Wextra', +'-Werror', +'-Wno-long-long', +'-Wno-variadic-macros', +'-fexceptions', +'-DNDEBUG', +# You 100% do NOT need -DUSE_CLANG_COMPLETER and/or -DYCM_EXPORT in your flags; +# only the YCM source code needs it. +'-DUSE_CLANG_COMPLETER', +'-DYCM_EXPORT=', +'-DYCM_ABSEIL_SUPPORTED', +# THIS IS IMPORTANT! Without the '-x' flag, Clang won't know which language to +# use when compiling headers. So it will guess. Badly. So C++ headers will be +# compiled as C headers. You don't want that so ALWAYS specify the '-x' flag. +# For a C project, you would set this to 'c' instead of 'c++'. +'-x', +'c++', +'-isystem', +'cpp/absl', +'-isystem', +'cpp/pybind11', +'-isystem', +'cpp/whereami', +'-isystem', +'cpp/BoostParts', +'-isystem', +get_path( 'include' ), +'-isystem', +'cpp/llvm/include', +'-isystem', +'cpp/llvm/tools/clang/include', +'-I', +'cpp/ycm', +'-I', +'cpp/ycm/ClangCompleter', +'-isystem', +'cpp/ycm/tests/gmock/googlemock/include', +'-isystem', +'cpp/ycm/tests/gmock/googletest/include', +'-isystem', +'cpp/ycm/benchmarks/benchmark/include', +'-std=c++17', +] + +# Set this to the absolute path to the folder (NOT the file!) containing the +# compile_commands.json file to use that instead of 'flags'. See here for +# more details: http://clang.llvm.org/docs/JSONCompilationDatabase.html +# +# You can get CMake to generate this file for you by adding: +# set( CMAKE_EXPORT_COMPILE_COMMANDS 1 ) +# to your CMakeLists.txt file. +# +# Most projects will NOT need to set this to anything; you can just change the +# 'flags' list of compilation flags. Notice that YCM itself uses that approach. +compilation_database_folder = '' + + +def IsHeaderFile( filename ): + extension = p.splitext( filename )[ 1 ] + return extension in [ '.h', '.hxx', '.hpp', '.hh' ] + + +def FindCorrespondingSourceFile( filename ): + if IsHeaderFile( filename ): + basename = p.splitext( filename )[ 0 ] + for extension in SOURCE_EXTENSIONS: + replacement_file = basename + extension + if p.exists( replacement_file ): + return replacement_file + return filename + + +def PathToPythonUsedDuringBuild(): + try: + filepath = p.join( DIR_OF_THIS_SCRIPT, 'PYTHON_USED_DURING_BUILDING' ) + with open( filepath ) as f: + return f.read().strip() + except OSError: + return None + + +def Settings( **kwargs ): + # Do NOT import ycm_core at module scope. + import ycm_core + + global database + if database is None and p.exists( compilation_database_folder ): + database = ycm_core.CompilationDatabase( compilation_database_folder ) + + language = kwargs[ 'language' ] + + if language == 'cfamily': + # If the file is a header, try to find the corresponding source file and + # retrieve its flags from the compilation database if using one. This is + # necessary since compilation databases don't have entries for header files. + # In addition, use this source file as the translation unit. This makes it + # possible to jump from a declaration in the header file to its definition + # in the corresponding source file. + filename = FindCorrespondingSourceFile( kwargs[ 'filename' ] ) + + if not database: + return { + 'flags': flags, + 'include_paths_relative_to_dir': DIR_OF_THIS_SCRIPT, + 'override_filename': filename + } + + compilation_info = database.GetCompilationInfoForFile( filename ) + if not compilation_info.compiler_flags_: + return {} + + # Bear in mind that compilation_info.compiler_flags_ does NOT return a + # python list, but a "list-like" StringVec object. + final_flags = list( compilation_info.compiler_flags_ ) + + # NOTE: This is just for YouCompleteMe; it's highly likely that your project + # does NOT need to remove the stdlib flag. DO NOT USE THIS IN YOUR + # ycm_extra_conf IF YOU'RE NOT 100% SURE YOU NEED IT. + try: + final_flags.remove( '-stdlib=libc++' ) + except ValueError: + pass + + return { + 'flags': final_flags, + 'include_paths_relative_to_dir': compilation_info.compiler_working_dir_, + 'override_filename': filename + } + + if language == 'python': + return { + 'interpreter_path': PathToPythonUsedDuringBuild(), + 'ls': { + 'python': { + 'analysis': { + 'extraPaths': [ + p.join( DIR_OF_THIS_SCRIPT ), + p.join( DIR_OF_THIRD_PARTY, 'bottle' ), + p.join( DIR_OF_THIRD_PARTY, 'regex-build' ), + p.join( DIR_OF_THIRD_PARTY, 'frozendict' ), + p.join( DIR_OF_THIRD_PARTY, 'jedi_deps', 'jedi' ), + p.join( DIR_OF_THIRD_PARTY, 'jedi_deps', 'parso' ), + p.join( DIR_OF_WATCHDOG_DEPS, 'watchdog', 'build', 'lib3' ), + p.join( DIR_OF_WATCHDOG_DEPS, 'pathtools' ), + p.join( DIR_OF_THIRD_PARTY, 'waitress' ) + ], + 'useLibraryCodeForTypes': True + } + } + } + } + + return {} + + +def PythonSysPath( **kwargs ): + sys_path = kwargs[ 'sys_path' ] + + sys_path[ 0:0 ] = [ p.join( DIR_OF_THIS_SCRIPT ), + p.join( DIR_OF_THIRD_PARTY, 'bottle' ), + p.join( DIR_OF_THIRD_PARTY, 'regex-build' ), + p.join( DIR_OF_THIRD_PARTY, 'frozendict' ), + p.join( DIR_OF_THIRD_PARTY, 'jedi_deps', 'jedi' ), + p.join( DIR_OF_THIRD_PARTY, 'jedi_deps', 'parso' ), + p.join( DIR_OF_WATCHDOG_DEPS, + 'watchdog', + 'build', + 'lib3' ), + p.join( DIR_OF_WATCHDOG_DEPS, 'pathtools' ), + p.join( DIR_OF_THIRD_PARTY, 'waitress' ) ] + + sys_path.append( p.join( DIR_OF_THIRD_PARTY, 'jedi_deps', 'numpydoc' ) ) + return sys_path -- cgit v1.2.3