commit a8329ff6814fda7857e75b4dfcaf081ca4457a4e (patch)
parent 4c4f66d9ac1d08def63e827662f346c29327c5c5
Author: Alex Karle <alex@karle.co>
Date: Wed, 6 Nov 2019 22:58:51 -0500
vim: fall cleaning, small vimrc improvements
* ToggleColorColumn: now defaults to textwidth if set
* Removed "PasteFromClipboard" in favor of ":put"
- This is a little cleaner on the Vimscript
* Changed nasty "copy whole file" mapping to use ":yank" properly
- Added benefit of not redrawing the screen with <C-O>
* Removed outdated c.vim ftplugin
- Not using YCM at all these days
* Removed Dark/Light nnoremaps
- While I used to use this when I coded outside... I don't code
outside often these days :)
* Removed terminal mapping attempt at standardizing "go to insert mode"
1. I use tmux over the terminal almost always
2. I should give the defaults another shot...
Diffstat:
3 files changed, 7 insertions(+), 30 deletions(-)
diff --git a/vim/autoload/vimrc.vim b/vim/autoload/vimrc.vim
@@ -3,14 +3,12 @@
" See `:h autoload-functions` for explanation of autoloading and performance
function! vimrc#ToggleColorColumn() abort
if &colorcolumn == ""
- set colorcolumn=80
+ if &textwidth > 0
+ exe "set colorcolumn=" . &textwidth
+ else
+ set colorcolumn=80
+ endif
else
set colorcolumn=""
endif
endfunction
-
-function! vimrc#SetPasteAndPasteFromClipboard() abort
- set paste
- normal! "+p
- set nopaste
-endfunction
diff --git a/vim/ftplugin/c.vim b/vim/ftplugin/c.vim
@@ -1,4 +0,0 @@
-" for neovim development!
-if exists( "g:loaded_youcompleteme" )
- nnoremap <buffer> <c-]> :YcmCompleter GoTo<CR>
-endif
diff --git a/vim/vimrc b/vim/vimrc
@@ -102,7 +102,6 @@ if (($TERM =~# '256color' && has("termguicolors")) || has('gui_running')) &&
colorscheme gruvbox
" See :h xterm-true-color for tmux+termguicolors
- " TODO: is this safe to blindly set always (in 256 color mode)?
if &term =~# '^\(tmux\|st\|screen\)'
let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum"
let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum"
@@ -119,7 +118,6 @@ else
set background=light
colorscheme vc
endif
-
" }}}
" KEY MAPPINGS {{{
@@ -132,18 +130,8 @@ nnoremap <C-k> <C-w>k
nnoremap <C-h> <C-w>h
nnoremap <C-l> <C-w>l
-" Terminal mappings
-" NOTE: a couple limitations here:
-" 1) Vim interprets arrows as escape sequences --> remapping escape is no-go
-" 2) Alacritty cannot handle meta on mac (currently)
-"
-" With this in mind, the goal is to make cross-vim keys consistent
-if has('terminal') || has('nvim')
- tnoremap <C-W> <C-\><C-N><C-W>
-endif
-
" Paste from clipboard without any formatting issues
-nnoremap <C-p> :call vimrc#SetPasteAndPasteFromClipboard()<CR>
+nnoremap <C-p> :set paste \| put + \| set nopaste<CR>
" Clear trailing whitespace (through regexp)
nnoremap <leader><space> :call utils#CMDPreserve("%s/\\s\\+$//e")<CR>
@@ -153,10 +141,6 @@ nnoremap <leader>e :e %:h/
nnoremap <leader>v :vsp %:h/
nnoremap <leader>s :sp %:h/
-" quick toggle for light/dark background
-nnoremap <leader>L :set background=light<CR>
-nnoremap <leader>D :set background=dark<CR>
-
" toggle color column (to ensure short lines)
nnoremap <expr> <leader>C vimrc#ToggleColorColumn()
@@ -175,7 +159,7 @@ nnoremap <silent> <leader>G :Ggrep! <cword><CR>:copen<CR>
nnoremap <leader>w :set list!<CR>
" Yank entire file
-nnoremap <leader>y gg"+yG<C-O><C-O>
+nnoremap <leader>y :0,$y +<CR>
" Edit vimrc
nnoremap <leader>V :edit $HOME/.vim/vimrc<CR>
@@ -185,7 +169,6 @@ inoremap <C-U> <C-G>u<C-U>
" }}}
" COMMANDS {{{
-command! -nargs=1 GitGrep call vimrc#GitGrep('<args>') | copen
command! CD exe 'cd ' . expand('%:h')
" }}}