dotfiles/editors/vim/ui.vim

154 lines
3.7 KiB
VimL
Raw Normal View History

syntax on
" Visual
set ruler
set guioptions=ce
set showmatch " Briefly jump to a paren once it's balanced
set linespace=2
set background=dark
set laststatus=2
2011-11-08 17:28:32 +11:00
colorscheme molokai_mac
" Tabs/Whitespace
set tabstop=2
set shiftwidth=2
set autoindent
set smarttab
set expandtab
set nowrap
set list
set backspace=indent,eol,start " allow backspacing over everything in insert mode
2011-11-08 17:29:00 +11:00
" Toggle show tabs and trailing spaces (,c)
set listchars=tab:▸\ ,trail,eol,nbsp:_
set fillchars=vert:\ ,fold:-
nnoremap <Leader>c :set nolist!<CR>
2011-11-08 17:29:00 +11:00
" Misc
set switchbuf=useopen " Don't re-open already opened buffers
set nostartofline " Avoid moving cursor to BOL when jumping around
set virtualedit=all " Let cursor move past the last char
set whichwrap=b,s,h,l,<,>,[,]
let mapleader = ','
set autoread " watch for file changes
set mouse=a
2012-01-10 10:38:48 +11:00
set ttymouse=xterm2 " Needed to get mouse working when in Tmux/screen
set fileformats=unix
2012-01-07 04:41:39 +11:00
set history=1000
set hidden
set title " Show title in Terminal
set shortmess=atI
" Bells
set novisualbell " No blinking
set noerrorbells " No noise.
set vb t_vb= " disable any beeps or flashes on error
" Searching
set hlsearch
set incsearch
set ignorecase
set smartcase
2011-11-24 09:54:11 +11:00
" Remove highlighting when entering insert (not working... )
autocmd InsertEnter * nohlsearch
" center result
nnoremap n nzz
nnoremap N Nzz
nnoremap * *zz
nnoremap # #zz
nnoremap g* g*zz
nnoremap g# g#zz
" Work around bug that leaves cursor in middle of line
nnoremap dd ddI<Esc>
" Tab completion
set wildmode=list:longest,list:full
set wildignore+=*.o,*.obj,.git,*.rbc,*.swp
" Folding
set foldenable " Turn on folding
2011-11-24 09:55:26 +11:00
set foldmethod=syntax " Fold on the marker
set foldlevel=100 " Don't autofold anything (but I can still fold manually)
set foldopen=block,hor,mark,percent,quickfix,tag " what movements open folds
" Directories for swp files
" persistent undos
set undofile
set undodir=~/.vim/dirs/undos
set backupdir=~/.vim/dirs/backups
set directory=~/.vim/dirs/swaps
" Nicer text navigation
nmap j gj
nmap k gk
" Reselect visual block after adjusting indentation
vnoremap < <gv
vnoremap > >gv
" Nicer splitting
set splitbelow
set splitright
2011-12-14 10:44:51 +11:00
map <C-_> :new<CR>
map <C-\> :vnew<CR>
" Emacs-like keys for the command line
cnoremap <C-A> <Home>
cnoremap <C-E> <End>
cnoremap <C-K> <C-U>
" Move around in insert mode
inoremap <C-h> <left>
inoremap <C-k> <up>
inoremap <C-j> <down>
inoremap <C-l> <right>
2011-11-04 03:37:31 +11:00
" way better...
map 0 ^
nmap <Leader>] :tabnext<CR>
nmap <Leader>[ :tabprev<CR>
2011-11-08 17:29:30 +11:00
" Opens an edit command with the path of the currently
" edited file filled in Normal mode: <Leader>e
map <Leader>e :e <C-R>=expand("%:p:h") . "/" <CR>
" Always show cursorline, but only in current window.
2011-11-24 09:55:32 +11:00
set scrolloff=3
set scrolljump=10
set cursorline
autocmd WinEnter * :setlocal cursorline
autocmd WinLeave * :setlocal nocursorline
set number
" For when other people use my setup
nmap \ <Leader>
2012-01-10 10:38:48 +11:00
" Easier
nnoremap ; :
2012-03-29 06:31:02 +11:00
" I keep deleting words when I want to switch windows
imap <C-w> <Esc><C-w>
" OS X clipboard when yanking/pasting
set clipboard=unnamed
" May only work in iTerm2 and may have other bad effects,
" but this shows a block in normal mode, and vertical bar
" in insert mode.
if exists('$TMUX')
" https://github.com/sjl/vitality.vim/issues/8#issuecomment-7664649
let &t_SI = "\<Esc>[3 q"
let &t_EI = "\<Esc>[0 q"
else
let &t_SI = "\<Esc>]50;CursorShape=1\x7"
let &t_EI = "\<Esc>]50;CursorShape=0\x7"
endif
2012-01-07 04:41:39 +11:00
runtime macros/matchit.vim