From e900c217c1e50a4067384c9bb3fe43dff61986c6 Mon Sep 17 00:00:00 2001 From: Mitsuo Tokumori Date: Fri, 24 Nov 2023 00:31:06 -0500 Subject: Restructure dirs to mimic XDG base dirs Non XDG base directories have a leading '_'. --- vim/vimrc | 332 -------------------------------------------------------------- 1 file changed, 332 deletions(-) delete mode 100644 vim/vimrc (limited to 'vim/vimrc') diff --git a/vim/vimrc b/vim/vimrc deleted file mode 100644 index f97a654..0000000 --- a/vim/vimrc +++ /dev/null @@ -1,332 +0,0 @@ -" mitsuo's vimrc -" Created c. 2019-11-11 -" Last update (after destroying it accidentally): 2020-09-02 -" -" ┌─┬─┬─┬─┬─┬─┐ -" │m│i│t│s│u│o│✓x け が -" ├─┼─┼─┼─┼─┼─┤ ん -" │v│i│m│r│c│←│█▓▒░ り ば -" └─┴─┴─┴─┴─┴─┘ こ れ - -" XDG compliant REMOVED :D (what a pain) -" - For new installs just copy (or link) this file into ~/.vimrc and create -" the ~/.vim directory -" TODO: - sort sections - - -" Variables -" ---------------------------------------------------------------------- -" Get the first directory from the list in $VIMRUNTIMEPATH -let $VIMFILES=split(&rtp,",")[0] -set undodir=$VIMFILES/undo -set viewdir=$VIMFILES/view -set directory=$VIMFILES/swap -set viminfofile=$VIMFILES/viminfo - - -" Useful -" ---------------------------------------------------------------------- -set nocompatible -" Auto-recognize files and apply pluggins -filetype plugin indent on " See :h vimrc-filetype -syntax on - -" Search files -set wildmenu " command-line completion <-- soo good -set wildignore+=*.o,*.obj,.git,*.rbc,*.class -set path+=./**30 " For gf and :find, add all subdirectories relative to - " current file (30 max) to the "search space" - -set scrolloff=5 " show a few lines of context - -set backspace=indent,eol,start " Allow and in insert mode - -" number gutter -set nonumber -set norelativenumber - -" Store session information -set viminfo+='1000 - -" Tag Jumping <-- so cool -" Instructions: create tag index (e.g. $ ctags -R .) -" place cursor on tag -" ^] to jump to definition -" g^] if more than 1 definition -" ^T to return (or ^O) -" TODO: create tags automatically (:!ctags -R . after :w if ft=c) - - -" Status line -" ---------------------------------------------------------------------- -set showcmd " show partial command on last line (below status bar) -" just add buffer number to the default -set statusline=%<%f\ %h%m%r%=b%02n\ \ %-14.(%l,%c%V%)\ %P - - -" Search -" ---------------------------------------------------------------------- -set hlsearch " highlight search (this can be annoying if no shortcut to then - " clear the highlight -set incsearch " Incrementally move cursor while typing search-string -" stop highlight only for current search. -" (Still preserve updating directory in netrw) -nnoremap :nohl -" Ignore case only when pattern is lowercase (both needed) -set ignorecase -set smartcase - - -" Indentation -" ---------------------------------------------------------------------- -" 4 column softtabs (uses ' ', not '\t'). -" TODO: move this 'guide' to somewhere apropiate -" tab->softtab :set tabstop=n :set expandtab :retab -" softtab->tab :set noexpandtab :set tabstop={softtabstop} :retab! -" Caution: -" - This will insert a tab wherever it can, even between words -" separated by as few as 2 spaces if ts=2! -" - Not recommended at all. Use some other program to only translate -" leading indenting from space to tabs. Also using tabs is not very -" good. My opinion is that they are good as a special character to -" separate data (like comma for CSV). -set tabstop=8 " '\t' or HT = 8 virtual columns -set shiftwidth=4 " Indentation with >> and C-T and C-D (insert mode) -set softtabstop=4 " For "inserted tabs" (inserts and - " minimizing ) -set expandtab " Expand with the inserted s -"set smarttab " Use shiftwidth for inserted in the front of - " a line (Maybe useful for YAML) -" autoindent -> smartindent -> cindent -> indentexpr -" (from simple/less general to complex/more general) -set smartindent " This is a really nice and simple one -"set cindent -"set cinoptions=:0,g0 " See C-indenting - - -" Automatic formatting -" ---------------------------------------------------------------------- -" see fo-table -set formatoptions=l " Don't break long lines that are already typed -set formatoptions+=q " Allow formatting of comments with "gq" -set formatoptions+=r " Insert current leader after in Insert mode -set formatoptions-=o " Automatically insert the current comment leader - " after hitting 'o'. -set formatoptions+=t " auto-wrap text (when inserting) -set formatoptions+=c " auto-wrap comments (when inserting) -set formatoptions+=p " Don't break honorifics like Prof. Smith -set formatoptions+=n " Allow lists -set formatoptions+=j " Removes comment leader when joining lines - - -" Word wrap -" ---------------------------------------------------------------------- -set wrap " Visual wrapping of lines wider than window -set linebreak " Works with previous option to not break words -" To 'justify' comments or block of text (paragraph) use "gq{motion}" or -" "gp{motion}", where {motion} can be "[/", "]/", "ip", "i{", "a{". -set textwidth=80 " auto break inserted text longer than 80 colums - - -" Other settings -" ---------------------------------------------------------------------- -set mouse=a " Enable for all modes -" set cmdheight=1 -" Always display the status line, even if only one window is displayed -set laststatus=2 -set ruler -set encoding=utf-8 -set more " Enable more-prompt for listings that don't fit in - " screen -"hint: g< command can be used to see the last page of previous command. - - -" Mappings -" ---------------------------------------------------------------------- -" F1 is help, F11 is full screen (terminal emulator) -map :source $VIMFILES/vimrc -map :e $VIMFILES/vimrc - -map :tabp -map :tabn - -" C/C++ Programming: - -map :w:!clear && make -"map :!./%:r -"map :!./a.out - -map :cnext -map :cprev - -" = '\' when 'mapleader' is empty -" "Run cTags" -map rt :!ctags -R . -map :tnext - -" Motion to go to beggining of function while cursor is inside -nmap [f [m[{k0 - -" Other programs: - -" pandoc (& website) -nnoremap mm :w:Md2Html -nmap mM mm:!updatewebsite_zaz -" asciidoc -nnoremap ma :w:!asciidoctor % -nmap mA ma:!updatewebsite_zaz - -" Funcionallity of the following depends on terminal. Needs 8bit input enabled -" for = Alt key combos -" From: https://vim.fandom.com/wiki/Get_Alt_key_to_work_in_terminal - -nmap h -nmap j -nmap k -nmap l - -" Misc.: - -" Go Title Case (and clear highlighted matches) -" Ref.: vim.fandom.com -vmap gt :s/\<\(\w\)\(\w*\)\>/\u\1\L\2/g - -" Autoformat JSON jumbled data. (Selects the whole file as range to pass as -" standard input to `jq .` which pretty prints JSON. Then replace range with -" output.) -" Ref.: https://stackoverflow.com/questions/26214156/how-to-auto-format-json-on-save-in-vim -nnoremap gJ :%!python3 -m json.tool -" :%!jq . - -" NERDTree plugin -nnoremap :NERDTreeToggle - -" Comment/UnComment lines -" Ref.: -" - https://vim.fandom.com/wiki/Comment/UnComment_visually_selected_text -" - https://stackoverflow.com/a/1676672/7498073 -" - https://stackoverflow.com/a/9051932/7498073 -au FileType haskell,vhdl,ada let b:comment_leader = '-- ' -au FileType vim let b:comment_leader = '" ' -au FileType c,cpp,java,asciidoc let b:comment_leader = '// ' -au FileType sh,make let b:comment_leader = '# ' -au FileType tex let b:comment_leader = '% ' -" That c_CTRL-R_= thingy enters the "expression register". And that \V -" tells :s to go into "Very NonMagic" mode. -noremap ,c :s/^/=escape(b:comment_leader,'\/')/:noh -noremap ,u :s/^\V=escape(b:comment_leader,'\/')//e:noh - - -" Yanking and pasting -" ---------------------------------------------------------------------- -" TODO: map something to "+y (cut buffer) and "*y (selection buffer) while in -" visual mode. -"vmap <++> "+y " The yank to the cut buffer (clipboard) -"vmap <++> "*y " The yank to the selection buffer - - -" Buffers -" ---------------------------------------------------------------------- -set hidden -map :bNext -map :bnext - - -" Printing -" ---------------------------------------------------------------------- -set printoptions=paper:A4,duplex:long -" set printoptions+=number:y -" TODO: Figure out how to print multibyte encodings. Enabling this settings -" produces errors. -set encoding=utf-8 -set fileencoding=utf-8 -" set printmbcharset=JIS_X_1990 " This allows Japanese characters to be printed -" set printmbfont=r:Noto-Sans-CJK-JP - - -" Functions -" ---------------------------------------------------------------------- -" TODO: maybe replace with $runtimepath -source $VIMFILES/fun.vim - - -" Views and Sessions (Window layout and Line folding) -" ---------------------------------------------------------------------- -" It is possible to create folds automatically but idk how to do it. -" :mkview so save them :loadview to load them (zo open one, zc close one, -" zR to open all, zM to close all, zx to restore)) - -" Views saves folds. Sessions saves all windows configuration and layout -" Load Sessions with $ vim -S Session.vim - -" To automatically save and restore views for *.c *.cpp files: -au BufWinLeave *.c mkview -au BufWinEnter *.c silent loadview -au BufWinLeave *.cpp mkview -au BufWinEnter *.cpp silent loadview - - -" Snippets -" ---------------------------------------------------------------------- -" I deleted the file accidently -"nnoremap ,ch :-1r $VIMFILES/snippets/cheader.c - - -" File Browsing -" ---------------------------------------------------------------------- -" Use netrw out of the box file browser plugin. -" :e . open file browser on current directory -" V or t open file on vsplit or new tab. -" :bd or :Rex to return -" More mappings on |netrw-browse-maps| -"let g:netrw_banner=0 " disable banner -"let g:netrw_browse_split=4 " open in prior window -let g:netrw_altv=1 " open splits to the right -"let g:netrw_list_hide=netrw_gitignore#Hide() -"let g:netrw_list_hide.=',\(^\|\s\s\)\zs\.\S\+' " wtf? (?) -" Learned from Max Cantor talk https://youtu.be/XA2WjJbmmoM - - -" Additions -" ---------------------------------------------------------------------- -" Replaces previous WORD arithmetic expression with result (from Vim -" fandom-wiki) -inoremap diWi=" - - -" Plugins -" ---------------------------------------------------------------------- -" I disabled it bc I think it interferes with formatoptions -"" Automatic vim-plug install -"if empty(glob('~/.vim/autoload/plug.vim')) -" silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs -" \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim -" autocmd VimEnter * PlugInstall --sync | source $MYVIMRC -"endif -" -"call plug#begin() -"Plug 'ARM9/arm-syntax-vim' -"autocmd BufNewFile,BufRead *.s,*.S set filetype=arm " arm = armv6/7 -" -"call plug#end() - -" Other plugins -" I used to use IndexedSearch plugin. Functionality was incorporated into Vim -" since Vim 8.1.1270. -set shortmess-=S - - -" Colors -" ---------------------------------------------------------------------- -" I like desert, murphy, pablo, industry -" (default is OK for most cases but when using vimdiff, highlighted numbers are -" unreadable) -:colorscheme industry - - -" Ducktape (place this in ~/.vim/after (after directory)) -" ---------------------------------------------------------------------- -" Not even the ducktape worked for this one on C files TODO -set formatoptions-=o " Automatically insert the current comment leader -" TODO: fix this shit getting reset in a markdown text -set formatoptions+=r " auto insert comment leader after -- cgit v1.2.3