-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvimrc
More file actions
80 lines (66 loc) · 1.77 KB
/
vimrc
File metadata and controls
80 lines (66 loc) · 1.77 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
" ========== Vim Basic Settings ============="
"TAB settings
set tabstop=4
set shiftwidth=4
set softtabstop=4
set expandtab
" Common Settings
set encoding=utf-8
set autoindent
syntax on
set number
set paste
" Set title to window
set title
" Enable mouse
set mouse=a
" To show special characters in Vim
"set list
set listchars=tab:▸\ ,eol:¬
" Naviagations using keys up/down/left/right
" Disabling default keys to learn the hjkl
nnoremap <up> <nop>
nnoremap <down> <nop>
nnoremap <left> <nop>
nnoremap <right> <nop>
"inoremap <up> <nop>
"inoremap <down> <nop>
"inoremap <left> <nop>
"inoremap <right> <nop>
nnoremap j gj
nnoremap k gk
"Works in normal mode, must press Esc first"
:map <M-s> :w<kEnter>
"Works in insert mode, saves and puts back in insert mode"
:imap <M-s> <Esc>:w<kEnter>i
"Changing Leader Key
let mapleader = ","
" Set vim to save the file on focus out.
au FocusLost * :wa
"Make Sure that Vim returns to the same line when we reopen a file"
augroup line_return
au!
au BufReadPost *
\ if line("'\"") > 0 && line("'\"") <= line("$") |
\ execute 'normal! g`"zvzz' |
\ endif
augroup END
" =========== END Basic Vim Settings ===========
" NERDTree settings
nnoremap <C-n> :NERDTreeToggle<cr>
" close vim if the only window left open is a NERDTree
" autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTreeType") && b:NERDTreeType == "primary") | q | endif
" Pathogen
execute pathogen#infect()
syntax on
filetype plugin indent on
" TagBar settings
nmap <leader>l <ESC>:TagbarToggle<cr>
" MiniBufferExplorer settings
let g:miniBufExplMapWindowNavVim = 1
let g:miniBufExplMapWindowNavArrows = 1
let g:miniBufExplMapCTabSwitchBufs = 1
let g:miniBufExplModSelTarget = 1
noremap <leader>n :bn<cr>
noremap <leader>p :bp<cr>
noremap <leader>d :bd<cr>