Fixed a few things with normal mode newline

This commit is contained in:
Talia 2017-10-24 09:40:54 +02:00
parent 8edad2f43d
commit fa2ec57364

13
vimrc
View file

@ -100,8 +100,6 @@ noremap <F1> :setl number!<CR>
noremap <F2> :setl relativenumber!<CR> noremap <F2> :setl relativenumber!<CR>
noremap <F3> :setl autowriteall!<CR>:setl autowriteall?<CR> noremap <F3> :setl autowriteall!<CR>:setl autowriteall?<CR>
noremap <F4> :setl list!<CR> noremap <F4> :setl list!<CR>
nnoremap <S-tab> :retab!<CR>
nnoremap <C-tab> :setl expandtab!<CR>:set expandtab?<CR>
nnoremap <C-e> ge nnoremap <C-e> ge
nnoremap <C-E> gE nnoremap <C-E> gE
com! Setwd :cd %:p:h com! Setwd :cd %:p:h
@ -114,18 +112,23 @@ nnoremap <C-i> Bi <esc>i
nnoremap <C-a> Ea <esc>a nnoremap <C-a> Ea <esc>a
nnoremap <leader>: :let @* = @:<CR> nnoremap <leader>: :let @* = @:<CR>
" Tabs vs. Spaces
nnoremap <S-tab> :retab!<CR>
nnoremap <C-tab> :setl expandtab!<CR>:set expandtab?<CR>
" todo: custom function to retab only indentation
" Empty Lines " Empty Lines
nnoremap <ENTER> :call <SID>Enter(0)<CR> nnoremap <ENTER> :call <SID>Enter(0)<CR>
nnoremap <S-ENTER> :call <SID>Enter(1)<CR> nnoremap <S-ENTER> :call <SID>Enter(1)<CR>
function! s:Enter(shift) function! s:Enter(shift)
if !a:shift if !a:shift
if col(".")-1 if col(".")-1
exe "normal o\<esc>0d$" exe "normal o\<esc>0\"_d$"
else else
exe "normal O\<esc>0d$j0" exe "normal O\<esc>0\"_d$j"
end end
else else
exe "normal O\<esc>0d$j" exe "normal O\<esc>0\"_d$"
endif endif
endfunction endfunction