-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvimrc
More file actions
105 lines (88 loc) · 3.06 KB
/
Copy pathvimrc
File metadata and controls
105 lines (88 loc) · 3.06 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
set nocompatible " get rid of Vi compatibility mode. SET FIRST!
filetype plugin indent on " filetype detection[ON] plugin[ON] indent[ON]
set t_Co=256 " enable 256-color mode.
syntax enable " enable syntax highlighting (previously syntax on).
colorscheme desert " set colorscheme
set number " show line numbers
set laststatus=2 " last window always has a statusline
filetype indent on " activates indenting for files
set nohlsearch " Don't continue to highlight searched phrases.
set incsearch " But do highlight as you type your search.
set ignorecase " Make searches case-insensitive.
set ruler " Always show info along bottom.
set autoindent " auto-indent
set tabstop=4 " tab spacing
set softtabstop=4 " unify
set shiftwidth=4 " indent/outdent by 4 columns
set shiftround " always indent/outdent to the nearest tabstop
set expandtab " use spaces instead of tabs
set smarttab " use tabs at the start of a line, spaces elsewhere
set nowrap " don't wrap text
" Remap <Leader> key
let mapleader=","
" Wrap text at 72 characters while writing a Git commit message
autocmd FileType gitcommit setlocal textwidth=72
" Centralize backups, swapfiles and undo history
set backupdir=~/.vim/backups
set directory=~/.vim/swaps
if exists("&undodir")
set undodir=~/.vim/undo
endif
" Highlight current line
set cursorline
" Show “invisible” characters
" set list
set lcs=tab:▸\ ,trail:·,eol:¬,nbsp:_
" Enable mouse in all modes
set mouse=a
" Disable error bells
set noerrorbells
" Don’t show the intro message when starting Vim
set shortmess=atI
" Show the current mode
set showmode
" Show the filename in the window titlebar
set title
" Show the (partial) command as it’s being typed
set showcmd
" Automatic commands
if has("autocmd")
" Enable file type detection
filetype on
" Treat .json files as .js
autocmd BufNewFile,BufRead *.json setfiletype json syntax=javascript
" Treat .md files as Markdown
autocmd BufNewFile,BufRead *.md setlocal filetype=markdown
endif
" Windows movement
nnoremap <C-H> <C-W>h
nnoremap <C-J> <C-W>j
nnoremap <C-K> <C-W>k
nnoremap <C-L> <C-W>l
" Change the directory view in netrw
let g:netrw_liststyle = 4
" Open files in a new tab
let g:netrw_browse_split = 3
" Set the width of the directory explorer
let g:netrw_winsize = 25
" Auto-reload vim configuration
augroup myvimrc
au!
au BufWritePost .vimrc,vimrc so $MYVIMRC
augroup END
" Ctags search
set tags=./tags;$HOME
" Set f5 to generate tags
nnoremap <f5> :!ctags -R<CR>
" Auto-update tags for python
autocmd BufWritePost *.py silent! !ctags -R .
" ctrlp configuration
let g:ctrlp_map = '<c-p>'
let g:ctrlp_cmd = 'CtrlP'
let g:ctrlp_working_path_mode = 'ra'
nnoremap <leader>. :CtrlPTag<cr>
" Ignore files in .gitignore
let g:ctrlp_user_command = ['.git', 'cd %s && git ls-files -co --exclude-standard']
" Tagbar configuration
nmap <F8> :TagbarToggle<CR>
nnoremap <silent> <Leader>b :TagbarToggle<CR>