-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvimrc
More file actions
executable file
·79 lines (71 loc) · 2.1 KB
/
vimrc
File metadata and controls
executable file
·79 lines (71 loc) · 2.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
call plug#begin('~/.vim/plugged')
Plug 'altercation/vim-colors-solarized'
Plug 'ervandew/supertab'
Plug 'xolox/vim-misc'
call plug#end()
"Standard bits
let mapleader = "-"
syntax enable
filetype plugin indent on
set nu
set nocp
set nobackup
set nowritebackup
set clipboard=unnamed
set wildmode=longest,list
set wildignore+=*/tmp/*,*.so,*.swp,*.zip,*.tar,*/build/*,*/node_modules/*,*.vagrant/*,*.git/*,*/local/*,*/target/*
set wildmenu
set laststatus=2
set cmdheight=2
set showmatch
set incsearch
set hlsearch
set autoread
"Look and feel
let g:solarized_termcolors=256
set background=light
colorscheme solarized
"Setup movement keys for window navigation
noremap <C-J> <C-W><C-J>
noremap <C-K> <C-W><C-K>
noremap <C-L> <C-W><C-L>
noremap <C-H> <C-W><C-H>
"Setup code folding
set foldmethod=indent
set foldlevel=99
noremap <space> za
"Setup code editing
set expandtab
set tabstop=4
set softtabstop=4
set shiftwidth=4
set encoding=utf-8
set autoindent
set fileformat=unix
"Setup Makefile indentation
au BufNewFile,BufRead Makefile* set noexpandtab
"Buffer nav
nmap <leader>T :enew<CR>
nmap <leader>l :bnext<CR>
nmap <leader>h :bprev<CR>
nmap <leader>bl :ls<CR>
function! s:ExecuteInShell(command)
let command = join(map(split(a:command), 'expand(v:val)'))
let winnr = bufwinnr('^' . command . '$')
silent! execute winnr < 0 ? 'botright vne ' . fnameescape(command) : winnr . 'wincmd w'
setlocal buftype=nowrite bufhidden=wipe nobuflisted noswapfile nowrap
echo 'Execute ' . command . '...'
silent! execute 'silent %!'. command
silent! redraw
silent! execute 'au BufUnload <buffer> execute bufwinnr(' . bufnr('#') . ') . ''wincmd w'''
silent! execute 'nnoremap <silent> <buffer> <LocalLeader>r :call <SID>ExecuteInShell(''' . command . ''')<CR>'
echo 'Shell command ' . command . ' executed.'
if line('$') == 1 && getline(1) == ''
silent! execute 'wincmd c'
echo 'Shell command ' . command . ' produced no output.'
else
silent! normal! gg=G
silent! execute 'wincmd p'
endif
endfunction
command! -complete=shellcmd -nargs=+ Shell call s:ExecuteInShell(<q-args>)