-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvimrc
More file actions
135 lines (108 loc) · 3.29 KB
/
Copy pathvimrc
File metadata and controls
135 lines (108 loc) · 3.29 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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
let s:current_file = expand("<sfile>:p")
set nocompatible " Use vim, no vi defaults
set number " Show line numbers
set ruler " Show line and column number
set laststatus=2 " always show the status bar
syntax enable " Turn on syntax highlighting allowing local overrides
set encoding=utf-8 " Set default encoding to UTF-8
set nowrap " don't wrap lines
set tabstop=2 " a tab is two spaces
set shiftwidth=2 " an autoindent (with <<) is two spaces
set expandtab " use spaces, not tabs
set list listchars=tab:\ \ ,trail:.,extends:> " a tab should display as " ", trailing whitespace as "."
set backspace=indent,eol,start " backspace through everything in insert mode
set background=dark
set hlsearch " highlight matches
set incsearch " incremental searching
set ignorecase " searches are case insensitive...
set smartcase " ... unless they contain at least one capital letter
""
"" Disable swap files
""
set nobackup
set nowritebackup
set noswapfile
""
"" Vundle
""
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
Plugin 'airblade/vim-gitgutter'
Plugin 'altercation/vim-colors-solarized'
Plugin 'junegunn/fzf'
Plugin 'junegunn/fzf.vim'
Plugin 'mileszs/ack.vim'
Plugin 'scrooloose/nerdcommenter'
Plugin 'scrooloose/nerdtree'
Plugin 'tpope/vim-fugitive'
Plugin 'tpope/vim-surround'
Plugin 'vim-airline/vim-airline'
Plugin 'vim-airline/vim-airline-themes'
Plugin 'w0rp/ale'
call vundle#end()
filetype plugin indent on
colorscheme solarized
let mapleader=","
" Removes trailing spaces
function! TrimWhiteSpace()
%s/\s*$//
''
:retab
:endfunction
autocmd FileWritePre * :call TrimWhiteSpace()
autocmd FileAppendPre * :call TrimWhiteSpace()
autocmd FilterWritePre * :call TrimWhiteSpace()
autocmd BufWritePre * :call TrimWhiteSpace()
map <F2> :call TrimWhiteSpace()<CR>
map! <F2> :call TrimWhiteSpace()<CR>
set wildmode=list:longest,list:full
set wildignore+=*.gif,*.png,*.jpg,*.o,*.obj,*.rbc,*.class,.svn,tmp/*,log/*,target/*,build/*
" Navigate between split windows
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-h> <C-w>h
nnoremap <C-l> <C-w>l
" Map the arrow keys to be based on display lines, not physical lines
map <Down> gj
map <Up> gk
" remember last position in file
" see :help last-position-jump
au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$")
\| exe "normal! g`\"" | endif
" NERDTree
let g:NERDTreeWinSize=40
let g:NERDTreeChDirMode=2
let g:NERDTreeMinimalUI=1
let g:NERDTreeDirArrows=1
let g:NERDTreeMouseMode=2
map <Leader>n :NERDTreeToggle<CR>
map <Leader>f :NERDTreeFind<CR>
" ALE
nmap <Leader>l :ALEFix<CR>
let g:ale_fixers = {
\ 'javascript': [
\ 'prettier'
\ ],
\}
" Ack
cnoreabbrev Ack Ack!
nnoremap <Leader>a :Ack!<Space>
" fzf
nmap ; :Buffers<CR>
nmap <Leader>t :Files<CR>
" Ack
let g:ackprg = 'ag --nogroup --nocolor --column'
" GitGutter
let g:gitgutter_realtime = 0
let g:gitgutter_eager = 0
" Airline
let g:airline_theme='solarized'
" highlight current line
set cursorline
hi CursorLine cterm=none ctermbg=black
hi ALEWarning ctermbg=none cterm=underline
" Opens the directory browser for the directory of the current path.
" <Leader>e
map <Leader>e :e <C-R>=expand("%:p:h") . "/" <CR>