From bd1266f26acb8af4318f4fe708015bcfea2ad4b7 Mon Sep 17 00:00:00 2001 From: David Runge Date: Sun, 7 Feb 2021 16:41:11 +0100 Subject: .vim/* Remove unused configs .vim/custom-{functions,settings}.vim: Remove unused settings. --- .vim/custom-functions.vim | 37 ------- .vim/custom-settings.vim | 240 ---------------------------------------------- 2 files changed, 277 deletions(-) delete mode 100644 .vim/custom-functions.vim delete mode 100644 .vim/custom-settings.vim diff --git a/.vim/custom-functions.vim b/.vim/custom-functions.vim deleted file mode 100644 index ecf92bd..0000000 --- a/.vim/custom-functions.vim +++ /dev/null @@ -1,37 +0,0 @@ -" ================ strip trailing whitespaces ================ -" via: http://rails-bestpractices.com/posts/60-remove-trailing-whitespace -" Strip trailing whitespace -function! StripTrailingWhitespaces() - " Preparation: save last search, and cursor position. - let _s=@/ - let l = line(".") - let c = col(".") - " Do the business: - %s/\s\+$//e - " Clean up: restore previous search history, and cursor position - let @/=_s - call cursor(l, c) -endfunction -command! StripTrailingWhitespaces call StripTrailingWhitespaces() -nmap ,w :StripTrailingWhitespaces -" ================ text wrapping ================ -" http://vimcasts.org/episodes/soft-wrapping-text/ -function! SetupWrapping() - set wrap linebreak nolist - set showbreak=… -endfunction - -" TODO: this should happen automatically for certain file types (e.g. markdown) -command! -nargs=* Wrap :call SetupWrapping() - -vmap gj -vmap gk -vmap g$ -vmap g^ -vmap g^ -nmap gj -nmap gk -nmap g$ -nmap g^ -nmap g^ - diff --git a/.vim/custom-settings.vim b/.vim/custom-settings.vim deleted file mode 100644 index 9233b35..0000000 --- a/.vim/custom-settings.vim +++ /dev/null @@ -1,240 +0,0 @@ -" ================ keymap settings ================ -" ======================================== -" General vim sanity improvements -" ======================================== -" -" -" alias yw to yank the entire word 'yank inner word' -" even if the cursor is halfway inside the word -" FIXME: will not properly repeat when you use a dot (tie into repeat.vim) -nnoremap ,yw yiww - -" ,ow = 'overwrite word', replace a word with what's in the yank buffer -" FIXME: will not properly repeat when you use a dot (tie into repeat.vim) -nnoremap ,ow "_diwhp - -"make Y consistent with C and D -nnoremap Y y$ -function! YRRunAfterMaps() - nnoremap Y :YRYankCount 'y$' -endfunction - -" Make 0 go to the first character rather than the beginning -" of the line. When we're programming, we're almost always -" interested in working with text rather than empty space. If -" you want the traditional beginning of line, use ^ -nnoremap 0 ^ -nnoremap ^ 0 - -" ======================================== -" RSI Prevention - keyboard remaps -" ======================================== -" Certain things we do every day as programmers stress -" out our hands. For example, typing underscores and -" dashes are very common, and in position that require -" a lot of hand movement. Vim to the rescue -" -" Now using the middle finger of either hand you can type -" underscores with apple-k or apple-d, and add Shift -" to type dashes -imap _ -imap _ -imap - -imap - - -" ,# Surround a word with #{ruby interpolation} -map ,# ysiw# -vmap ,# c#{"} - -" ," Surround a word with "quotes" -map ," ysiw" -vmap ," c""" - -" ,' Surround a word with 'single quotes' -map ,' ysiw' -vmap ,' c'"' - -" ,) or ,( Surround a word with (parens) -" The difference is in whether a space is put in -map ,( ysiw( -map ,) ysiw) -vmap ,( c( " ) -vmap ,) c(") - -" ,[ Surround a word with [brackets] -map ,] ysiw] -map ,[ ysiw[ -vmap ,[ c[ " ] -vmap ,] c["] - -" ,{ Surround a word with {braces} -map ,} ysiw} -map ,{ ysiw{ -vmap ,} c{ " } -vmap ,{ c{"} - -map ,` ysiw` - -" gary bernhardt's hashrocket -imap => - -" Change inside various enclosures with Cmd-" and Cmd-' -" The f makes it find the enclosure so you don't have -" to be standing inside it -nnoremap f'ci' -nnoremap f"ci" -nnoremap f(ci( -nnoremap f)ci) -nnoremap f[ci[ -nnoremap f]ci] - -"Go to last edit location with ,. -nnoremap ,. '. - -"When typing a string, your quotes auto complete. Move past the quote -"while still in insert mode by hitting Ctrl-a. Example: -" -" type 'foo -" -" the first quote will autoclose so you'll get 'foo' and hitting will -" put the cursor right after the quote -imap wa - -" ==== NERD tree -" Cmd-Shift-N for nerd tree -nmap :NERDTreeToggle -" Open the project tree and expose current file in the nerdtree with Ctrl-\ -nnoremap :NERDTreeFind:vertical res 30 - -" ,q to toggle quickfix window (where you have stuff like Ag) -" ,oq to open it back up (rare) -nmap ,qc :cclose -nmap ,qo :copen - -" move up/down quickly by using Cmd-j, Cmd-k -" which will move us around by functions -nnoremap } -nnoremap { -autocmd FileType ruby map ]m -autocmd FileType ruby map [m -autocmd FileType rspec map } -autocmd FileType rspec map { -autocmd FileType javascript map } -autocmd FileType javascript map { - - -" Command-/ to toggle comments -map :TComment -imap :TCommenti - - -"Move back and forth through previous and next buffers -"with ,z and ,x -nnoremap ,z :bp -nnoremap ,x :bn - -" ============================== -" Window/Tab/Split Manipulation -" ============================== -" Move between split windows by using the four directions H, L, I, N -nnoremap h -nnoremap l -nnoremap k -nnoremap j - -" Make gf (go to file) create the file, if not existent -nnoremap gf :e -nnoremap f :sp +e -nnoremap gf :tabe - -" Zoom in -map ,gz o - -" Use numbers to pick the tab you want (like iTerm) -map :tabn 1 -map :tabn 2 -map :tabn 3 -map :tabn 4 -map :tabn 5 -map :tabn 6 -map :tabn 7 -map :tabn 8 -map :tabn 9 - -" Create window splits easier. The default -" way is Ctrl-w,v and Ctrl-w,s. I remap -" this to vv and ss -nnoremap vv v -nnoremap ss s - -" Resize windows with arrow keys -nnoremap + -nnoremap - -nnoremap < -nnoremap > - -" create <%= foo %> erb tags using Ctrl-k in edit mode -imap <%= %>3hi - -" create <%= foo %> erb tags using Ctrl-j in edit mode -imap <% %>2hi - -" ============================ -" Shortcuts for everyday tasks -" ============================ - -" copy current filename into system clipboard - mnemonic: (c)urrent(f)ilename -" this is helpful to paste someone the path you're looking at -nnoremap ,cf :let @* = expand("%:~") -nnoremap ,cn :let @* = expand("%:t") - -"Clear current search highlight by double tapping // -nmap // :nohlsearch - -"(v)im (c)ommand - execute current line as a vim command -nmap ,vc yy:p - -"(v)im (r)eload -nmap ,vr :so % - -" Type ,hl to toggle highlighting on/off, and show current value. -noremap ,hl :set hlsearch! hlsearch? - -" These are very similar keys. Typing 'a will jump to the line in the current -" file marked with ma. However, `a will jump to the line and column marked -" with ma. It’s more useful in any case I can imagine, but it’s located way -" off in the corner of the keyboard. The best way to handle this is just to -" swap them: http://items.sjbach.com/319/configuring-vim-right -nnoremap ' ` -nnoremap ` ' - -" ============================ -" Tabularize - alignment -" ============================ -" Hit Cmd-Shift-A then type a character you want to align by -nmap :Tabularize / -vmap :Tabularize / - -" ============================ -" SplitJoin plugin -" ============================ -nmap sj :SplitjoinSplit -nmap sk :SplitjoinJoin - -" Get the current highlight group. Useful for then remapping the color -map ,hi :echo "hi<" . synIDattr(synID(line("."),col("."),1),"name") . '> trans<' . synIDattr(synID(line("."),col("."),0),"name") . "> lo<" . synIDattr(synIDtrans(synID(line("."),col("."),1)),"name") . ">" . " FG:" . synIDattr(synIDtrans(synID(line("."),col("."),1)),"fg#") - -" Source current file Cmd-% (good for vim development) -map :so % - -" ,hp = html preview -map ,hp :!open -a Safari % -" ================ search settings ================ -" ================ Search Settings ================= - -set incsearch " Find the next match as we type the search -set hlsearch " Hilight searches by default -set viminfo='100,f1 " Save up to 100 marks, enable capital marks -set ignorecase " Ignore case when searching... -set smartcase " ...unless we type a capital - -- cgit v1.2.3-54-g00ecf