Commit 9df1b8f

mo khan <mo.khan@gmail.com>
2019-11-09 21:14:08
use no recursive map where applicable
1 parent d7b6622
Changed files (1)
vimrc
@@ -3,11 +3,15 @@
 
 runtime macros/matchit.vim
 color ir_black
+syntax enable         " Turn on syntax highlighting allowing local overrides
+if $TERM == "xterm-256color" || $TERM == "screen-256color" || $COLORTERM == "gnome-terminal"
+  set t_Co=256
+endif
+
 set nocompatible      " Use vim, no vi defaults
 set number            " Show line numbers
 set numberwidth=5
 set ruler             " Show line and column number
-syntax enable         " Turn on syntax highlighting allowing local overrides
 set encoding=utf-8    " Set default encoding to UTF-8
 set modelines=0       " do not check file for set commands
 set scrolloff=3       " always show 3 lines above and below cursor
@@ -33,14 +37,6 @@ set clipboard^=unnamed,unnamedplus " use OS clipboard
 set noswapfile
 set autowrite
 set tags=./.git/tags,./tmp/tags,./tags,tags,._tags
-if $TERM == "xterm-256color" || $TERM == "screen-256color" || $COLORTERM == "gnome-terminal"
-  set t_Co=256
-endif
-" }}}
-
-"" Whitespace {{{{
-""
-
 set nowrap                        " don't wrap lines
 set tabstop=2                     " a tab is two spaces
 set softtabstop=2                 " number of spaces that a <Tab> counts for while performing editing
@@ -51,8 +47,6 @@ set expandtab                     " use spaces, not tabs
 set list                          " Show invisible characters
 set backspace=indent,eol,start    " backspace through everything in insert mode
 set autoindent                    " copy indent from current line when starting a new one
-
-" List chars
 set listchars=""                  " Reset the listchars
 set listchars=tab:\ \             " a tab should display as "  ", trailing whitespace as "."
 set listchars+=trail:.            " show trailing spaces as copyright
@@ -62,21 +56,23 @@ set listchars+=precedes:<         " The character to show in the last column whe
                                   " off and the line continues beyond the left of the screen
 "set colorcolumn=80,100            " show color columns at 80 and 100
 set nojoinspaces " Use one space, not two, after punctuation.
-" }}}}
-
-"" Searching {{{{
-""
-
 set hlsearch    " highlight matches
 set incsearch   " incremental searching
 set ignorecase  " searches are case insensitive...
 set smartcase   " ... unless they contain at least one capital letter
 set showmatch   " briefly jump to the matching bracket.
+
 nnoremap / /\v
 vnoremap / /\v
 nnoremap K :grep! "\b<C-R><C-W>\b"<CR>:cw<CR>
 command! -nargs=+ -complete=file -bar FindInFiles silent! grep! <args>|cwindow|redraw!
 nnoremap F :FindInFiles<SPACE>
+nnoremap <C-p> :FZF<cr>
+
+if executable('ag')
+  let g:ackprg = 'ag --nogroup --nocolor --column'
+  set grepprg=ag\ --nogroup\ --nocolor " the silver searcher
+endif
 
 " }}}}
 
@@ -232,8 +228,8 @@ if has("autocmd")
 endif
 
 augroup filetype_vim
-    autocmd!
-    autocmd FileType vim setlocal foldmethod=marker
+  autocmd!
+  autocmd FileType vim setlocal foldmethod=marker
 augroup END
 " }}}}
 "
@@ -259,56 +255,52 @@ command! RRenameVariable call RenameVariable()
 let mapleader = ","
 let localleader = "\\"
 
-" Toggle paste mode
-nmap <silent> <F4> :set invpaste<CR>:set paste?<CR>
-imap <silent> <F4> <ESC>:set invpaste<CR>:set paste?<CR>
-
 " format the entire file
 nnoremap <leader>fef :normal! gg=G``<CR>
 
 " upper/lower word
-nmap <leader>u mQviwU`Q
-nmap <leader>l mQviwu`Q
+nnoremap <leader>u mQviwU`Q
+nnoremap <leader>l mQviwu`Q
 
 " upper/lower first char of word
-nmap <leader>U mQgewvU`Q
-nmap <leader>L mQgewvu`Q
+nnoremap <leader>U mQgewvU`Q
+nnoremap <leader>L mQgewvu`Q
 
 " cd to the directory containing the file in the buffer
-nmap <silent> <leader>cd :lcd %:h<CR>
+nnoremap <silent> <leader>cd :lcd %:h<CR>
 
 " Create the directory containing the file in the buffer
-nmap <silent> <leader>md :!mkdir -p %:p:h<CR>
+nnoremap <silent> <leader>md :!mkdir -p %:p:h<CR>
 
 " Some helpers to edit mode
 " http://vimcasts.org/e/14
-nmap <leader>ew :e <C-R>=expand('%:h').'/'<cr>
-nmap <leader>es :sp <C-R>=expand('%:h').'/'<cr>
-nmap <leader>ev :vsp <C-R>=expand('%:h').'/'<cr>
-nmap <leader>et :tabe <C-R>=expand('%:h').'/'<cr>
-nmap <leader>e :e <C-R>=expand("%:p:h") . "/" <CR>
+nnoremap <leader>ew :e <C-R>=expand('%:h').'/'<cr>
+nnoremap <leader>es :sp <C-R>=expand('%:h').'/'<cr>
+nnoremap <leader>ev :vsp <C-R>=expand('%:h').'/'<cr>
+nnoremap <leader>et :tabe <C-R>=expand('%:h').'/'<cr>
+nnoremap <leader>e :e <C-R>=expand("%:p:h") . "/" <CR>
 
 " Swap two words
-nmap <silent> gw :s/\(\%#\w\+\)\(\_W\+\)\(\w\+\)/\3\2\1/<CR>`'
+nnoremap <silent> gw :s/\(\%#\w\+\)\(\_W\+\)\(\w\+\)/\3\2\1/<CR>`'
 
 " Underline the current line with '='
-nmap <silent> <leader>ul :t.<CR>Vr=
+nnoremap <silent> <leader>ul :t.<CR>Vr=
 
 " set text wrapping toggles
-nmap <silent> <leader>tw :set invwrap<CR>:set wrap?<CR>
+nnoremap <silent> <leader>tw :set invwrap<CR>:set wrap?<CR>
 
 " find merge conflict markers
-nmap <silent> <leader>fc <ESC>/\v^[<=>]{7}( .*\|$)<CR>
+nnoremap <silent> <leader>fc <ESC>/\v^[<=>]{7}( .*\|$)<CR>
 
 " Map the arrow keys to be based on display lines, not physical lines
-map <Down> gj
-map <Up> gk
+noremap <Down> gj
+noremap <Up> gk
 
 " Toggle hlsearch with <leader>hs
-nmap <leader>hs :set hlsearch! hlsearch?<CR>
+nnoremap <leader>hs :set hlsearch! hlsearch?<CR>
 
 " Adjust viewports to the same size
-map <Leader>= <C-w>=
+noremap <Leader>= <C-w>=
 
 nnoremap <leader>ev :vsplit $MYVIMRC<cr>
 nnoremap <leader>sv :source $MYVIMRC<cr>
@@ -355,14 +347,11 @@ nnoremap H ^
 nnoremap L $
 " escape
 inoremap jk <esc>
-" inoremap <esc> <nop>
 nnoremap  <C-e> :e#<cr>
 nnoremap <localleader>f :Ack<space>
 " NERDComToggleComment
-nmap <localleader>/ <leader>c<space>
-vmap <localleader>/ <leader>c<space>
-" BufferGator
-"nnoremap <localleader>b :BuffergatorOpen<cr>
+nnoremap <localleader>/ <leader>c<space>
+vnoremap <localleader>/ <leader>c<space>
 " redraw the screen
 nnoremap <leader>f :redraw!<cr>
 
@@ -370,18 +359,12 @@ nnoremap <leader>f :redraw!<cr>
 nnoremap <leader>gs :Gstatus<cr>
 nnoremap <leader>gb :Gblame<cr>
 
-" ctags
-nnoremap <leader>T :!ctags -f tags -R<cr>
-
 " ruby refactorings
 nnoremap <leader>rap :RAddParameter<cr>
 nnoremap <leader>rit :RInlineTemp<cr>
 nnoremap <leader>rel :RExtractLet<cr>
 nnoremap <leader>rrlv :RRenameVariable<cr>
 
-" tagbar
-nnoremap <leader>tb :TagbarToggle<cr>
-nnoremap <C-p> :FZF<cr>
 
 " }}}}
 
@@ -390,7 +373,6 @@ nnoremap <C-p> :FZF<cr>
 
 if has("statusline") && !&cp
   set laststatus=2  " always show the status bar
-
   set statusline=%f                 " path to the file
   set statusline+=\ -\              " separator
   set statusline+=%y                " current file type
@@ -417,14 +399,9 @@ iabbrev @@ mo@mokhan.ca
 "" Plugin Configuration {{{{
 ""
 
-let g:ackprg = 'ag --nogroup --nocolor --column'
 let g:vroom_map_keys = 0
 let g:vroom_use_dispatch = 1
 
-if executable('ag')
-  set grepprg=ag\ --nogroup\ --nocolor " the silver searcher
-endif
-
 " dart-vim-plugin
 let dart_style_guide = 2
 let dart_format_on_save = 1