Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if has('gui_running') " gVim
- " Remove the toolbar.
- set guioptions-=T
- " Remove the menu toolbar.
- set guioptions-=m
- " Remove left-hand scrollbar.
- set guioptions-=l
- set guioptions-=L
- " Remove right-hand scrollbar.
- set guioptions-=r
- set guioptions-=R
- " Disable autoselect which forces MiddleMouse clicks in other programs to paste the contents of Vim's "+ unnamedplus register instead of the "* unnamed selection register. See :h go-a
- set guioptions-=a
- set guioptions-=A
- " Tab navigation
- " SOURCE: http://genotrance.wordpress.com/2008/02/04/my-vim-customization/
- " SOURCE: https://github.com/bashwork/settings/blob/master/linux/.vimrc
- " New Tab.
- noremap <C-t> :tabnew<CR>
- inoremap <C-t> <Esc>:tabnew<CR>i
- cnoremap <C-t> <Esc><Esc>:tabnew<CR>
- " Close Tab.
- "noremap <C-w> :tabclose<CR> " Firefox uses this but had to disable it because it interferes with ctrl + ww to switch between windows
- noremap <C-q> :tabclose<CR>
- inoremap <C-q> <Esc>:tabclose<CR>
- cnoremap <C-q> <Esc><Esc>:tabclose<CR>
- " Next Tab.
- noremap <C-Tab> :tabnext<CR>
- inoremap <C-Tab> <Esc>:tabnext<CR>i
- cnoremap <C-Tab> <Esc><Esc>:tabnext<CR>
- " Previous Tab.
- noremap <C-S-Tab> :tabprevious<CR>
- inoremap <C-S-Tab> <Esc>:tabprevious<CR>i
- cnoremap <C-S-Tab> <Esc><Esc>:tabprevious<CR>
- " Hold shift for horizontal mouse-wheel scrolling.
- " NOTE: This works for Linux and macOS but [:h scroll-mouse-wheel] says this does not work with Windows).
- " SOURCE: https://github.com/graywh/dotfiles/blob/master/.gvimrc
- noremap <S-ScrollWheelUp> <ScrollWheelLeft>
- inoremap <S-ScrollWheelUp> <ScrollWheelLeft>
- cnoremap <S-ScrollWheelUp> <ScrollWheelLeft>
- noremap <S-ScrollWheelDown> <ScrollWheelRight>
- inoremap <S-ScrollWheelDown> <ScrollWheelRight>
- cnoremap <S-ScrollWheelDown> <ScrollWheelRight>
- " Different cursors for different modes.
- "
- " Default value of guicursor:
- " set guicursor=
- " set guicursor+=n-v-c:block-Cursor/lCursor,
- " set guicursor+=ve:ver35-Cursor,
- " set guicursor+=o:hor50-Cursor,
- " set guicursor+=i-ci:ver25-Cursor/lCursor,
- " set guicursor+=r-cr:hor20-Cursor/lCursor,
- " set guicursor+=sm:block-Cursor-blinkwait175-blinkoff150-blinkon175
- "
- " Moved v (Visual) to ve (Visual mode with 'selection') and applied a non-blinking block cursor.
- " Made r (Replace) and cr (Command-line Replace) a blinking block cursor.
- set guicursor=
- set guicursor+=n-c:block-Cursor/lCursor,
- set guicursor+=v-ve:block-Cursor-blinkon0,
- set guicursor+=o:hor50-Cursor,
- set guicursor+=i-ci:ver25-Cursor/lCursor,
- " set guicursor+=r-cr:block-Cursor/lCursor,
- set guicursor+=r-cr:hor20-Cursor/lCursor,
- set guicursor+=sm:block-Cursor-blinkwait175-blinkoff150-blinkon175
- endif
- " Bind Leader + Up/Down/Left/Right for window moving {{{
- nnoremap <silent> <Leader><left> <C-w>H
- nnoremap <silent> <Leader><right> <C-w>L
- nnoremap <silent> <Leader><up> <C-w>K
- nnoremap <silent> <Leader><down> <C-w>J
- " }}} Bind Leader + Up/Down/Left/Right for window moving
- " Bind Ctrl + Up/Down/Left/Right for window creation {{{
- " Window creation.
- " SOURCE: https://stackoverflow.com/questions/22614280/vim-open-file-in-right-split
- " SOURCE: https://technotales.wordpress.com/2010/04/29/vim-splits-a-guide-to-doing-exactly-what-you-want/
- "nnoremap <silent> <C-left> :leftabove vnew<CR>:startinsert<CR>
- "nnoremap <silent> <C-right> :rightbelow vnew<CR>:startinsert<CR>
- "nnoremap <silent> <C-up> :leftabove new<CR>:startinsert<CR>
- "nnoremap <silent> <C-down> :rightbelow new<CR>:startinsert<CR>
- " Open Startify in the created window.
- nnoremap <silent> <C-left> :leftabove vnew<CR>:Startify<CR>
- nnoremap <silent> <C-right> :rightbelow vnew<CR>:Startify<CR>
- nnoremap <silent> <C-up> :leftabove new<CR>:Startify<CR>
- nnoremap <silent> <C-down> :rightbelow new<CR>:Startify<CR>
- " }}} Bind Ctrl + Up/Down/Left/Right for window creation
- " Bind Alt + Up/Down/Left/Right for window viewing {{{
- " Built in ways to navigate windows:
- " Cycle all windows: <Ctrl + W><Ctrl + W>
- " Window navigating: <Ctrl + W><arrow key>
- "nnoremap <A-left> <C-w>h
- "nnoremap <A-right> <C-w>l
- "nnoremap <A-up> <C-w>k
- "nnoremap <A-down> <C-w>j
- " SOURCE[modded]: http://janneinosaka.blogspot.com/2014/10/automatically-resize-vim-splits.html
- function! SplitResize()
- let ratio = 0.9 "2.0/3.0
- if &ft ==? 'help'
- let hmax = 83
- elseif &ft ==? 'nerdtree'
- let hmax = 40
- else
- let hmax = max([winwidth(0), float2nr(&columns * ratio)])
- endif
- let vmax = max([winheight(0), float2nr(&lines * ratio)])
- exe "vertical resize" . hmax
- exe "resize" . vmax
- endfunction
- " NOTE: Use <Control-W>= to equalize windows size. See :h CTRL-W_=
- " CTRL-W = Make all windows (almost) equally high and wide, but use
- " 'winheight' and 'winwidth' for the current window.
- " Windows with 'winfixheight' set keep their height and windows
- " with 'winfixwidth' set keep their width.
- "
- " Alt + = makes more sense.
- nnoremap <silent> <A-=> <C-w>=
- " Window navigation.
- nnoremap <silent> <A-left> <C-w>h:call SplitResize()<CR>
- nnoremap <silent> <A-right> <C-w>l:call SplitResize()<CR>
- nnoremap <silent> <A-up> <C-w>k:call SplitResize()<CR>
- nnoremap <silent> <A-down> <C-w>j:call SplitResize()<CR>
- " }}} Bind Alt + Up/Down/Left/Right for window viewing
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement