remove vim settings
This commit is contained in:
parent
2176946197
commit
854f93011a
@ -1,5 +0,0 @@
|
||||
" Auto open nerd tree on startup
|
||||
let g:nerdtree_tabs_open_on_gui_startup = 0
|
||||
" Focus in the main content window
|
||||
let g:nerdtree_tabs_focus_on_files = 1
|
||||
map <F6> :NERDTreeTabsToggle<CR>
|
@ -1,9 +0,0 @@
|
||||
This directory contains settings for various vim plugins and vim itself.
|
||||
|
||||
## Plugin Settings
|
||||
|
||||
Each plugin's overrides/settings should be put in a separate file named `{plugin-name}.vim`.
|
||||
|
||||
## Vim Settings
|
||||
|
||||
General vim overrides/settings should be put in a separate file named `yadr-{descriptive-name}.vim`.
|
@ -1,9 +0,0 @@
|
||||
"Abbreviations, trigger by typing the abbreviation and hitting space
|
||||
|
||||
abbr rlb Rails.logger.banner
|
||||
abbr rld Rails.logger.debug
|
||||
abbr pry! require 'pry'; binding.pry
|
||||
abbr cl! console.log( )<left><left>
|
||||
|
||||
" Rspec Before
|
||||
abbr rbf before { }<left><left>
|
@ -1,3 +0,0 @@
|
||||
" Open the Ag command and place the cursor into the quotes
|
||||
nmap ,ag :Ag ""<Left>
|
||||
nmap ,af :AgFile ""<Left>
|
@ -1,3 +0,0 @@
|
||||
" AutoTag
|
||||
" Seems to have problems with some vim files
|
||||
let g:autotagExcludeSuffixes="tml.xml.text.txt.vim"
|
@ -1,7 +0,0 @@
|
||||
map W <Plug>CamelCaseMotion_w
|
||||
map B <Plug>CamelCaseMotion_b
|
||||
map E <Plug>CamelCaseMotion_e
|
||||
|
||||
sunmap W
|
||||
sunmap B
|
||||
sunmap E
|
@ -1,74 +0,0 @@
|
||||
if exists("g:ctrlp_user_command")
|
||||
unlet g:ctrlp_user_command
|
||||
endif
|
||||
if executable('rg')
|
||||
" Use rg in CtrlP for listing files. Lightning fast and respects .gitignore
|
||||
let g:ctrlp_user_command = 'rg --hidden --files -g \!.git -g \!.DS_Store --smart-case %s'
|
||||
|
||||
" rg is fast enough that CtrlP doesn't need to cache
|
||||
let g:ctrlp_use_caching = 0
|
||||
elseif executable('ag')
|
||||
" Use ag in CtrlP for listing files. Lightning fast and respects .gitignore
|
||||
let g:ctrlp_user_command = 'ag %s --hidden --files-with-matches -g "" --ignore "\.git$\|\.hg$\|\.svn$"'
|
||||
|
||||
" ag is fast enough that CtrlP doesn't need to cache
|
||||
let g:ctrlp_use_caching = 0
|
||||
else
|
||||
" Fall back to using git ls-files if Ag is not available
|
||||
let g:ctrlp_custom_ignore = '\.git$\|\.hg$\|\.svn$'
|
||||
let g:ctrlp_user_command = ['.git', 'cd %s && git ls-files . --cached --exclude-standard --others']
|
||||
endif
|
||||
|
||||
" Default to filename searches - so that appctrl will find application
|
||||
" controller
|
||||
let g:ctrlp_by_filename = 1
|
||||
|
||||
let g:ctrlp_working_path_mode = 'ra'
|
||||
set wildignore+=*/tmp/*,*.so,*.swp,*.zip " MacOSX/Linux
|
||||
let g:ctrlp_custom_ignore = '\v[\/]\.(git|hg|svn)$'
|
||||
let g:ctrlp_custom_ignore = {
|
||||
\ 'dir': '\v[\/](\.git|\.hg|\.svn|node_modules)$',
|
||||
\ 'file': '\v\.(exe|so|dll)$',
|
||||
\ 'link': 'some_bad_symbolic_links',
|
||||
\ }
|
||||
|
||||
" show even .ssh/config file
|
||||
let g:ctrlp_show_hidden = 1
|
||||
|
||||
" Don't jump to already open window. This is annoying if you are maintaining
|
||||
" several Tab workspaces and want to open two windows into the same file.
|
||||
let g:ctrlp_switch_buffer = 0
|
||||
|
||||
" We don't want to use Ctrl-p as the mapping because
|
||||
" it interferes with YankRing (paste, then hit ctrl-p)
|
||||
let g:ctrlp_map = ',t'
|
||||
nnoremap <silent> ,t :CtrlP<CR>
|
||||
|
||||
" Additional mapping for buffer search
|
||||
nnoremap <silent> ,b :CtrlPBuffer<cr>
|
||||
|
||||
" Cmd-Shift-P to clear the cache
|
||||
nnoremap <silent> <D-P> :ClearCtrlPCache<cr>
|
||||
|
||||
" Idea from : http://www.charlietanksley.net/blog/blog/2011/10/18/vim-navigation-with-lustyexplorer-and-lustyjuggler/
|
||||
" Open CtrlP starting from a particular path, making it much
|
||||
" more likely to find the correct thing first. mnemonic 'jump to [something]'
|
||||
map ,ja :CtrlP app/assets<CR>
|
||||
map ,jm :CtrlP app/models<CR>
|
||||
map ,jc :CtrlP app/controllers<CR>
|
||||
map ,jv :CtrlP app/views<CR>
|
||||
map ,jj :CtrlP app/assets/javascripts<CR>
|
||||
map ,jh :CtrlP app/helpers<CR>
|
||||
map ,jl :CtrlP lib<CR>
|
||||
map ,jp :CtrlP public<CR>
|
||||
map ,js :CtrlP spec<CR>
|
||||
map ,jf :CtrlP fast_spec<CR>
|
||||
map ,jd :CtrlP db<CR>
|
||||
map ,jC :CtrlP config<CR>
|
||||
map ,jV :CtrlP vendor<CR>
|
||||
map ,jF :CtrlP factories<CR>
|
||||
map ,jT :CtrlP test<CR>
|
||||
|
||||
"Cmd-Shift-(M)ethod - jump to a method (tag in current file)
|
||||
"Ctrl-m is not good - it overrides behavior of Enter
|
||||
nnoremap <silent> <D-M> :CtrlPBufTag<CR>
|
@ -1 +0,0 @@
|
||||
nnoremap <leader><C-K> :Gsearch<CR>
|
@ -1,8 +0,0 @@
|
||||
" These keys are easier to type than the default set
|
||||
" We exclude semicolon because it's hard to read and
|
||||
" i and l are too easy to mistake for each other slowing
|
||||
" down recognition. The home keys and the immediate keys
|
||||
" accessible by middle fingers are available
|
||||
let g:EasyMotion_keys='asdfjkoweriop'
|
||||
nmap ,<ESC> ,,w
|
||||
nmap ,<S-ESC> ,,b
|
@ -1,6 +0,0 @@
|
||||
" Support for github flavored markdown
|
||||
" via https://github.com/jtratner/vim-flavored-markdown
|
||||
augroup markdown
|
||||
au!
|
||||
au BufNewFile,BufRead *.md,*.markdown setlocal filetype=ghmarkdown
|
||||
augroup END
|
@ -1,56 +0,0 @@
|
||||
let g:go_fmt_fail_silently = 1
|
||||
let g:go_fmt_command = "gofmt" "Explicited the formater plugin (gofmt, goimports, goreturn...)
|
||||
|
||||
" Show a list of interfaces which is implemented by the type under your cursor
|
||||
au FileType go nmap <Leader>s <Plug>(go-implements)
|
||||
|
||||
" Show type info for the word under your cursor
|
||||
au FileType go nmap <Leader>i <Plug>(go-info)
|
||||
|
||||
" Open the relevant Godoc for the word under the cursor
|
||||
au FileType go nmap <Leader>gd <Plug>(go-doc)
|
||||
au FileType go nmap <Leader>gv <Plug>(go-doc-vertical)
|
||||
|
||||
" Open the Godoc in browser
|
||||
au FileType go nmap <Leader>gb <Plug>(go-doc-browser)
|
||||
|
||||
" Run/build/test/coverage
|
||||
au FileType go nmap <leader>gr <Plug>(go-run)
|
||||
au FileType go nmap <leader>gb <Plug>(go-build)
|
||||
au FileType go nmap <leader>gt <Plug>(go-test)
|
||||
au FileType go nmap <leader>gc <Plug>(go-coverage)
|
||||
|
||||
" By default syntax-highlighting for Functions, Methods and Structs is disabled.
|
||||
" Let's enable them!
|
||||
let g:go_highlight_functions = 1
|
||||
let g:go_highlight_methods = 1
|
||||
let g:go_highlight_structs = 1
|
||||
|
||||
nmap <F8> :TagbarToggle<CR>
|
||||
let g:tagbar_type_go = {
|
||||
\ 'ctagstype' : 'go',
|
||||
\ 'kinds' : [
|
||||
\ 'p:package',
|
||||
\ 'i:imports:1',
|
||||
\ 'c:constants',
|
||||
\ 'v:variables',
|
||||
\ 't:types',
|
||||
\ 'n:interfaces',
|
||||
\ 'w:fields',
|
||||
\ 'e:embedded',
|
||||
\ 'm:methods',
|
||||
\ 'r:constructor',
|
||||
\ 'f:functions'
|
||||
\ ],
|
||||
\ 'sro' : '.',
|
||||
\ 'kind2scope' : {
|
||||
\ 't' : 'ctype',
|
||||
\ 'n' : 'ntype'
|
||||
\ },
|
||||
\ 'scope2kind' : {
|
||||
\ 'ctype' : 't',
|
||||
\ 'ntype' : 'n'
|
||||
\ },
|
||||
\ 'ctagsbin' : 'gotags',
|
||||
\ 'ctagsargs' : '-sort -silent'
|
||||
\ }
|
@ -1,6 +0,0 @@
|
||||
" Automatically jump to a file at the correct line number
|
||||
" i.e. if your cursor is over /some/path.rb:50 then using 'gf' on it will take
|
||||
" you to that line
|
||||
|
||||
" use ,gf to go to file in a vertical split
|
||||
nnoremap <silent> ,gf :vertical botright wincmd F<CR>
|
@ -1,4 +0,0 @@
|
||||
"Use RipGrep for lightning fast Gsearch command
|
||||
set grepprg=rg\ --vimgrep\ --no-heading
|
||||
set grepformat=%f:%l:%c:%m,%f:%l:%m
|
||||
let g:grep_cmd_opts = '--line-number'
|
@ -1,7 +0,0 @@
|
||||
nmap ,u :GundoToggle<CR>
|
||||
|
||||
" open on the right so as not to compete with the nerdtree
|
||||
let g:gundo_right = 1
|
||||
|
||||
" a little wider for wider screens
|
||||
let g:gundo_width = 60
|
@ -1,6 +0,0 @@
|
||||
nnoremap ,rs :RunItermSpec<cr>
|
||||
nnoremap ,rl :RunItermSpecLine<cr>
|
||||
nnoremap ,ss :RunItermSpringSpec<cr>
|
||||
nnoremap ,sl :RunItermSpringSpecLine<cr>
|
||||
nnoremap zl :RunItermZeusSpecLine<cr>
|
||||
nnoremap zs :RunItermZeusSpec<cr>
|
@ -1,29 +0,0 @@
|
||||
let javascript_enable_domhtmlcss = 0
|
||||
let javascript_ignore_javaScriptdoc = 0
|
||||
let g:javascript_conceal=0
|
||||
let b:javascript_fold=1
|
||||
|
||||
function! IndexComponentSwitch()
|
||||
let b:filename=expand('%')
|
||||
if b:filename =~ 'index\.js$'
|
||||
execute 'edit' substitute(b:filename, "index.js", "component.js", "")
|
||||
else
|
||||
execute 'edit' substitute(b:filename, "component.js", "index.js", "")
|
||||
endif
|
||||
endfunction
|
||||
|
||||
au FileType javascript nmap <leader>s :call IndexComponentSwitch()<cr>
|
||||
|
||||
let g:javascript_conceal_function = "ƒ"
|
||||
let g:javascript_conceal_null = "ø"
|
||||
let g:javascript_conceal_this = "@"
|
||||
let g:javascript_conceal_return = "⇚"
|
||||
let g:javascript_conceal_undefined = "¿"
|
||||
let g:javascript_conceal_NaN = "ℕ"
|
||||
let g:javascript_conceal_prototype = "¶"
|
||||
let g:javascript_conceal_static = "•"
|
||||
let g:javascript_conceal_super = "Ω"
|
||||
let g:javascript_conceal_arrow_function = "⇒"
|
||||
let g:javascript_conceal_noarg_arrow_function = "🞅"
|
||||
let g:javascript_conceal_underscore_arrow_function = "🞅"
|
||||
map <leader>c :exec &conceallevel ? "set conceallevel=0" : "set conceallevel=1"<CR>
|
@ -1,40 +0,0 @@
|
||||
let g:lightline = {
|
||||
\ 'colorscheme': 'solarized',
|
||||
\ 'active': {
|
||||
\ 'left': [ [ 'mode', 'paste' ],
|
||||
\ [ 'fugitive', 'readonly', 'filename', 'modified' ] ]
|
||||
\ },
|
||||
\ 'component_function': {
|
||||
\ 'fugitive': 'MyFugitive',
|
||||
\ 'readonly': 'MyReadonly',
|
||||
\ 'filename': 'MyFilename',
|
||||
\ },
|
||||
\ 'separator': { 'left': '⮀', 'right': '⮂' },
|
||||
\ 'subseparator': { 'left': '⮁', 'right': '⮃' }
|
||||
\ }
|
||||
|
||||
function! MyReadonly()
|
||||
if &filetype == "help"
|
||||
return ""
|
||||
elseif &readonly
|
||||
return "⭤ "
|
||||
else
|
||||
return ""
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! MyFugitive()
|
||||
if exists("*fugitive#head")
|
||||
let _ = fugitive#head()
|
||||
return strlen(_) ? '⭠ '._ : ''
|
||||
endif
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
function! MyFilename()
|
||||
return ('' != MyReadonly() ? MyReadonly() . ' ' : '') .
|
||||
\ ('' != expand('%') ? expand('%') : '[NoName]')
|
||||
endfunction
|
||||
|
||||
" Use status bar even with single buffer
|
||||
set laststatus=2
|
@ -1,9 +0,0 @@
|
||||
let g:instant_markdown_slow = 1
|
||||
let g:instant_markdown_autostart = 1
|
||||
augroup filetype_markdown
|
||||
autocmd!
|
||||
autocmd FileType mkd setlocal spell
|
||||
autocmd FileType mkd setlocal sw=2 ts=2
|
||||
autocmd BufNewFile,BufReadPost *.md set filetype=markdown
|
||||
let g:vim_markdown_initial_foldlevel=1
|
||||
augroup END
|
@ -1,136 +0,0 @@
|
||||
" Stolen from Steve Losh
|
||||
" https://github.com/sjl/dotfiles/blob/master/vim/vimrc#L1380
|
||||
"
|
||||
" Motion for "next/last object". "Last" here means "previous", not "final".
|
||||
" Unfortunately the "p" motion was already taken for paragraphs.
|
||||
"
|
||||
" Next acts on the next object of the given type, last acts on the previous
|
||||
" object of the given type. These don't necessarily have to be in the current
|
||||
" line.
|
||||
"
|
||||
" Currently works for (, [, {, and their shortcuts b, r, B.
|
||||
"
|
||||
" Next kind of works for ' and " as long as there are no escaped versions of
|
||||
" them in the string (TODO: fix that). Last is currently broken for quotes
|
||||
" (TODO: fix that).
|
||||
"
|
||||
" Some examples (C marks cursor positions, V means visually selected):
|
||||
"
|
||||
" din' -> delete in next single quotes foo = bar('spam')
|
||||
" C
|
||||
" foo = bar('')
|
||||
" C
|
||||
"
|
||||
" canb -> change around next parens foo = bar('spam')
|
||||
" C
|
||||
" foo = bar
|
||||
" C
|
||||
"
|
||||
" vin" -> select inside next double quotes print "hello ", name
|
||||
" C
|
||||
" print "hello ", name
|
||||
" VVVVVV
|
||||
|
||||
onoremap an :<c-u>call <SID>NextTextObject('a', '/')<cr>
|
||||
xnoremap an :<c-u>call <SID>NextTextObject('a', '/')<cr>
|
||||
onoremap in :<c-u>call <SID>NextTextObject('i', '/')<cr>
|
||||
xnoremap in :<c-u>call <SID>NextTextObject('i', '/')<cr>
|
||||
|
||||
onoremap al :<c-u>call <SID>NextTextObject('a', '?')<cr>
|
||||
xnoremap al :<c-u>call <SID>NextTextObject('a', '?')<cr>
|
||||
onoremap il :<c-u>call <SID>NextTextObject('i', '?')<cr>
|
||||
xnoremap il :<c-u>call <SID>NextTextObject('i', '?')<cr>
|
||||
|
||||
|
||||
function! s:NextTextObject(motion, dir)
|
||||
let c = nr2char(getchar())
|
||||
let d = ''
|
||||
|
||||
if c ==# "b" || c ==# "(" || c ==# ")"
|
||||
let c = "("
|
||||
elseif c ==# "B" || c ==# "{" || c ==# "}"
|
||||
let c = "{"
|
||||
elseif c ==# "r" || c ==# "[" || c ==# "]"
|
||||
let c = "["
|
||||
elseif c ==# "'"
|
||||
let c = "'"
|
||||
elseif c ==# '"'
|
||||
let c = '"'
|
||||
else
|
||||
return
|
||||
endif
|
||||
|
||||
" Find the next opening-whatever.
|
||||
execute "normal! " . a:dir . c . "\<cr>"
|
||||
|
||||
if a:motion ==# 'a'
|
||||
" If we're doing an 'around' method, we just need to select around it
|
||||
" and we can bail out to Vim.
|
||||
execute "normal! va" . c
|
||||
else
|
||||
" Otherwise we're looking at an 'inside' motion. Unfortunately these
|
||||
" get tricky when you're dealing with an empty set of delimiters because
|
||||
" Vim does the wrong thing when you say vi(.
|
||||
|
||||
let open = ''
|
||||
let close = ''
|
||||
|
||||
if c ==# "("
|
||||
let open = "("
|
||||
let close = ")"
|
||||
elseif c ==# "{"
|
||||
let open = "{"
|
||||
let close = "}"
|
||||
elseif c ==# "["
|
||||
let open = "\\["
|
||||
let close = "\\]"
|
||||
elseif c ==# "'"
|
||||
let open = "'"
|
||||
let close = "'"
|
||||
elseif c ==# '"'
|
||||
let open = '"'
|
||||
let close = '"'
|
||||
endif
|
||||
|
||||
" We'll start at the current delimiter.
|
||||
let start_pos = getpos('.')
|
||||
let start_l = start_pos[1]
|
||||
let start_c = start_pos[2]
|
||||
|
||||
" Then we'll find it's matching end delimiter.
|
||||
if c ==# "'" || c ==# '"'
|
||||
" searchpairpos() doesn't work for quotes, because fuck me.
|
||||
let end_pos = searchpos(open)
|
||||
else
|
||||
let end_pos = searchpairpos(open, '', close)
|
||||
endif
|
||||
|
||||
let end_l = end_pos[0]
|
||||
let end_c = end_pos[1]
|
||||
|
||||
call setpos('.', start_pos)
|
||||
|
||||
if start_l == end_l && start_c == (end_c - 1)
|
||||
" We're in an empty set of delimiters. We'll append an "x"
|
||||
" character and select that so most Vim commands will do something
|
||||
" sane. v is gonna be weird, and so is y. Oh well.
|
||||
execute "normal! ax\<esc>\<left>"
|
||||
execute "normal! vi" . c
|
||||
elseif start_l == end_l && start_c == (end_c - 2)
|
||||
" We're on a set of delimiters that contain a single, non-newline
|
||||
" character. We can just select that and we're done.
|
||||
execute "normal! vi" . c
|
||||
else
|
||||
" Otherwise these delimiters contain something. But we're still not
|
||||
" sure Vim's gonna work, because if they contain nothing but
|
||||
" newlines Vim still does the wrong thing. So we'll manually select
|
||||
" the guts ourselves.
|
||||
let whichwrap = &whichwrap
|
||||
set whichwrap+=h,l
|
||||
|
||||
execute "normal! va" . c . "hol"
|
||||
|
||||
let &whichwrap = whichwrap
|
||||
endif
|
||||
endif
|
||||
endfunction
|
@ -1,20 +0,0 @@
|
||||
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
" OpenChangedFiles COMMAND
|
||||
" Open a split for each dirty file in git
|
||||
"
|
||||
" Shamelessly stolen from Gary Bernhardt: https://github.com/garybernhardt/dotfiles
|
||||
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
function! OpenChangedFiles()
|
||||
only " Close all windows, unless they're modified
|
||||
let status = system('git status -s | grep "^ \?\(M\|A\)" | cut -d " " -f 3')
|
||||
let filenames = split(status, "\n")
|
||||
if len(filenames) > 0
|
||||
exec "edit " . filenames[0]
|
||||
for filename in filenames[1:]
|
||||
exec "sp " . filename
|
||||
endfor
|
||||
end
|
||||
endfunction
|
||||
command! OpenChangedFiles :call OpenChangedFiles()
|
||||
|
||||
nnoremap ,ocf :OpenChangedFiles<CR>
|
@ -1,13 +0,0 @@
|
||||
" Navigate to the block surrounding this one
|
||||
" For example if you're inside
|
||||
" foo do
|
||||
" bar do
|
||||
" # you are here
|
||||
" end
|
||||
" end
|
||||
"
|
||||
" Then hitting ,orb ("outer ruby block") will take you to 'foo do'
|
||||
"
|
||||
" This is relying on the textobj-rubyblock which gives us 'ar' around ruby
|
||||
" and matchit.vim which gives us jumping to the matching
|
||||
nnoremap <silent> ,orb :normal varar%<esc><esc>
|
@ -1,12 +0,0 @@
|
||||
" Set the shell to bash so we inherit its path, to make sure
|
||||
" we inherit its path. This affects :Rtags finding the right
|
||||
" path to homebrewed ctags rather than the XCode version of ctags
|
||||
if has("unix")
|
||||
let s:uname = system("uname -s")
|
||||
if s:uname =~ "Darwin"
|
||||
set shell=/usr/local/bin/zsh
|
||||
else
|
||||
set shell=/usr/bin/zsh
|
||||
endif
|
||||
elseif has('win32')
|
||||
endif
|
@ -1,24 +0,0 @@
|
||||
" Override go-to.definition key shortcut to Ctrl-]
|
||||
autocmd FileType python set colorcolumn=160
|
||||
let g:pymode_rope_goto_definition_bind = "<C-]>"
|
||||
|
||||
" Override run current python file key shortcut to Ctrl-Shift-e
|
||||
let g:pymode_run_bind = "<C-S-e>"
|
||||
|
||||
" Override view python doc key shortcut to Ctrl-Shift-d
|
||||
let g:pymode_doc_bind = "<C-S-d>"
|
||||
let g:pymode_lint_ignore = "W0611"
|
||||
let g:pymode_options_max_line_length=160
|
||||
let g:pymode_rope_lookup_project = 0
|
||||
|
||||
augroup filetype_python
|
||||
autocmd!
|
||||
"autocmd FileType python set omnifunc=pythoncomplete#Complete
|
||||
autocmd FileType python setlocal foldmethod=indent
|
||||
autocmd FileType python nnoremap <F12> :execute "!./" . expand("%") <CR>
|
||||
autocmd FileType python setlocal foldlevel=99
|
||||
autocmd FileType python setlocal statusline=%f-%y-[%l]/[%L]
|
||||
autocmd FileType python nnoremap <buffer> <localleader>c I#cesc>
|
||||
autocmd FileType python :iabbrev <buffer> iff if:<left>
|
||||
autocmd FileType python set nowrap
|
||||
augroup END
|
@ -1,4 +0,0 @@
|
||||
autocmd FileType python set shiftwidth=4
|
||||
autocmd FileType python set tabstop=4
|
||||
autocmd FileType python set softtabstop=4
|
||||
autocmd FileType python set expandtab
|
@ -1,6 +0,0 @@
|
||||
" Stolen from Steve Losh vimrc: https://bitbucket.org/sjl/dotfiles/src/tip/vim/.vimrc
|
||||
" Open a Quickfix window for the last search.
|
||||
nnoremap <silent> <leader>q/ :execute 'vimgrep /'.@/.'/g %'<CR>:copen<CR>
|
||||
|
||||
" Ag for the last search.
|
||||
nnoremap <silent> <leader>qa/ :execute "Ag! '" . substitute(substitute(substitute(@/, "\\\\<", "\\\\b", ""), "\\\\>", "\\\\b", ""), "\\\\v", "", "") . "'"<CR>
|
@ -1,4 +0,0 @@
|
||||
" Better key maps for switching between controller and view
|
||||
nnoremap ,vv :Eview<cr>
|
||||
nnoremap ,cc :Econtroller<cr>
|
||||
nnoremap ,hc :%s/:\([^=,'"]*\) =>/\1:/gc<cr>
|
@ -1,3 +0,0 @@
|
||||
" Open the Rg command and place the cursor into the quotes
|
||||
nmap ,rg :Rg ""<Left>
|
||||
nmap ,rf :Rg --files ""<Left>
|
@ -1,29 +0,0 @@
|
||||
" Does not work on pending 'blocks', only single lines
|
||||
"
|
||||
" Given:
|
||||
" it "foo bar" do
|
||||
" pending("bla bla"
|
||||
"
|
||||
" Produce:
|
||||
" xit "foo bar" do
|
||||
"
|
||||
function! ChangePendingRspecToXit()
|
||||
" Find the next occurrence of pending
|
||||
while(search("pending(") > 0)
|
||||
" Delete it
|
||||
normal dd
|
||||
" Search backwards to the it block
|
||||
?it\s
|
||||
" add an 'x' to the 'it' to make it 'xit'
|
||||
normal ix
|
||||
endwhile
|
||||
endfunction
|
||||
|
||||
nnoremap <silent> ,rxit :call ChangePendingRspecToXit()<cr>
|
||||
|
||||
" insert a before { } block around a line
|
||||
nnoremap <silent> \bf ^ibefore { <esc>$a }
|
||||
|
||||
" insert a specify { } block around a line
|
||||
nnoremap <silent> \sp ^ispecify { <esc>$a }
|
||||
|
@ -1,30 +0,0 @@
|
||||
function! GetVisual()
|
||||
let reg_save = getreg('"')
|
||||
let regtype_save = getregtype('"')
|
||||
let cb_save = &clipboard
|
||||
set clipboard&
|
||||
normal! ""gvy
|
||||
let selection = getreg('"')
|
||||
call setreg('"', reg_save, regtype_save)
|
||||
let &clipboard = cb_save
|
||||
return selection
|
||||
endfunction
|
||||
|
||||
"grep the current word using ,k (mnemonic Kurrent)
|
||||
nnoremap <silent> ,k :Ag <cword><CR>
|
||||
|
||||
"grep visual selection
|
||||
vnoremap ,k :<C-U>execute "Ag " . GetVisual()<CR>
|
||||
|
||||
"grep current word up to the next exclamation point using ,K
|
||||
nnoremap ,K viwf!:<C-U>execute "Ag " . GetVisual()<CR>
|
||||
|
||||
"grep for 'def foo'
|
||||
nnoremap <silent> ,gd :Ag 'def <cword>'<CR>
|
||||
|
||||
",gg = Grep! - using Ag the silver searcher
|
||||
" open up a grep line, with a quote started for the search
|
||||
nnoremap ,gg :Ag ""<left>
|
||||
|
||||
"Grep for usages of the current file
|
||||
nnoremap ,gcf :exec "Ag " . expand("%:t:r")<CR>
|
@ -1,2 +0,0 @@
|
||||
" Tell showmarks to not include the various brace marks (),{}, etc
|
||||
let g:showmarks_include = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXY"
|
@ -1,6 +0,0 @@
|
||||
" hit ,f to find the definition of the current class
|
||||
" this uses ctags. the standard way to get this is Ctrl-]
|
||||
nnoremap <silent> ,f <C-]>
|
||||
|
||||
" use ,F to jump to tag in a vertical split
|
||||
nnoremap <silent> ,F :let word=expand("<cword>")<CR>:vsp<CR>:wincmd w<cr>:exec("tag ". word)<cr>
|
@ -1 +0,0 @@
|
||||
nmap <Space> <Plug>SneakForward
|
@ -1,12 +0,0 @@
|
||||
" via: http://whynotwiki.com/Vim
|
||||
" Ruby
|
||||
" Use v or # to get a variable interpolation (inside of a string)}
|
||||
" ysiw# Wrap the token under the cursor in #{}
|
||||
" v...s# Wrap the selection in #{}
|
||||
let g:surround_113 = "#{\r}" " v
|
||||
let g:surround_35 = "#{\r}" " #
|
||||
|
||||
" Select text in an ERb file with visual mode and then press s- or s=
|
||||
" Or yss- to do entire line.
|
||||
let g:surround_45 = "<% \r %>" " -
|
||||
let g:surround_61 = "<%= \r %>" " =
|
@ -1,35 +0,0 @@
|
||||
set statusline+=%#warningmsg#
|
||||
set statusline+=%{SyntasticStatuslineFlag()}
|
||||
set statusline+=%*
|
||||
|
||||
let g:syntastic_aggregate_errors = 1
|
||||
let g:syntastic_always_populate_loc_list = 0
|
||||
let g:syntastic_auto_jump=0 "automatically jump to the error when saving the file
|
||||
let g:syntastic_auto_loc_list=1 "show the error list automatically
|
||||
let g:syntastic_check_on_open = 1
|
||||
let g:syntastic_check_on_wq = 0
|
||||
let g:syntastic_enable_signs=1 "mark syntax errors with :signs
|
||||
let g:syntastic_quiet_messages = {'level': 'warnings'} "don't care about warnings
|
||||
|
||||
" Default to eslint. If you need jshint, you can override this in
|
||||
" ~/.vimrc.after
|
||||
let g:syntastic_javascript_checkers = ['eslint']
|
||||
let g:syntastic_python_checkers = ['flake8']
|
||||
let g:syntastic_python_flake8_args='--ignore=F401,F403,F405,W0401,E501'
|
||||
let g:syntastic_python_pylint_post_args="--max-line-length=160"
|
||||
let g:syntastic_go_checkers = ['go', 'golint', 'errcheck']
|
||||
|
||||
" I have no idea why this is not working, as it used to
|
||||
" be a part of syntastic code but was apparently removed
|
||||
" This will make syntastic find the correct ruby specified by mri
|
||||
function! s:FindRubyExec()
|
||||
if executable("rvm")
|
||||
return system("rvm tools identifier")
|
||||
endif
|
||||
|
||||
return "ruby"
|
||||
endfunction
|
||||
|
||||
if !exists("g:syntastic_ruby_exec")
|
||||
let g:syntastic_ruby_exec = s:FindRubyExec()
|
||||
endif
|
@ -1,8 +0,0 @@
|
||||
" tComment
|
||||
" ========================================
|
||||
" extensions for tComment plugin. Normally
|
||||
" tComment maps 'gcc' to comment current line
|
||||
" this adds 'gcp' comment current paragraph (block)
|
||||
" using tComment's built in <c-_>p mapping
|
||||
nmap <silent> gcp <c-_>p
|
||||
|
@ -1 +0,0 @@
|
||||
nmap <F4> :TagbarToggle<CR>
|
@ -1 +0,0 @@
|
||||
:vmap ,gt :!tidy -q -i --show-errors 0<CR>
|
@ -1,6 +0,0 @@
|
||||
let g:UltiSnipsExpandTrigger="<C-e>"
|
||||
let g:UltiSnipsJumpForwardTrigger="<C-e>"
|
||||
let g:UltiSnipsJumpBackwardTrigger="<C-S-e>"
|
||||
" If you want :UltiSnipsEdit to split your window.
|
||||
let g:UltiSnipsEditSplit="vertical"
|
||||
nmap <localleader>ue :UltiSnipsEdit<cr>
|
@ -1,10 +0,0 @@
|
||||
" https://github.com/carlhuda/janus/blob/master/vimrc
|
||||
|
||||
" Unimpaired configuration
|
||||
" Bubble single lines
|
||||
nmap <C-Up> [e
|
||||
nmap <C-Down> ]e
|
||||
|
||||
" Bubble multiple lines
|
||||
vmap <C-Up> [egv
|
||||
vmap <C-Down> ]egv
|
@ -1,14 +0,0 @@
|
||||
" The tree buffer makes it easy to drill down through the directories of your
|
||||
" git repository, but it’s not obvious how you could go up a level to the
|
||||
" parent directory. Here’s a mapping of .. to the above command, but
|
||||
" only for buffers containing a git blob or tree
|
||||
autocmd User fugitive
|
||||
\ if get(b:, 'fugitive_type', '') =~# '^\%(tree\|blob\)$' |
|
||||
\ nnoremap <buffer> .. :edit %:h<CR> |
|
||||
\ endif
|
||||
|
||||
" Every time you open a git object using fugitive it creates a new buffer.
|
||||
" This means that your buffer listing can quickly become swamped with
|
||||
" fugitive buffers. This prevents this from becomming an issue:
|
||||
|
||||
autocmd BufReadPost fugitive://* set bufhidden=delete
|
@ -1,4 +0,0 @@
|
||||
nmap <Leader>hn <Plug>GitGutterNextHunk
|
||||
nmap <Leader>hp <Plug>GitGutterPrevHunk
|
||||
nmap <Leader>ha <Plug>GitGutterStageHunk
|
||||
nmap <Leader>hr <Plug>GitGutterUndoHunk
|
@ -1,3 +0,0 @@
|
||||
let g:indent_guides_auto_colors = 1
|
||||
let g:indent_guides_start_level = 2
|
||||
let g:indent_guides_guide_size = 1
|
@ -1,13 +0,0 @@
|
||||
" Turn off default key mappings
|
||||
let g:multi_cursor_use_default_mapping=0
|
||||
|
||||
" Switch to multicursor mode with ,mc
|
||||
let g:multi_cursor_start_key=',mc'
|
||||
|
||||
" Ctrl-n, Ctrl-p, Ctrl-x, and <Esc> are mapped in the special multicursor
|
||||
" mode once you've added at least one virtual cursor to the buffer
|
||||
let g:multi_cursor_next_key='<C-n>'
|
||||
let g:multi_cursor_prev_key='<C-p>'
|
||||
let g:multi_cursor_skip_key='<C-x>'
|
||||
let g:multi_cursor_quit_key='<Esc>'
|
||||
|
@ -1,4 +0,0 @@
|
||||
" Prevent vim-session from asking us to load the session.
|
||||
" If you want to load the session, use :SaveSession and :OpenSession
|
||||
let g:session_autosave = 'no'
|
||||
let g:session_autoload = 'no'
|
@ -1,10 +0,0 @@
|
||||
" Don't allow any default key-mappings.
|
||||
let g:tmux_navigator_no_mappings = 1
|
||||
|
||||
" Re-enable tmux_navigator.vim default bindings, minus <c-\>.
|
||||
" <c-\> conflicts with NERDTree "current file".
|
||||
|
||||
nnoremap <silent> <c-h> :TmuxNavigateLeft<cr>
|
||||
nnoremap <silent> <c-j> :TmuxNavigateDown<cr>
|
||||
nnoremap <silent> <c-k> :TmuxNavigateUp<cr>
|
||||
nnoremap <silent> <c-l> :TmuxNavigateRight<cr>
|
@ -1,33 +0,0 @@
|
||||
" Make it beautiful - colors and fonts
|
||||
|
||||
if has("gui_running")
|
||||
"tell the term has 256 colors
|
||||
set t_Co=256
|
||||
set guioptions-=T
|
||||
set guioptions-=e
|
||||
|
||||
" Show tab number (useful for Cmd-1, Cmd-2.. mapping)
|
||||
" For some reason this doesn't work as a regular set command,
|
||||
" (the numbers don't show up) so I made it a VimEnter event
|
||||
autocmd VimEnter * set guitablabel=%N:\ %t\ %M
|
||||
|
||||
set lines=60
|
||||
set columns=190
|
||||
|
||||
if has("gui_gtk2")
|
||||
set guifont=Inconsolata\ XL\ 12,Inconsolata\ 15,Monaco\ 12
|
||||
else
|
||||
set guifont=Inconsolata\ XL:h17,Inconsolata:h20,Monaco:h17
|
||||
end
|
||||
else
|
||||
let g:CSApprox_loaded = 1
|
||||
|
||||
" For people using a terminal that is not Solarized
|
||||
if exists("g:yadr_using_unsolarized_terminal")
|
||||
let g:solarized_termcolors=256
|
||||
let g:solarized_termtrans=1
|
||||
end
|
||||
endif
|
||||
|
||||
colorscheme solarized
|
||||
set background=dark
|
@ -1,6 +0,0 @@
|
||||
" Disable the scrollbars (NERDTree)
|
||||
set guioptions-=r
|
||||
set guioptions-=L
|
||||
|
||||
" Disable the macvim toolbar
|
||||
set guioptions-=T
|
@ -1,75 +0,0 @@
|
||||
" ========================================
|
||||
" Linux specific General vim sanity improvements
|
||||
" ========================================
|
||||
"
|
||||
" ========================================
|
||||
" 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 Alt-k or Alt-d, and add Shift
|
||||
" to type dashes
|
||||
imap <silent> <A-k> _
|
||||
imap <silent> <A-d> _
|
||||
imap <silent> <A-K> -
|
||||
imap <silent> <A-D> -
|
||||
|
||||
" Change inside various enclosures with Alt-" and Alt-'
|
||||
" The f makes it find the enclosure so you don't have
|
||||
" to be standing inside it
|
||||
nnoremap <A-'> f'ci'
|
||||
nnoremap <A-"> f"ci"
|
||||
nnoremap <A-(> f(ci(
|
||||
nnoremap <A-)> f)ci)
|
||||
nnoremap <A-[> f[ci[
|
||||
nnoremap <A-]> f]ci]
|
||||
|
||||
" ==== NERD tree
|
||||
" Alt-Shift-N for nerd tree
|
||||
nmap <A-N> :NERDTreeToggle<CR>
|
||||
|
||||
" move up/down quickly by using Alt-j, Alt-k
|
||||
" which will move us around by functions
|
||||
nnoremap <silent> <A-j> }
|
||||
nnoremap <silent> <A-k> {
|
||||
autocmd FileType ruby map <buffer> <A-j> ]m
|
||||
autocmd FileType ruby map <buffer> <A-k> [m
|
||||
autocmd FileType rspec map <buffer> <A-j> }
|
||||
autocmd FileType rspec map <buffer> <A-k> {
|
||||
autocmd FileType javascript map <buffer> <A-k> }
|
||||
autocmd FileType javascript map <buffer> <A-j> {
|
||||
|
||||
" Command-/ to toggle comments
|
||||
map <A-/> :TComment<CR>
|
||||
imap <A-/> <Esc>:TComment<CR>i
|
||||
|
||||
" Use Alt- numbers to pick the tab you want
|
||||
map <silent> <A-1> :tabn 1<cr>
|
||||
map <silent> <A-2> :tabn 2<cr>
|
||||
map <silent> <A-3> :tabn 3<cr>
|
||||
map <silent> <A-4> :tabn 4<cr>
|
||||
map <silent> <A-5> :tabn 5<cr>
|
||||
map <silent> <A-6> :tabn 6<cr>
|
||||
map <silent> <A-7> :tabn 7<cr>
|
||||
map <silent> <A-8> :tabn 8<cr>
|
||||
map <silent> <A-9> :tabn 9<cr>
|
||||
|
||||
" Resize windows with arrow keys
|
||||
nnoremap <C-Up> <C-w>+
|
||||
nnoremap <C-Down> <C-w>-
|
||||
nnoremap <C-Left> <C-w><
|
||||
nnoremap <C-Right> <C-w>>
|
||||
|
||||
" ============================
|
||||
" Tabularize - alignment
|
||||
" ============================
|
||||
" Hit Alt-Shift-A then type a character you want to align by
|
||||
nmap <A-A> :Tabularize /
|
||||
vmap <A-A> :Tabularize /
|
||||
|
||||
" Source current file Alt-% (good for vim development)
|
||||
map <A-%> :so %<CR>
|
@ -1,75 +0,0 @@
|
||||
" ========================================
|
||||
" Mac specific General vim sanity improvements
|
||||
" ========================================
|
||||
"
|
||||
" ========================================
|
||||
" 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 <silent> <D-k> _
|
||||
imap <silent> <D-d> _
|
||||
imap <silent> <D-K> -
|
||||
imap <silent> <D-D> -
|
||||
|
||||
" 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 <D-'> f'ci'
|
||||
nnoremap <D-"> f"ci"
|
||||
nnoremap <D-(> f(ci(
|
||||
nnoremap <D-)> f)ci)
|
||||
nnoremap <D-[> f[ci[
|
||||
nnoremap <D-]> f]ci]
|
||||
|
||||
" ==== NERD tree
|
||||
" Cmd-Shift-N for nerd tree
|
||||
nmap <D-N> :NERDTreeToggle<CR>
|
||||
|
||||
" move up/down quickly by using Cmd-j, Cmd-k
|
||||
" which will move us around by functions
|
||||
nnoremap <silent> <D-j> }
|
||||
nnoremap <silent> <D-k> {
|
||||
autocmd FileType ruby map <buffer> <D-j> ]m
|
||||
autocmd FileType ruby map <buffer> <D-k> [m
|
||||
autocmd FileType rspec map <buffer> <D-j> }
|
||||
autocmd FileType rspec map <buffer> <D-k> {
|
||||
autocmd FileType javascript map <buffer> <D-k> }
|
||||
autocmd FileType javascript map <buffer> <D-j> {
|
||||
|
||||
" Command-/ to toggle comments
|
||||
map <D-/> :TComment<CR>
|
||||
imap <D-/> <Esc>:TComment<CR>i
|
||||
|
||||
" Use numbers to pick the tab you want (like iTerm)
|
||||
map <silent> <D-1> :tabn 1<cr>
|
||||
map <silent> <D-2> :tabn 2<cr>
|
||||
map <silent> <D-3> :tabn 3<cr>
|
||||
map <silent> <D-4> :tabn 4<cr>
|
||||
map <silent> <D-5> :tabn 5<cr>
|
||||
map <silent> <D-6> :tabn 6<cr>
|
||||
map <silent> <D-7> :tabn 7<cr>
|
||||
map <silent> <D-8> :tabn 8<cr>
|
||||
map <silent> <D-9> :tabn 9<cr>
|
||||
|
||||
" Resize windows with arrow keys
|
||||
nnoremap <D-Up> <C-w>+
|
||||
nnoremap <D-Down> <C-w>-
|
||||
nnoremap <D-Left> <C-w><
|
||||
nnoremap <D-Right> <C-w>>
|
||||
|
||||
" ============================
|
||||
" Tabularize - alignment
|
||||
" ============================
|
||||
" Hit Cmd-Shift-A then type a character you want to align by
|
||||
nmap <D-A> :Tabularize /
|
||||
vmap <D-A> :Tabularize /
|
||||
|
||||
" Source current file Cmd-% (good for vim development)
|
||||
map <D-%> :so %<CR>
|
@ -1,318 +0,0 @@
|
||||
" ========================================
|
||||
" 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 :<C-U>YRYankCount 'y$'<CR>
|
||||
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
|
||||
|
||||
" ,# Surround a word with #{ruby interpolation}
|
||||
map ,# ysiw#
|
||||
vmap ,# c#{<C-R>"}<ESC>
|
||||
|
||||
" ," Surround a word with "quotes"
|
||||
map ," ysiw"
|
||||
vmap ," c"<C-R>""<ESC>
|
||||
|
||||
" ,' Surround a word with 'single quotes'
|
||||
map ,' ysiw'
|
||||
vmap ,' c'<C-R>"'<ESC>
|
||||
|
||||
" ,) or ,( Surround a word with (parens)
|
||||
" The difference is in whether a space is put in
|
||||
map ,( ysiw(
|
||||
map ,) ysiw)
|
||||
vmap ,( c( <C-R>" )<ESC>
|
||||
vmap ,) c(<C-R>")<ESC>
|
||||
|
||||
" ,[ Surround a word with [brackets]
|
||||
map ,] ysiw]
|
||||
map ,[ ysiw[
|
||||
vmap ,[ c[ <C-R>" ]<ESC>
|
||||
vmap ,] c[<C-R>"]<ESC>
|
||||
|
||||
" ,{ Surround a word with {braces}
|
||||
map ,} ysiw}
|
||||
map ,{ ysiw{
|
||||
vmap ,} c{ <C-R>" }<ESC>
|
||||
vmap ,{ c{<C-R>"}<ESC>
|
||||
|
||||
map ,` ysiw`
|
||||
|
||||
" gary bernhardt's hashrocket
|
||||
imap <c-l> <space>=><space>
|
||||
|
||||
"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<c-a>
|
||||
"
|
||||
" the first quote will autoclose so you'll get 'foo' and hitting <c-a> will
|
||||
" put the cursor right after the quote
|
||||
imap <C-a> <esc>wa
|
||||
|
||||
" ==== NERD tree
|
||||
" Open the project tree and expose current file in the nerdtree with Ctrl-\
|
||||
" " calls NERDTreeFind iff NERDTree is active, current window contains a modifiable file, and we're not in vimdiff
|
||||
function! OpenNerdTree()
|
||||
if &modifiable && strlen(expand('%')) > 0 && !&diff
|
||||
NERDTreeFind
|
||||
else
|
||||
NERDTreeToggle
|
||||
endif
|
||||
endfunction
|
||||
nnoremap <silent> <C-\> :call OpenNerdTree()<CR>
|
||||
|
||||
" ,q to toggle quickfix window (where you have stuff like Ag)
|
||||
" ,oq to open it back up (rare)
|
||||
nmap <silent> ,qc :cclose<CR>
|
||||
nmap <silent> ,qo :copen<CR>
|
||||
|
||||
"Move back and forth through previous and next buffers
|
||||
"with ,z and ,x
|
||||
nnoremap <silent> ,z :bp<CR>
|
||||
nnoremap <silent> ,x :bn<CR>
|
||||
|
||||
" ==============================
|
||||
" Window/Tab/Split Manipulation
|
||||
" ==============================
|
||||
" Move between split windows by using the four directions H, L, K, J
|
||||
" NOTE: This has moved to vim/settings/vim-tmux-navigator.vim.
|
||||
" nnoremap <silent> <C-h> <C-w>h
|
||||
" nnoremap <silent> <C-l> <C-w>l
|
||||
" nnoremap <silent> <C-k> <C-w>k
|
||||
" nnoremap <silent> <C-j> <C-w>j
|
||||
|
||||
" Make gf (go to file) create the file, if not existent
|
||||
nnoremap <C-w>f :sp +e<cfile><CR>
|
||||
nnoremap <C-w>gf :tabe<cfile><CR>
|
||||
|
||||
" Zoom in
|
||||
map <silent> ,gz <C-w>o
|
||||
|
||||
" Create window splits easier. The default
|
||||
" way is Ctrl-w,v and Ctrl-w,s. I remap
|
||||
" this to vv and ss
|
||||
nnoremap <silent> vv <C-w>v
|
||||
nnoremap <silent> ss <C-w>s
|
||||
|
||||
" create <%= foo %> erb tags using Ctrl-k in edit mode
|
||||
imap <silent> <C-K> <%= %><Esc>3hi
|
||||
|
||||
" create <%= foo %> erb tags using Ctrl-j in edit mode
|
||||
imap <silent> <C-J> <% %><Esc>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 <silent> ,cf :let @* = expand("%:~")<CR>
|
||||
nnoremap <silent> ,cr :let @* = expand("%")<CR>
|
||||
nnoremap <silent> ,cn :let @* = expand("%:t")<CR>
|
||||
|
||||
"Clear current search highlight by double tapping //
|
||||
nmap <silent> // :nohlsearch<CR>
|
||||
|
||||
"(v)im (c)ommand - execute current line as a vim command
|
||||
nmap <silent> ,vc yy:<C-f>p<C-c><CR>
|
||||
|
||||
"(v)im (r)eload
|
||||
nmap <silent> ,vr :so %<CR>
|
||||
|
||||
" Type ,hl to toggle highlighting on/off, and show current value.
|
||||
noremap ,hl :set hlsearch! hlsearch?<CR>
|
||||
|
||||
" 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 ` '
|
||||
|
||||
" ============================
|
||||
" SplitJoin plugin
|
||||
" ============================
|
||||
nmap sj :SplitjoinSplit<cr>
|
||||
nmap sk :SplitjoinJoin<cr>
|
||||
|
||||
" 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#")<CR>
|
||||
|
||||
" ,hp = html preview
|
||||
map <silent> ,hp :!open -a Safari %<CR><CR>
|
||||
|
||||
"paste text in insertion mode
|
||||
inoremap <C-X><C-V> <esc>"+pa
|
||||
"paste text in normal mode
|
||||
nnoremap <C-X><C-V> "+p"
|
||||
|
||||
"------------------------------------------------------------------------------
|
||||
" Misc
|
||||
"------------------------------------------------------------------------------
|
||||
" Toggle paste mode on and off
|
||||
map <leader>pp :setlocal paste!<cr>
|
||||
" copy all out of vim
|
||||
nnoremap <C-X><C-A> <esc>gg"+yG
|
||||
" copy text in visual mode
|
||||
vnoremap <C-C> "+yy
|
||||
" copy all inside vim
|
||||
nnoremap <C-A> <esc>ggyG
|
||||
" edit file
|
||||
nmap <leader>ev :tabedit $MYVIMRC<cr>'tzo
|
||||
nmap <leader>em :tabedit makefile
|
||||
|
||||
" move around compile errors
|
||||
nnoremap <leader>n :cnext<cr>
|
||||
nnoremap <leader>p :cprevious<cr>
|
||||
|
||||
nnoremap <leader>l :redraw!<cr>
|
||||
imap <leader>cb 『』
|
||||
nnoremap <leader>n :cn<cr>
|
||||
nnoremap <leader>p :cp<cr>
|
||||
|
||||
" Fast Saving
|
||||
map <Leader>w :w<CR>
|
||||
imap <Leader>w <ESC>:w<CR>
|
||||
vmap <Leader>w <ESC><ESC>:w<CR>
|
||||
|
||||
" :W sudo saves the file
|
||||
" (useful for handling the permission-denied error)
|
||||
if !exists(':W')
|
||||
command W w !sudo tee % > /dev/null
|
||||
endif
|
||||
|
||||
" Highlight current line - allows you to track cursor position more easily
|
||||
set cursorline
|
||||
|
||||
" map CTRL-L to piece-wise copying of the line above the current one
|
||||
imap <C-L> @@@<esc>hhkywjl?@@@<CR>P/@@@<cr>3s
|
||||
|
||||
|
||||
" Allow to copy/paste between VIM instances
|
||||
"copy the current visual selection to ~/.vbuf
|
||||
vmap <leader>y :w! ~/.vbuf<cr>
|
||||
|
||||
"copy the current line to the buffer file if no visual selection
|
||||
vmap <leader>y :.w! ~/.vbuf<cr>
|
||||
|
||||
"paste the contents of the buffer file
|
||||
nmap <leader>p :r ~/.vbuf<cr>
|
||||
|
||||
"------------------------------------------------------------------------------
|
||||
" Moving around, tabs, windows and buffers
|
||||
"------------------------------------------------------------------------------
|
||||
" Switch between the last two files
|
||||
nnoremap <leader><leader> <C-^>
|
||||
|
||||
" easy way to edit reload .vimrc
|
||||
nmap <leader>V :source $MYVIMRC<cr>
|
||||
nmap <leader>v :vsp $MYVIMRC<cr>
|
||||
|
||||
" Quickly open a buffer for scribble
|
||||
map <leader>q :e ~/buffer<cr>
|
||||
|
||||
" Quickly open a markdown buffer for scribble
|
||||
map <leader>x :e ~/buffer.md<cr>
|
||||
|
||||
" Remove the Windows ^M - when the encodings gets messed up
|
||||
noremap <Leader>m mmHmt:%s/<C-V><cr>//ge<cr>'tzt'm
|
||||
|
||||
"------------------------------------------------------------------------------
|
||||
" Spell checking
|
||||
"------------------------------------------------------------------------------
|
||||
|
||||
" Pressing ,ss will toggle and untoggle spell checking
|
||||
map <leader>ss :setlocal spell!<cr>
|
||||
|
||||
" visual shifting (does not exit Visual mode)
|
||||
vnoremap < <gv
|
||||
vnoremap > >gv
|
||||
|
||||
" Switch CWD to the directory of the open buffer
|
||||
map <leader>cd :cd %:p:h<cr>:pwd<cr>
|
||||
|
||||
" Treat long lines as break lines (useful when moving around in them)
|
||||
map j gj
|
||||
map k gk
|
||||
|
||||
" Close the current buffer (w/o closing the current window)
|
||||
map <leader>bd :bd<cr>
|
||||
|
||||
" Close all the buffers
|
||||
map <leader>bda :1,1000 bd!<cr>
|
||||
|
||||
" Useful mappings for managing tabs
|
||||
map <leader>tn :tabnew<cr>
|
||||
map <leader>to :tabonly<cr>
|
||||
map <leader>tc :tabclose<cr>
|
||||
map <leader>tm :tabmove
|
||||
map <leader>tj :tabnext
|
||||
map <leader>tk :tabprevious
|
||||
|
||||
" Let 'tl' toggle between this and the last accessed tab
|
||||
let g:lasttab = 1
|
||||
nmap <Leader>tl :exe "tabn ".g:lasttab<CR>
|
||||
au TabLeave * let g:lasttab = tabpagenr()
|
||||
|
||||
"------------------------------------------------------------------------------
|
||||
" Visual mode related
|
||||
"------------------------------------------------------------------------------
|
||||
|
||||
" Visual mode pressing * or # searches for the current selection
|
||||
" Super useful! From an idea by Michael Naumann
|
||||
vnoremap <silent> * :call VisualSelection('f', '')<CR>
|
||||
vnoremap <silent> # :call VisualSelection('b', '')<CR>
|
||||
|
||||
|
||||
noremap <Up> :echo '戒黄赌毒及上下左右键!'<CR>
|
||||
noremap <Down> :echo '戒黄赌毒及上下左右键!'<CR>
|
||||
noremap <Left> :echo '戒黄赌毒及上下左右键!'<CR>
|
||||
noremap <Right> :echo '戒黄赌毒及上下左右键!'<CR>
|
||||
inoremap <leader>fn <C-R>=expand("%:t")<CR>
|
||||
|
||||
|
||||
function! TogglePaste()
|
||||
if &paste
|
||||
setlocal nopaste
|
||||
else
|
||||
setlocal paste
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! ToggleRspecTest()
|
||||
let l:line=getline('.')
|
||||
if l:line =~? ',\s*now:\s.*true'
|
||||
call setline('.', substitute(l:line, "\,\\s*now:\\s*true", "", ""))
|
||||
else
|
||||
call setline('.', substitute(l:line, "\\([^\\s]\\)\\s*do", "\\1, now: true do", ""))
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" set paste
|
||||
nnoremap <localleader>tp :call TogglePaste()<cr>
|
||||
nnoremap <localleader>tt :call ToggleRspecTest()<cr>
|
@ -1,3 +0,0 @@
|
||||
" w!! to write a file as sudo
|
||||
" stolen from Steve Losh
|
||||
cmap w!! w !sudo tee % >/dev/null
|
@ -1,15 +0,0 @@
|
||||
" via: http://rails-bestpractices.com/posts/60-remove-trailing-whitespace
|
||||
" Strip trailing whitespace
|
||||
function! <SID>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 <SID>StripTrailingWhitespaces()
|
||||
nmap ,w :StripTrailingWhitespaces<CR>
|
@ -1,20 +0,0 @@
|
||||
" Use Q to intelligently close a window
|
||||
" (if there are multiple windows into the same buffer)
|
||||
" or kill the buffer entirely if it's the last window looking into that buffer
|
||||
function! CloseWindowOrKillBuffer()
|
||||
let number_of_windows_to_this_buffer = len(filter(range(1, winnr('$')), "winbufnr(v:val) == bufnr('%')"))
|
||||
|
||||
" We should never bdelete a nerd tree
|
||||
if matchstr(expand("%"), 'NERD') == 'NERD'
|
||||
wincmd c
|
||||
return
|
||||
endif
|
||||
|
||||
if number_of_windows_to_this_buffer > 1
|
||||
wincmd c
|
||||
else
|
||||
bdelete
|
||||
endif
|
||||
endfunction
|
||||
|
||||
nnoremap <silent> Q :call CloseWindowOrKillBuffer()<CR>
|
@ -1,20 +0,0 @@
|
||||
" 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()<CR>
|
||||
|
||||
vmap <D-j> gj
|
||||
vmap <D-k> gk
|
||||
vmap <D-$> g$
|
||||
vmap <D-^> g^
|
||||
vmap <D-0> g^
|
||||
nmap <D-j> gj
|
||||
nmap <D-k> gk
|
||||
nmap <D-$> g$
|
||||
nmap <D-^> g^
|
||||
nmap <D-0> g^
|
||||
|
@ -1,2 +0,0 @@
|
||||
nmap <leader>p <Plug>yankstack_substitute_older_paste
|
||||
nmap <leader>P <Plug>yankstack_substitute_newer_paste
|
@ -1 +0,0 @@
|
||||
autocmd FileType python nnoremap <LocalLeader>= :0,$!yapf<CR>
|
Loading…
Reference in New Issue
Block a user