Mercurial > ec-dotfiles
annotate rc/vimrc @ 638:d36b8abe71ec
[bash] Fix tmux version parser
author | nanaya <me@nanaya.pro> |
---|---|
date | Wed, 15 Jan 2020 22:42:56 +0900 |
parents | 758ced52ee62 |
children | 84a1e86d1afc |
rev | line source |
---|---|
607 | 1 if $TERM == 'screen' |
2 set t_Co=256 | |
3 endif | |
4 | |
525
1dd96a55b7ac
Invoke nocompatible earliest so it doesn't override anything preceeded it.
edogawaconan <me@myconan.net>
parents:
503
diff
changeset
|
5 set nocompatible |
424 | 6 set showmode " shows mode insert/replace/visual |
7 set showcmd " shows last command on screen | |
8 set nomodeline " disallow automatic vim command execution on arbitrary file | |
3 | 9 set autoindent |
10 set lazyredraw | |
424 | 11 set vb t_vb= " disables visual bell |
3 | 12 set ruler |
424 | 13 set backspace=2 " make backspace work like most other apps |
3 | 14 set esckeys |
15 set noerrorbells | |
637 | 16 set backupcopy=yes |
544
75c30f2b4694
Add special setting for ruby, global default to 4/noet (ruby is 2/et).
edogawaconan <me@myconan.net>
parents:
542
diff
changeset
|
17 |
574 | 18 set softtabstop=4 tabstop=4 shiftwidth=4 expandtab |
544
75c30f2b4694
Add special setting for ruby, global default to 4/noet (ruby is 2/et).
edogawaconan <me@myconan.net>
parents:
542
diff
changeset
|
19 |
535
70d4fb4f7d9f
copyindent instead of expandtab.
edogawaconan <me@myconan.net>
parents:
531
diff
changeset
|
20 set copyindent |
32 | 21 set title |
531 | 22 set incsearch |
23 set ignorecase | |
24 set smartcase | |
424 | 25 set hlsearch |
26 set ls=2 " always show status line | |
556 | 27 |
577 | 28 set hidden " it's buffer time? |
29 | |
424 | 30 set list listchars=tab:>-,trail:.,extends:> |
570
3bd22b75cdc4
Make sure autocmd is executed when vim has it.
nanaya <me@myconan.net>
parents:
565
diff
changeset
|
31 |
3bd22b75cdc4
Make sure autocmd is executed when vim has it.
nanaya <me@myconan.net>
parents:
565
diff
changeset
|
32 if has("autocmd") |
3bd22b75cdc4
Make sure autocmd is executed when vim has it.
nanaya <me@myconan.net>
parents:
565
diff
changeset
|
33 autocmd colorscheme * highlight specialkey ctermfg=gray |
3bd22b75cdc4
Make sure autocmd is executed when vim has it.
nanaya <me@myconan.net>
parents:
565
diff
changeset
|
34 autocmd colorscheme * highlight linenr ctermfg=gray ctermbg=black |
3bd22b75cdc4
Make sure autocmd is executed when vim has it.
nanaya <me@myconan.net>
parents:
565
diff
changeset
|
35 endif |
556 | 36 |
424 | 37 set number |
38 | |
529
de3ff51840a3
Skip clipboard loading for speedup in current setup.
edogawaconan <me@myconan.net>
parents:
525
diff
changeset
|
39 " http://stackoverflow.com/questions/14635295/vim-takes-a-very-long-time-to-start-up |
de3ff51840a3
Skip clipboard loading for speedup in current setup.
edogawaconan <me@myconan.net>
parents:
525
diff
changeset
|
40 set clipboard=exclude:.* |
de3ff51840a3
Skip clipboard loading for speedup in current setup.
edogawaconan <me@myconan.net>
parents:
525
diff
changeset
|
41 |
571 | 42 if has("eval") |
43 execute pathogen#infect() | |
424 | 44 endif |
571 | 45 |
424 | 46 if has('filetype') |
47 filetype plugin indent on | |
48 endif | |
33 | 49 |
50 map <C-t><up> :tabr<cr> | |
51 map <C-t><down> :tabl<cr> | |
52 map <C-t><left> :tabp<cr> | |
53 map <C-t><right> :tabn<cr> | |
35
a8dc309a1b8a
Misc adjusments for vim keys
Edho Prima Arief <me@myconan.net>
parents:
33
diff
changeset
|
54 map <C-t>p :tabp<cr> |
a8dc309a1b8a
Misc adjusments for vim keys
Edho Prima Arief <me@myconan.net>
parents:
33
diff
changeset
|
55 map <C-t>n :tabn<cr> |
33 | 56 map <C-t><C-t> :NERDTreeToggle<cr> |
57 map <C-t><C-m> :NERDTreeMirror<cr> | |
58 | |
531 | 59 " clears out highlight |
635
5d3ce722285a
Use function keys for some functions
nanaya <me@nanaya.pro>
parents:
626
diff
changeset
|
60 nmap <esc>[13~ <esc>:nohlsearch<cr> |
531 | 61 |
62 " toggles paste mode | |
635
5d3ce722285a
Use function keys for some functions
nanaya <me@nanaya.pro>
parents:
626
diff
changeset
|
63 nmap <esc>[14~ <esc>:set paste!<cr> |
531 | 64 |
65 " removes prefix for windows copypasta | |
635
5d3ce722285a
Use function keys for some functions
nanaya <me@nanaya.pro>
parents:
626
diff
changeset
|
66 nmap <esc>[15~ <esc>:set number! list!<cr> |
424 | 67 |
467 | 68 " format JSON |
69 map <leader>j <esc>:%!python -m json.tool<cr> | |
70 | |
531 | 71 " visual navigation instead of logical |
72 nmap j gj | |
73 nmap k gk | |
74 | |
33 | 75 "autocmd VimEnter * NERDTree |
76 "autocmd BufEnter * NERDTreeMirror | |
77 | |
329
ea82caf6c059
Added test to verify vim version (lite or full).
Edho Arief <edho@myconan.net>
parents:
315
diff
changeset
|
78 if has('syntax') |
ea82caf6c059
Added test to verify vim version (lite or full).
Edho Arief <edho@myconan.net>
parents:
315
diff
changeset
|
79 syntax on |
431 | 80 set foldmethod=syntax |
432 | 81 set nofoldenable |
446
3022c5d1f8ed
Back to dark theme for compatibility with non-personal systems.
Edho Arief <edho@myconan.net>
parents:
432
diff
changeset
|
82 set background=dark |
554 | 83 |
606 | 84 colorscheme srcery-drk |
329
ea82caf6c059
Added test to verify vim version (lite or full).
Edho Arief <edho@myconan.net>
parents:
315
diff
changeset
|
85 endif |
350 | 86 |
87 if has("autocmd") | |
544
75c30f2b4694
Add special setting for ruby, global default to 4/noet (ruby is 2/et).
edogawaconan <me@myconan.net>
parents:
542
diff
changeset
|
88 function In2() |
75c30f2b4694
Add special setting for ruby, global default to 4/noet (ruby is 2/et).
edogawaconan <me@myconan.net>
parents:
542
diff
changeset
|
89 set softtabstop=2 tabstop=2 shiftwidth=2 expandtab |
75c30f2b4694
Add special setting for ruby, global default to 4/noet (ruby is 2/et).
edogawaconan <me@myconan.net>
parents:
542
diff
changeset
|
90 endfunction |
75c30f2b4694
Add special setting for ruby, global default to 4/noet (ruby is 2/et).
edogawaconan <me@myconan.net>
parents:
542
diff
changeset
|
91 |
75c30f2b4694
Add special setting for ruby, global default to 4/noet (ruby is 2/et).
edogawaconan <me@myconan.net>
parents:
542
diff
changeset
|
92 function In4() |
574 | 93 set softtabstop=4 tabstop=4 shiftwidth=4 expandtab |
544
75c30f2b4694
Add special setting for ruby, global default to 4/noet (ruby is 2/et).
edogawaconan <me@myconan.net>
parents:
542
diff
changeset
|
94 endfunction |
75c30f2b4694
Add special setting for ruby, global default to 4/noet (ruby is 2/et).
edogawaconan <me@myconan.net>
parents:
542
diff
changeset
|
95 |
574 | 96 function In4t() |
97 set softtabstop=4 tabstop=4 shiftwidth=4 noexpandtab | |
98 endfunction | |
563
7cac401e5c78
Add configurable to always assume two spaces/no tab in vim.
nanaya <me@myconan.net>
parents:
560
diff
changeset
|
99 |
545
c9ea8dd9d382
Remove unnecessary json configs.
edogawaconan <me@myconan.net>
parents:
544
diff
changeset
|
100 " required by syntax file |
c9ea8dd9d382
Remove unnecessary json configs.
edogawaconan <me@myconan.net>
parents:
544
diff
changeset
|
101 " reference: https://github.com/elzr/vim-json/blob/master/ftplugin/json.vim |
c9ea8dd9d382
Remove unnecessary json configs.
edogawaconan <me@myconan.net>
parents:
544
diff
changeset
|
102 let g:vim_json_syntax_conceal = 1 |
544
75c30f2b4694
Add special setting for ruby, global default to 4/noet (ruby is 2/et).
edogawaconan <me@myconan.net>
parents:
542
diff
changeset
|
103 |
539
05785a85d603
Fix json syntax highlighter config.
edogawaconan <me@myconan.net>
parents:
538
diff
changeset
|
104 autocmd BufNewFile,BufRead *.json set filetype=json |
05785a85d603
Fix json syntax highlighter config.
edogawaconan <me@myconan.net>
parents:
538
diff
changeset
|
105 autocmd BufNewFile,BufRead *.jsonp set filetype=json |
541 | 106 autocmd BufRead,BufNewFile *.blade.php set filetype=blade |
107 autocmd BufRead,BufNewFile *.coffee set filetype=coffee | |
108 autocmd BufRead,BufNewFile *.erb set filetype=eruby | |
109 autocmd BufRead,BufNewFile *.less set filetype=less | |
110 autocmd BufRead,BufNewFile *.scss set filetype=scss | |
111 autocmd BufRead,BufNewFile *.slim set filetype=slim | |
112 autocmd BufRead,BufNewFile Gemfile set filetype=ruby | |
560 | 113 autocmd BufRead,BufNewFile Vagrantfile set filetype=ruby |
541 | 114 autocmd BufRead,BufNewFile config.ru set filetype=ruby |
115 autocmd BufRead,BufNewFile supervisord.conf set filetype=dosini | |
622 | 116 autocmd BufRead,BufNewFile php-fpm.conf set filetype=dosini |
117 autocmd BufRead,BufNewFile */php-fpm.d/* set filetype=dosini | |
620 | 118 " stolen from https://github.com/leafgarland/typescript-vim/blob/master/ftdetect/typescript.vim |
119 " use `set filetype` to override default filetype=xml for *.ts files | |
120 autocmd BufNewFile,BufRead *.ts set filetype=typescript | |
634
ced2ee9efd9f
Update various syntaxes to the ones in vim repo
nanaya <me@nanaya.pro>
parents:
633
diff
changeset
|
121 autocmd BufNewFile,BufRead *.tsx set filetype=typescriptreact |
544
75c30f2b4694
Add special setting for ruby, global default to 4/noet (ruby is 2/et).
edogawaconan <me@myconan.net>
parents:
542
diff
changeset
|
122 |
596 | 123 autocmd BufRead,BufNewFile *.nginx set ft=nginx |
124 autocmd BufRead,BufNewFile */etc/nginx/* set ft=nginx | |
125 autocmd BufRead,BufNewFile */usr/local/nginx/conf/* set ft=nginx | |
126 autocmd BufRead,BufNewFile */opt/nginx/conf/* set ft=nginx | |
127 autocmd BufRead,BufNewFile nginx.conf set ft=nginx | |
128 | |
550 | 129 autocmd FileType coffee call In2() |
626 | 130 autocmd FileType css call In2() |
550 | 131 autocmd FileType eruby call In2() |
544
75c30f2b4694
Add special setting for ruby, global default to 4/noet (ruby is 2/et).
edogawaconan <me@myconan.net>
parents:
542
diff
changeset
|
132 autocmd FileType ruby call In2() |
550 | 133 autocmd FileType scss call In2() |
575 | 134 autocmd FileType less call In2() |
550 | 135 autocmd FileType yaml call In2() |
616
dc2070cb5d71
Default json to 2 spaces indentation
nanaya <me@nanaya.pro>
parents:
607
diff
changeset
|
136 autocmd FileType json call In2() |
617 | 137 autocmd FileType javascript call In2() |
624 | 138 autocmd FileType typescript call In2() |
637 | 139 autocmd FileType typescriptreact call In2() |
596 | 140 autocmd FileType nginx setlocal commentstring=#\ %s |
602 | 141 autocmd FileType nginx setlocal iskeyword& |
350 | 142 endif |
412
7ceec4404caf
Add restore cursor position for vim.
Edho Arief <edho@myconan.net>
parents:
410
diff
changeset
|
143 |
448
e0e8de4135bc
Testing for function never returns true. Replaced with autocmd.
Edho Arief <edho@myconan.net>
parents:
446
diff
changeset
|
144 if has('autocmd') |
418
c0ac21407903
Disable features on vim basic.
Edho Arief <edho@myconan.net>
parents:
412
diff
changeset
|
145 "Restore cursor position |
c0ac21407903
Disable features on vim basic.
Edho Arief <edho@myconan.net>
parents:
412
diff
changeset
|
146 set viminfo='10,\"100,:20,%,n~/.viminfo |
c0ac21407903
Disable features on vim basic.
Edho Arief <edho@myconan.net>
parents:
412
diff
changeset
|
147 function! ResCur() |
c0ac21407903
Disable features on vim basic.
Edho Arief <edho@myconan.net>
parents:
412
diff
changeset
|
148 if line("'\"") <= line("$") |
c0ac21407903
Disable features on vim basic.
Edho Arief <edho@myconan.net>
parents:
412
diff
changeset
|
149 normal! g`" |
c0ac21407903
Disable features on vim basic.
Edho Arief <edho@myconan.net>
parents:
412
diff
changeset
|
150 return 1 |
c0ac21407903
Disable features on vim basic.
Edho Arief <edho@myconan.net>
parents:
412
diff
changeset
|
151 endif |
c0ac21407903
Disable features on vim basic.
Edho Arief <edho@myconan.net>
parents:
412
diff
changeset
|
152 endfunction |
c0ac21407903
Disable features on vim basic.
Edho Arief <edho@myconan.net>
parents:
412
diff
changeset
|
153 augroup resCur |
c0ac21407903
Disable features on vim basic.
Edho Arief <edho@myconan.net>
parents:
412
diff
changeset
|
154 autocmd! |
c0ac21407903
Disable features on vim basic.
Edho Arief <edho@myconan.net>
parents:
412
diff
changeset
|
155 autocmd BufWinEnter * call ResCur() |
c0ac21407903
Disable features on vim basic.
Edho Arief <edho@myconan.net>
parents:
412
diff
changeset
|
156 augroup END |
496
6bdf99bfbe97
Newer git use different filename, I think.
edogawaconan <me@myconan.net>
parents:
494
diff
changeset
|
157 autocmd BufWinEnter */.git/COMMIT_EDITMSG exe "normal! gg" |
451
abb434518e1f
Always start editing git commit message from line 1.
Edho Arief <edho@myconan.net>
parents:
448
diff
changeset
|
158 autocmd BufWinEnter .git/COMMIT_EDITMSG exe "normal! gg" |
418
c0ac21407903
Disable features on vim basic.
Edho Arief <edho@myconan.net>
parents:
412
diff
changeset
|
159 endif |
424 | 160 |
161 if has('statusline') | |
162 " Status line detail: | |
163 " %f file path | |
164 " %y file type between braces (if defined) | |
165 " %([%R%M]%) read-only, modified and modifiable flags between braces | |
166 " %{'!'[&ff=='default_file_format']} | |
167 " shows a '!' if the file format is not the platform | |
168 " default | |
169 " %{'$'[!&list]} shows a '*' if in list mode | |
170 " %{'~'[&pm=='']} shows a '~' if in patchmode | |
171 " (%{synIDattr(synID(line('.'),col('.'),0),'name')}) | |
172 " only for debug : display the current syntax item name | |
173 " %= right-align following items | |
174 " #%n buffer number | |
175 " %l/%L,%c%V line number, total number of lines, and column number | |
176 function SetStatusLineStyle() | |
177 if &stl == '' || &stl =~ 'synID' | |
178 let &stl="%f %y%([%R%M]%)%{'!'[&ff=='".&ff."']}%{'$'[!&list]}%{'~'[&pm=='']}%=#%n %l/%L,%c%V " | |
179 else | |
180 let &stl="%f %y%([%R%M]%)%{'!'[&ff=='".&ff."']}%{'$'[!&list]} (%{synIDattr(synID(line('.'),col('.'),0),'name')})%=#%n %l/%L,%c%V " | |
181 endif | |
182 endfunc | |
183 " Switch between the normal and vim-debug modes in the status line | |
184 nmap _ds :call SetStatusLineStyle()<CR> | |
185 call SetStatusLineStyle() | |
186 " Window title | |
187 if has('title') | |
493
1ad9091c464e
Properly set window name for vim.
edogawaconan <me@myconan.net>
parents:
476
diff
changeset
|
188 if &term == "screen" |
1ad9091c464e
Properly set window name for vim.
edogawaconan <me@myconan.net>
parents:
476
diff
changeset
|
189 set t_ts=]0; |
1ad9091c464e
Properly set window name for vim.
edogawaconan <me@myconan.net>
parents:
476
diff
changeset
|
190 set t_fs= |
1ad9091c464e
Properly set window name for vim.
edogawaconan <me@myconan.net>
parents:
476
diff
changeset
|
191 endif |
494 | 192 set title |
193 let &titlestring = $user | |
424 | 194 endif |
195 endif | |
618 | 196 |
619 | 197 if filereadable($HOME."/.vimrc.local") |
198 source $HOME/.vimrc.local | |
618 | 199 endif |