-
Notifications
You must be signed in to change notification settings - Fork 0
/
vimrc
116 lines (102 loc) · 2.81 KB
/
vimrc
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
syntax enable
so ~/.vim/plugins.vim
set background=dark
let g:solarized_termcolors=256
colorscheme atom-dark-256
set backspace=indent,eol,start
let mapleader = ','
set autoindent
set number
set hlsearch
set incsearch
set guifont=Fira_Code:h15
set linespace=12
set textwidth=0
set wrapmargin=0
set relativenumber
set wrap!
set laststatus=2
set cursorline
set wildmenu
set ignorecase
set lazyredraw
set copyindent
filetype plugin on
set omnifunc=syntaxcomplete#Complete
set path+=**
command! MakeTags !ctags -R .
"=============Mappings================"
" " Current file in nerdtree
map <Leader>kb :NERDTreeFind<CR>
nmap <D-R> :CtrlPBufTag<cr>
"Edit vimrc file
nmap <Leader>ev :tabedit ~/.vim/vimrc<cr>
nmap <Leader><space> :nohlsearch<cr>
nmap <D-p> :CtrlP<cr>
imap jj <Esc>
map <C-q> <C-w><C-o>
"greplace
set grepprg=ag
let g:grep_cmd_opts = '--line-numbers --noheading'
" Smart way to move between windows
map <C-j> <C-W>j
map <C-k> <C-W>k
map <C-h> <C-W>h
map <C-l> <C-W>l
" Close the current buffer
map <leader>bd :Bclose<cr>:tabclose<cr>gT
" Close all the buffers
map <leader>ba :bufdo bd<cr>
map <leader>l :bnext<cr>
map <leader>h :bprevious<cr>
" bind K to grep word under cursor
nnoremap K :Ag "\b<C-R><C-W>\b"<CR>:cw<CR>
"--------------Extra------------------
let g:Powerline_symbols = 'fancy'
set encoding=utf-8 " Necessary to show Unicode glyphs
set laststatus=2 " Always show the statusline
set noshowmode " Hide the default mode text (e.g. -- INSERT -- below the statusline) "
" I don't want to pull up these folders/files when calling CtrlP
set wildignore+=*/vendor/**
" Set extra options when running in GUI mode
if has("gui_running")
set guioptions-=T
set guioptions-=e
set t_Co=256
set guitablabel=%M\ %t
endif
"let g:ctrlp_map = '<D-p>'
let g:airline_powerline_fonts = 1
let g:ctrlp_custom_ignore = 'node_modules\|DS_Store\|git\bower_components'
let g:ctrlp_match_window = 'top,order:ttb,min:1,max:30,results:30'
augroup autosourcing
autocmd!
autocmd BufWritePost .vimrc source %
augroup END
" The Silver Searcher
if executable('ag')
" Use ag over grep
set grepprg=ag\
" Use ag in CtrlP for listing files. Lightning fast and respects .gitignore
let g:ctrlp_user_command = 'ag %s -l -g ""'
" ag is fast enough that CtrlP doesn't need to cache
let g:ctrlp_use_caching = 0
endif
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Text, tab and indent related
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Use spaces instead of tabs
set expandtab
" Be smart when using tabs ;)
set smarttab
" 1 tab == 4 spaces
set shiftwidth=4
set tabstop=4
function! NumberToggle()
if(&relativenumber == 1)
set number
else
set relativenumber
endif
endfunc
nnoremap <C-n> :call NumberToggle()