Skip to content

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also .

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also .
...
  • 2 commits
  • 1 file changed
  • 0 commit comments
  • 1 contributor
Showing with 23 additions and 13 deletions.
  1. +23 −13 vimrc
View
36 vimrc
@@ -91,10 +91,10 @@ set autoindent " indent at the same level of th
" Tabs "
"------------"
-set shiftwidth=2 " use indents of 4 spaces
-set expandtab " tabs are spaces
-set tabstop=2 " an indentation every four columns
+set shiftwidth=4 " use indents of 4 spaces
+set tabstop=4 " an indentation every four columns
set softtabstop=2 " let backspace delete indent
+set expandtab " tabs are spaces
@@ -108,10 +108,11 @@ set softtabstop=2 " let backspace delete indent
autocmd! FileType * setlocal formatoptions-=r
" make Python follow PEP8 ( http://www.python.org/dev/peps/pep-0008/ )
-autocmd FileType python setlocal softtabstop=4 tabstop=4 shiftwidth=4 textwidth=79 expandtab
+autocmd FileType python setlocal sts=4 ts=4 sw=4 tw=79 et
" javascript file type settings
autocmd FileType javascript setlocal sw=2 sts=2 ts=2 et
+autocmd FileType coffee setlocal sw=2 sts=2 ts=2 et
" Automatically go to relative number when using insert mode
autocmd InsertEnter * set number
@@ -246,8 +247,8 @@ imap <silent> <c-p> <esc> :call FindProjectRoot()<CR><Plug>PeepOpen
nmap <silent> <leader>tt :call TabToggle()<cr>
" mapping to use a different tab setting more suitable for other languages
-nmap <silent> <leader>t2 :setlocal softtabstop=2 tabstop=2 shiftwidth=2<CR>:retab!<cr>
-nmap <silent> <leader>t4 :setlocal softtabstop=4 tabstop=4 shiftwidth=4<CR>:retab!<cr>
+nmap <silent> <leader>t2 :setlocal softtabstop=2 tabstop=2 shiftwidth=2<CR>:call NiceRetab()<cr>
+nmap <silent> <leader>t4 :setlocal softtabstop=4 tabstop=4 shiftwidth=4<CR>:call NiceRetab()<cr>
" open up the current file's directory in finder
nmap <silent> <leader>o :lcd %:h<CR>:! open .<cr><cr>
@@ -257,13 +258,11 @@ nmap <silent> <leader>O :call FindProjectRoot()<CR>:! open .<cr><cr>
nmap <silent> <leader>x :call OpenTerminal(expand("%:p:h"))<CR>
nmap <silent> <leader>X :call FindProjectRoot()<CR>:call OpenTerminal(getcwd())<CR>
-" mapping for loading local .lvimrc file
-nmap <silent> <leader>ll :call LoadLocalVimrc()<CR>
-
" Insert newlines
-nnoremap <C-CR> m`o<Esc>``
-nnoremap <C-D-CR> m`O<Esc>``
-
+nmap <C-CR> m`O<Esc>``
+nmap <C-D-CR> m`o<Esc>``
+imap <C-CR> <Esc>m`O<Esc>``l<Esc>
+imap <C-D-CR> <Esc>m`o<Esc>``l<Esc>
" remapping ESC to be a toggle for insert/normal mode
nnoremap <Esc> i
@@ -299,6 +298,7 @@ nmap <Leader>jc :call JsonConcealToggle()<CR>
" git history for file
nmap <Leader>gh :call GitHistory()<cr>
+" cycle over git changes
nmap <silent> ]h :<C-U>execute v:count1 . "GitGutterNextHunk"<CR>
nmap <silent> [h :<C-U>execute v:count1 . "GitGutterPrevHunk"<CR>
@@ -494,7 +494,7 @@ endfunction
function! TabToggle()
let l:winview = winsaveview()
- if(&expandtab > 0)
+ if (&expandtab > 0)
Space2Tab
else
Tab2Space
@@ -503,6 +503,16 @@ function! TabToggle()
call winrestview(l:winview)
endfunc
+function! NiceRetab()
+ let l:winview = winsaveview()
+ if (&expandtab == 0)
+ Space2Tab
+ else
+ Tab2Space
+ endif
+ call winrestview(l:winview)
+endfunc
+
command! -range=% -nargs=0 Tab2Space exec "silent! <line1>,<line2>s/^\\t\\+/\\=substitute(submatch(0), '\\t',repeat(' ', ".&ts."), 'g')"
command! -range=% -nargs=0 Space2Tab exec "silent! <line1>,<line2>s/^\\( \\{".&ts."\\}\\)\\+/\\=substitute(submatch(0), ' \\{".&ts."\\}','\\t', 'g')"

No commit comments for this range

Something went wrong with that request. Please try again.