-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.vimrc-base
134 lines (108 loc) · 3.53 KB
/
.vimrc-base
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
syntax on
set autoindent
set backup
set backupdir=$HOME/.vim/backup
set background=dark
set backspace=indent,eol,start
set cmdheight=2
set directory=$HOME/.vim/tmp
set exrc
set foldmethod=indent
set guioptions+=b
set hidden
set hlsearch
set ignorecase
set incsearch
set listchars=tab:▸\ ,eol:¬,trail:·
set mouse=a
set nocompatible
set nofoldenable
set nowrap
set number
set redrawtime=10000 " Allow more time for loading syntax on large files
set relativenumber
set ruler
set scrolloff=8
set sidescrolloff=8
set showcmd
set showmatch
set smartcase
set smartindent
set statusline=%t
set title
set tabstop=2 softtabstop=2 shiftwidth=2 noexpandtab
set updatetime=300 " Reduce time for highlighting other references
set undofile
set wildmode=longest:full,full
filetype plugin indent on
augroup vimrcEx
autocmd!
" When editing a file, always jump to the last known cursor position.
" Don't do it for commit messages, when the position is invalid, or when
" inside an event handler (happens when dropping a file on gvim).
autocmd BufReadPost *
\ if &ft != 'gitcommit' && line("'\"") > 0 && line("'\"") <= line("$") |
\ exe "normal g`\"" |
\ endif
" Set syntax highlighting for specific file types
autocmd BufRead,BufNewFile *.md set filetype=markdown
autocmd BufNewFile,BufRead *.es6 set filetype=javascript
autocmd BufNewFile,BufRead *.php set filetype=php
autocmd BufNewFile,BufRead *.hbs set filetype=handlebars
autocmd BufNewFile,BufRead *.blade.php set filetype=blade
" Enable spellchecking for Markdown
autocmd FileType markdown setlocal spell
" Automatically wrap at 96 characters and spell check commit messages
autocmd FileType gitcommit setlocal textwidth=96
autocmd FileType gitcommit setlocal spell
" Allow stylesheets to autocomplete hyphenated words
autocmd FileType css,scss,sass setlocal iskeyword+=-
" Set tab policy for PHP files
autocmd FileType php setlocal shiftwidth=4 tabstop=4 expandtab
augroup END
"------------------------- MAPPINGS ----------------------------"
" let mapleader = "\<space>"
" Wrap text
nmap <Leader>w :set wrap!<CR>
" Show invisible characters
nmap <Leader>l :set list!<CR>
" Save + quit the current viewport
map <Leader>q :q <CR>
" Opens an edit command with the path of the currently edited file filled in
" Normal mode: <Leader>e
nmap <Leader>e :e <C-R>=expand("%:p:h") . "/" <CR>
" Opens a tab edit command with the path of the currently edited file filled
" in
" Normal mode: <Leader>t
nmap <Leader>te :tabedit <C-R>=expand("%:p:h") . "/" <CR>
nmap <Leader>n :tabnext<CR>
nmap <Leader>N :tabprevious<CR>
nmap <Leader>0 :tabfirst<CR>
" Reselect visual selection after indenting
vnoremap < <gv
vnoremap > >gv
" Maintain the cursor position when yanking a visual selection
" http://ddrscott.github.io/blog/2016/yank-without-jank/
vnoremap y myy`y
vnoremap y myY`y
" Opens a vertical split command with the path of the currently edited file
" filled in
" Normal mode: <Leader>v
nmap <Leader>v :vsplit <C-R>=expand("%:p:h") . "/" <CR>
" Edit vimrc file
nmap <Leader>ev :tabedit ~/.vimrc-base<cr>
"------------------------- SPLITS ----------------------------"
set splitbelow
set splitright
nmap <C-J> <C-W><C-J>
nmap <C-K> <C-W><C-K>
nmap <C-H> <C-W><C-H>
nmap <C-L> <C-W><C-L>
" Opens a vertical split command with the path of the currently edited file
" filled in
" Normal mode: <Leader>v
nmap <Leader>v :vsplit <C-R>=expand("%:p:h") . "/" <CR>
" Opens a vertical split command with the path of the currently edited file
" filled in
" Normal mode: <Leader>v
nmap <Leader>s :split <C-R>=expand("%:p:h") . "/" <CR>