annotate rc/vimrc @ 716:42e58cea7821

[vimrc] Remove unused craps
author nanaya <me@nanaya.net>
date Mon, 19 Dec 2022 05:39:15 +0900
parents 0466907e566a
children 2cfa6fb4e755 19909a0557af
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
607
46f0abe12092 More colors
nanaya <me@nanaya.pro>
parents: 606
diff changeset
1 if $TERM == 'screen'
46f0abe12092 More colors
nanaya <me@nanaya.pro>
parents: 606
diff changeset
2 set t_Co=256
46f0abe12092 More colors
nanaya <me@nanaya.pro>
parents: 606
diff changeset
3 endif
46f0abe12092 More colors
nanaya <me@nanaya.pro>
parents: 606
diff changeset
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
b86827ee1aae Various vimrc cleanup.
Edho Arief <edho@myconan.net>
parents: 423
diff changeset
6 set showmode " shows mode insert/replace/visual
b86827ee1aae Various vimrc cleanup.
Edho Arief <edho@myconan.net>
parents: 423
diff changeset
7 set showcmd " shows last command on screen
b86827ee1aae Various vimrc cleanup.
Edho Arief <edho@myconan.net>
parents: 423
diff changeset
8 set nomodeline " disallow automatic vim command execution on arbitrary file
3
39ef7f7236fc Added vimrc.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
9 set autoindent
39ef7f7236fc Added vimrc.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
10 set lazyredraw
424
b86827ee1aae Various vimrc cleanup.
Edho Arief <edho@myconan.net>
parents: 423
diff changeset
11 set vb t_vb= " disables visual bell
3
39ef7f7236fc Added vimrc.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
12 set ruler
424
b86827ee1aae Various vimrc cleanup.
Edho Arief <edho@myconan.net>
parents: 423
diff changeset
13 set backspace=2 " make backspace work like most other apps
3
39ef7f7236fc Added vimrc.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
14 set esckeys
39ef7f7236fc Added vimrc.
Edho Prima Arief <me@myconan.net>
parents:
diff changeset
15 set noerrorbells
637
758ced52ee62 [vim] Fix typescript syntax
nanaya <me@nanaya.pro>
parents: 636
diff changeset
16 set backupcopy=yes
641
84a1e86d1afc [vimrc] Prevent pointer to stick at the bottom of screen
nanaya <me@nanaya.pro>
parents: 637
diff changeset
17 set scrolloff=5
680
a34ee4c7d0ce [vimrc] Newer vim seem to have mouse enabled by default?
nanaya <me@nanaya.pro>
parents: 671
diff changeset
18 set mouse= " disables mouse usage
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
574
562fff349744 Default 4 spaces without tab.
nanaya <me@myconan.net>
parents: 571
diff changeset
20 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
21
535
70d4fb4f7d9f copyindent instead of expandtab.
edogawaconan <me@myconan.net>
parents: 531
diff changeset
22 set copyindent
32
2cf5492ac78d Vim title.
Edho Prima Arief <me@myconan.net>
parents: 3
diff changeset
23 set title
531
d6e08a057094 Updates to vim settings.
edogawaconan <me@myconan.net>
parents: 529
diff changeset
24 set incsearch
d6e08a057094 Updates to vim settings.
edogawaconan <me@myconan.net>
parents: 529
diff changeset
25 set ignorecase
d6e08a057094 Updates to vim settings.
edogawaconan <me@myconan.net>
parents: 529
diff changeset
26 set smartcase
424
b86827ee1aae Various vimrc cleanup.
Edho Arief <edho@myconan.net>
parents: 423
diff changeset
27 set hlsearch
b86827ee1aae Various vimrc cleanup.
Edho Arief <edho@myconan.net>
parents: 423
diff changeset
28 set ls=2 " always show status line
556
4190bd0b4456 Better color for spaces and tabs.
nanaya <me@myconan.net>
parents: 555
diff changeset
29
577
28bd58aaa0ab Buffer in vim?
nanaya <me@myconan.net>
parents: 575
diff changeset
30 set hidden " it's buffer time?
28bd58aaa0ab Buffer in vim?
nanaya <me@myconan.net>
parents: 575
diff changeset
31
648
2bb0035876b1 Track weird spaces
nanaya <me@nanaya.pro>
parents: 647
diff changeset
32 set list listchars=tab:>-,trail:.,extends:>,nbsp:?
570
3bd22b75cdc4 Make sure autocmd is executed when vim has it.
nanaya <me@myconan.net>
parents: 565
diff changeset
33
424
b86827ee1aae Various vimrc cleanup.
Edho Arief <edho@myconan.net>
parents: 423
diff changeset
34 set number
b86827ee1aae Various vimrc cleanup.
Edho Arief <edho@myconan.net>
parents: 423
diff changeset
35
529
de3ff51840a3 Skip clipboard loading for speedup in current setup.
edogawaconan <me@myconan.net>
parents: 525
diff changeset
36 " 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
37 set clipboard=exclude:.*
de3ff51840a3 Skip clipboard loading for speedup in current setup.
edogawaconan <me@myconan.net>
parents: 525
diff changeset
38
682
88888f40c628 [vimrc] Disable indent plugin
nanaya <me@nanaya.pro>
parents: 680
diff changeset
39 filetype plugin on
88888f40c628 [vimrc] Disable indent plugin
nanaya <me@nanaya.pro>
parents: 680
diff changeset
40 filetype indent off
33
330587be514c Better vim support.
Edho Prima Arief <me@myconan.net>
parents: 32
diff changeset
41
330587be514c Better vim support.
Edho Prima Arief <me@myconan.net>
parents: 32
diff changeset
42 map <C-t><up> :tabr<cr>
330587be514c Better vim support.
Edho Prima Arief <me@myconan.net>
parents: 32
diff changeset
43 map <C-t><down> :tabl<cr>
330587be514c Better vim support.
Edho Prima Arief <me@myconan.net>
parents: 32
diff changeset
44 map <C-t><left> :tabp<cr>
330587be514c Better vim support.
Edho Prima Arief <me@myconan.net>
parents: 32
diff changeset
45 map <C-t><right> :tabn<cr>
35
a8dc309a1b8a Misc adjusments for vim keys
Edho Prima Arief <me@myconan.net>
parents: 33
diff changeset
46 map <C-t>p :tabp<cr>
a8dc309a1b8a Misc adjusments for vim keys
Edho Prima Arief <me@myconan.net>
parents: 33
diff changeset
47 map <C-t>n :tabn<cr>
33
330587be514c Better vim support.
Edho Prima Arief <me@myconan.net>
parents: 32
diff changeset
48 map <C-t><C-t> :NERDTreeToggle<cr>
330587be514c Better vim support.
Edho Prima Arief <me@myconan.net>
parents: 32
diff changeset
49 map <C-t><C-m> :NERDTreeMirror<cr>
330587be514c Better vim support.
Edho Prima Arief <me@myconan.net>
parents: 32
diff changeset
50
531
d6e08a057094 Updates to vim settings.
edogawaconan <me@myconan.net>
parents: 529
diff changeset
51 " clears out highlight
635
5d3ce722285a Use function keys for some functions
nanaya <me@nanaya.pro>
parents: 626
diff changeset
52 nmap <esc>[13~ <esc>:nohlsearch<cr>
659
be98916b55df [vimrc] Support xorg native function keys
nanaya <me@nanaya.pro>
parents: 650
diff changeset
53 nmap <F3> <esc>:set paste!<cr>
531
d6e08a057094 Updates to vim settings.
edogawaconan <me@myconan.net>
parents: 529
diff changeset
54
d6e08a057094 Updates to vim settings.
edogawaconan <me@myconan.net>
parents: 529
diff changeset
55 " toggles paste mode
635
5d3ce722285a Use function keys for some functions
nanaya <me@nanaya.pro>
parents: 626
diff changeset
56 nmap <esc>[14~ <esc>:set paste!<cr>
659
be98916b55df [vimrc] Support xorg native function keys
nanaya <me@nanaya.pro>
parents: 650
diff changeset
57 nmap <F4> <esc>:set paste!<cr>
531
d6e08a057094 Updates to vim settings.
edogawaconan <me@myconan.net>
parents: 529
diff changeset
58
d6e08a057094 Updates to vim settings.
edogawaconan <me@myconan.net>
parents: 529
diff changeset
59 " removes prefix for windows copypasta
635
5d3ce722285a Use function keys for some functions
nanaya <me@nanaya.pro>
parents: 626
diff changeset
60 nmap <esc>[15~ <esc>:set number! list!<cr>
659
be98916b55df [vimrc] Support xorg native function keys
nanaya <me@nanaya.pro>
parents: 650
diff changeset
61 nmap <F5> <esc>:set number! list!<cr>
424
b86827ee1aae Various vimrc cleanup.
Edho Arief <edho@myconan.net>
parents: 423
diff changeset
62
467
8ef5ddb9b54b Support for json
Edho Arief <edho@myconan.net>
parents: 454
diff changeset
63 " format JSON
8ef5ddb9b54b Support for json
Edho Arief <edho@myconan.net>
parents: 454
diff changeset
64 map <leader>j <esc>:%!python -m json.tool<cr>
8ef5ddb9b54b Support for json
Edho Arief <edho@myconan.net>
parents: 454
diff changeset
65
531
d6e08a057094 Updates to vim settings.
edogawaconan <me@myconan.net>
parents: 529
diff changeset
66 " visual navigation instead of logical
d6e08a057094 Updates to vim settings.
edogawaconan <me@myconan.net>
parents: 529
diff changeset
67 nmap j gj
d6e08a057094 Updates to vim settings.
edogawaconan <me@myconan.net>
parents: 529
diff changeset
68 nmap k gk
d6e08a057094 Updates to vim settings.
edogawaconan <me@myconan.net>
parents: 529
diff changeset
69
33
330587be514c Better vim support.
Edho Prima Arief <me@myconan.net>
parents: 32
diff changeset
70 "autocmd VimEnter * NERDTree
330587be514c Better vim support.
Edho Prima Arief <me@myconan.net>
parents: 32
diff changeset
71 "autocmd BufEnter * NERDTreeMirror
330587be514c Better vim support.
Edho Prima Arief <me@myconan.net>
parents: 32
diff changeset
72
329
ea82caf6c059 Added test to verify vim version (lite or full).
Edho Arief <edho@myconan.net>
parents: 315
diff changeset
73 if has('syntax')
ea82caf6c059 Added test to verify vim version (lite or full).
Edho Arief <edho@myconan.net>
parents: 315
diff changeset
74 syntax on
650
6ca63cec0879 [vim] Disable foldmethod to speed up things
nanaya <me@nanaya.pro>
parents: 648
diff changeset
75 set foldmethod=manual
432
087278fd11d8 Don't fold by default.
Edho Arief <edho@myconan.net>
parents: 431
diff changeset
76 set nofoldenable
446
3022c5d1f8ed Back to dark theme for compatibility with non-personal systems.
Edho Arief <edho@myconan.net>
parents: 432
diff changeset
77 set background=dark
554
135eb73da114 Missing newline :D
nanaya <me@myconan.net>
parents: 551
diff changeset
78
666
f5e12f656c03 [vimrc] move color adjustment closer to colorscheme definition
nanaya <me@nanaya.pro>
parents: 665
diff changeset
79 if has("autocmd")
667
6887e66d83b4 [vim] The specialthing color is way better using the provided theme
nanaya <me@nanaya.pro>
parents: 666
diff changeset
80 "autocmd colorscheme * highlight specialkey ctermfg=gray
666
f5e12f656c03 [vimrc] move color adjustment closer to colorscheme definition
nanaya <me@nanaya.pro>
parents: 665
diff changeset
81 endif
f5e12f656c03 [vimrc] move color adjustment closer to colorscheme definition
nanaya <me@nanaya.pro>
parents: 665
diff changeset
82
709
0466907e566a [vimrc] adjust configs
nanaya <me@nanaya.net>
parents: 708
diff changeset
83 let g:ctrlp_clear_cache_on_exit = 0
0466907e566a [vimrc] adjust configs
nanaya <me@nanaya.net>
parents: 708
diff changeset
84 let g:ctrlp_prompt_mappings = {
0466907e566a [vimrc] adjust configs
nanaya <me@nanaya.net>
parents: 708
diff changeset
85 \ 'PrtClearCache()': ['<F5>', '<esc>[15~'],
0466907e566a [vimrc] adjust configs
nanaya <me@nanaya.net>
parents: 708
diff changeset
86 \ }
708
a161ebf80311 [vimrc] add ctrlp by default
nanaya <me@nanaya.net>
parents: 704
diff changeset
87 packadd! ctrlp.vim
709
0466907e566a [vimrc] adjust configs
nanaya <me@nanaya.net>
parents: 708
diff changeset
88
0466907e566a [vimrc] adjust configs
nanaya <me@nanaya.net>
parents: 708
diff changeset
89 let g:srcery_bg_passthrough=1
704
1e0f578f6752 Update vendor and add support for vim packs
nanaya <me@nanaya.net>
parents: 687
diff changeset
90 packadd! srcery-vim
662
f280738a90a6 [vim] vendor theme and add some more
nanaya <me@nanaya.pro>
parents: 659
diff changeset
91 colorscheme srcery
329
ea82caf6c059 Added test to verify vim version (lite or full).
Edho Arief <edho@myconan.net>
parents: 315
diff changeset
92 endif
350
47fbc05cacce vim per file control.
Edho Arief <edho@myconan.net>
parents: 339
diff changeset
93
47fbc05cacce vim per file control.
Edho Arief <edho@myconan.net>
parents: 339
diff changeset
94 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
95 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
96 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
97 endfunction
75c30f2b4694 Add special setting for ruby, global default to 4/noet (ruby is 2/et).
edogawaconan <me@myconan.net>
parents: 542
diff changeset
98
75c30f2b4694 Add special setting for ruby, global default to 4/noet (ruby is 2/et).
edogawaconan <me@myconan.net>
parents: 542
diff changeset
99 function In4()
574
562fff349744 Default 4 spaces without tab.
nanaya <me@myconan.net>
parents: 571
diff changeset
100 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
101 endfunction
75c30f2b4694 Add special setting for ruby, global default to 4/noet (ruby is 2/et).
edogawaconan <me@myconan.net>
parents: 542
diff changeset
102
574
562fff349744 Default 4 spaces without tab.
nanaya <me@myconan.net>
parents: 571
diff changeset
103 function In4t()
562fff349744 Default 4 spaces without tab.
nanaya <me@myconan.net>
parents: 571
diff changeset
104 set softtabstop=4 tabstop=4 shiftwidth=4 noexpandtab
562fff349744 Default 4 spaces without tab.
nanaya <me@myconan.net>
parents: 571
diff changeset
105 endfunction
563
7cac401e5c78 Add configurable to always assume two spaces/no tab in vim.
nanaya <me@myconan.net>
parents: 560
diff changeset
106
545
c9ea8dd9d382 Remove unnecessary json configs.
edogawaconan <me@myconan.net>
parents: 544
diff changeset
107 " required by syntax file
c9ea8dd9d382 Remove unnecessary json configs.
edogawaconan <me@myconan.net>
parents: 544
diff changeset
108 " 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
109 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
110
539
05785a85d603 Fix json syntax highlighter config.
edogawaconan <me@myconan.net>
parents: 538
diff changeset
111 autocmd BufNewFile,BufRead *.json set filetype=json
05785a85d603 Fix json syntax highlighter config.
edogawaconan <me@myconan.net>
parents: 538
diff changeset
112 autocmd BufNewFile,BufRead *.jsonp set filetype=json
541
5cdef8f4360f Cleanup file type setters.
edogawaconan <me@myconan.net>
parents: 540
diff changeset
113 autocmd BufRead,BufNewFile *.blade.php set filetype=blade
5cdef8f4360f Cleanup file type setters.
edogawaconan <me@myconan.net>
parents: 540
diff changeset
114 autocmd BufRead,BufNewFile *.coffee set filetype=coffee
5cdef8f4360f Cleanup file type setters.
edogawaconan <me@myconan.net>
parents: 540
diff changeset
115 autocmd BufRead,BufNewFile *.erb set filetype=eruby
5cdef8f4360f Cleanup file type setters.
edogawaconan <me@myconan.net>
parents: 540
diff changeset
116 autocmd BufRead,BufNewFile *.less set filetype=less
5cdef8f4360f Cleanup file type setters.
edogawaconan <me@myconan.net>
parents: 540
diff changeset
117 autocmd BufRead,BufNewFile *.scss set filetype=scss
5cdef8f4360f Cleanup file type setters.
edogawaconan <me@myconan.net>
parents: 540
diff changeset
118 autocmd BufRead,BufNewFile *.slim set filetype=slim
5cdef8f4360f Cleanup file type setters.
edogawaconan <me@myconan.net>
parents: 540
diff changeset
119 autocmd BufRead,BufNewFile Gemfile set filetype=ruby
560
41e5f907aca3 Vagrantfile is ruby.
nanaya <me@myconan.net>
parents: 557
diff changeset
120 autocmd BufRead,BufNewFile Vagrantfile set filetype=ruby
541
5cdef8f4360f Cleanup file type setters.
edogawaconan <me@myconan.net>
parents: 540
diff changeset
121 autocmd BufRead,BufNewFile config.ru set filetype=ruby
5cdef8f4360f Cleanup file type setters.
edogawaconan <me@myconan.net>
parents: 540
diff changeset
122 autocmd BufRead,BufNewFile supervisord.conf set filetype=dosini
622
1002aff7e865 php-fpm configs are dosini
nanaya <me@nanaya.pro>
parents: 620
diff changeset
123 autocmd BufRead,BufNewFile php-fpm.conf set filetype=dosini
1002aff7e865 php-fpm configs are dosini
nanaya <me@nanaya.pro>
parents: 620
diff changeset
124 autocmd BufRead,BufNewFile */php-fpm.d/* set filetype=dosini
620
7ac088ee101a Add typescript vim syntax
nanaya <me@nanaya.pro>
parents: 619
diff changeset
125 " stolen from https://github.com/leafgarland/typescript-vim/blob/master/ftdetect/typescript.vim
7ac088ee101a Add typescript vim syntax
nanaya <me@nanaya.pro>
parents: 619
diff changeset
126 " use `set filetype` to override default filetype=xml for *.ts files
7ac088ee101a Add typescript vim syntax
nanaya <me@nanaya.pro>
parents: 619
diff changeset
127 autocmd BufNewFile,BufRead *.ts set filetype=typescript
671
b7929dbc5bfe Correct type for tsx
nanaya <me@nanaya.pro>
parents: 667
diff changeset
128 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
129
596
283ebb842957 Add nginx syntax
nanaya <me@myconan.net>
parents: 577
diff changeset
130 autocmd BufRead,BufNewFile *.nginx set ft=nginx
283ebb842957 Add nginx syntax
nanaya <me@myconan.net>
parents: 577
diff changeset
131 autocmd BufRead,BufNewFile */etc/nginx/* set ft=nginx
283ebb842957 Add nginx syntax
nanaya <me@myconan.net>
parents: 577
diff changeset
132 autocmd BufRead,BufNewFile */usr/local/nginx/conf/* set ft=nginx
283ebb842957 Add nginx syntax
nanaya <me@myconan.net>
parents: 577
diff changeset
133 autocmd BufRead,BufNewFile */opt/nginx/conf/* set ft=nginx
283ebb842957 Add nginx syntax
nanaya <me@myconan.net>
parents: 577
diff changeset
134 autocmd BufRead,BufNewFile nginx.conf set ft=nginx
283ebb842957 Add nginx syntax
nanaya <me@myconan.net>
parents: 577
diff changeset
135
550
4afbb88c7579 More files defaulting to in2.
nanaya <me@myconan.net>
parents: 545
diff changeset
136 autocmd FileType coffee call In2()
626
ffc095d36df2 Indent 2 for css
nanaya <me@nanaya.pro>
parents: 624
diff changeset
137 autocmd FileType css call In2()
550
4afbb88c7579 More files defaulting to in2.
nanaya <me@myconan.net>
parents: 545
diff changeset
138 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
139 autocmd FileType ruby call In2()
550
4afbb88c7579 More files defaulting to in2.
nanaya <me@myconan.net>
parents: 545
diff changeset
140 autocmd FileType scss call In2()
575
139862f791aa Less is two spaces as well.
nanaya <me@myconan.net>
parents: 574
diff changeset
141 autocmd FileType less call In2()
550
4afbb88c7579 More files defaulting to in2.
nanaya <me@myconan.net>
parents: 545
diff changeset
142 autocmd FileType yaml call In2()
616
dc2070cb5d71 Default json to 2 spaces indentation
nanaya <me@nanaya.pro>
parents: 607
diff changeset
143 autocmd FileType json call In2()
617
ecdf8eeca3ee Javascripts also 2 spaces indent
nanaya <me@nanaya.pro>
parents: 616
diff changeset
144 autocmd FileType javascript call In2()
624
ab58f083b2bf Indent 2 for typescripts
nanaya <me@nanaya.pro>
parents: 622
diff changeset
145 autocmd FileType typescript call In2()
637
758ced52ee62 [vim] Fix typescript syntax
nanaya <me@nanaya.pro>
parents: 636
diff changeset
146 autocmd FileType typescriptreact call In2()
596
283ebb842957 Add nginx syntax
nanaya <me@myconan.net>
parents: 577
diff changeset
147 autocmd FileType nginx setlocal commentstring=#\ %s
602
aa448b6e06ae Unfuck nginx vim
nanaya <me@nanaya.pro>
parents: 596
diff changeset
148 autocmd FileType nginx setlocal iskeyword&
687
ae7f2fb75cdf [vimrc] Disable auto comment
nanaya <me@nanaya.pro>
parents: 682
diff changeset
149
ae7f2fb75cdf [vimrc] Disable auto comment
nanaya <me@nanaya.pro>
parents: 682
diff changeset
150 " https://vimdoc.sourceforge.net/htmldoc/change.html#fo-table
ae7f2fb75cdf [vimrc] Disable auto comment
nanaya <me@nanaya.pro>
parents: 682
diff changeset
151 " disable comment auto format
ae7f2fb75cdf [vimrc] Disable auto comment
nanaya <me@nanaya.pro>
parents: 682
diff changeset
152 autocmd BufRead,BufNewFile * setlocal formatoptions-=c
ae7f2fb75cdf [vimrc] Disable auto comment
nanaya <me@nanaya.pro>
parents: 682
diff changeset
153 autocmd BufRead,BufNewFile * setlocal formatoptions-=r
ae7f2fb75cdf [vimrc] Disable auto comment
nanaya <me@nanaya.pro>
parents: 682
diff changeset
154 autocmd BufRead,BufNewFile * setlocal formatoptions-=o
350
47fbc05cacce vim per file control.
Edho Arief <edho@myconan.net>
parents: 339
diff changeset
155 endif
412
7ceec4404caf Add restore cursor position for vim.
Edho Arief <edho@myconan.net>
parents: 410
diff changeset
156
448
e0e8de4135bc Testing for function never returns true. Replaced with autocmd.
Edho Arief <edho@myconan.net>
parents: 446
diff changeset
157 if has('autocmd')
418
c0ac21407903 Disable features on vim basic.
Edho Arief <edho@myconan.net>
parents: 412
diff changeset
158 "Restore cursor position
645
7e4b3136f55e More histories and copypaste
nanaya <me@nanaya.pro>
parents: 641
diff changeset
159 set viminfo='50,\"1000,<1000,:100,%,h,n~/.viminfo
418
c0ac21407903 Disable features on vim basic.
Edho Arief <edho@myconan.net>
parents: 412
diff changeset
160 function! ResCur()
c0ac21407903 Disable features on vim basic.
Edho Arief <edho@myconan.net>
parents: 412
diff changeset
161 if line("'\"") <= line("$")
c0ac21407903 Disable features on vim basic.
Edho Arief <edho@myconan.net>
parents: 412
diff changeset
162 normal! g`"
c0ac21407903 Disable features on vim basic.
Edho Arief <edho@myconan.net>
parents: 412
diff changeset
163 return 1
c0ac21407903 Disable features on vim basic.
Edho Arief <edho@myconan.net>
parents: 412
diff changeset
164 endif
c0ac21407903 Disable features on vim basic.
Edho Arief <edho@myconan.net>
parents: 412
diff changeset
165 endfunction
c0ac21407903 Disable features on vim basic.
Edho Arief <edho@myconan.net>
parents: 412
diff changeset
166 augroup resCur
c0ac21407903 Disable features on vim basic.
Edho Arief <edho@myconan.net>
parents: 412
diff changeset
167 autocmd!
c0ac21407903 Disable features on vim basic.
Edho Arief <edho@myconan.net>
parents: 412
diff changeset
168 autocmd BufWinEnter * call ResCur()
c0ac21407903 Disable features on vim basic.
Edho Arief <edho@myconan.net>
parents: 412
diff changeset
169 augroup END
496
6bdf99bfbe97 Newer git use different filename, I think.
edogawaconan <me@myconan.net>
parents: 494
diff changeset
170 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
171 autocmd BufWinEnter .git/COMMIT_EDITMSG exe "normal! gg"
418
c0ac21407903 Disable features on vim basic.
Edho Arief <edho@myconan.net>
parents: 412
diff changeset
172 endif
424
b86827ee1aae Various vimrc cleanup.
Edho Arief <edho@myconan.net>
parents: 423
diff changeset
173
b86827ee1aae Various vimrc cleanup.
Edho Arief <edho@myconan.net>
parents: 423
diff changeset
174 if has('statusline')
b86827ee1aae Various vimrc cleanup.
Edho Arief <edho@myconan.net>
parents: 423
diff changeset
175 " Status line detail:
b86827ee1aae Various vimrc cleanup.
Edho Arief <edho@myconan.net>
parents: 423
diff changeset
176 " %f file path
b86827ee1aae Various vimrc cleanup.
Edho Arief <edho@myconan.net>
parents: 423
diff changeset
177 " %y file type between braces (if defined)
b86827ee1aae Various vimrc cleanup.
Edho Arief <edho@myconan.net>
parents: 423
diff changeset
178 " %([%R%M]%) read-only, modified and modifiable flags between braces
b86827ee1aae Various vimrc cleanup.
Edho Arief <edho@myconan.net>
parents: 423
diff changeset
179 " %{'!'[&ff=='default_file_format']}
b86827ee1aae Various vimrc cleanup.
Edho Arief <edho@myconan.net>
parents: 423
diff changeset
180 " shows a '!' if the file format is not the platform
b86827ee1aae Various vimrc cleanup.
Edho Arief <edho@myconan.net>
parents: 423
diff changeset
181 " default
b86827ee1aae Various vimrc cleanup.
Edho Arief <edho@myconan.net>
parents: 423
diff changeset
182 " %{'$'[!&list]} shows a '*' if in list mode
b86827ee1aae Various vimrc cleanup.
Edho Arief <edho@myconan.net>
parents: 423
diff changeset
183 " %{'~'[&pm=='']} shows a '~' if in patchmode
b86827ee1aae Various vimrc cleanup.
Edho Arief <edho@myconan.net>
parents: 423
diff changeset
184 " (%{synIDattr(synID(line('.'),col('.'),0),'name')})
b86827ee1aae Various vimrc cleanup.
Edho Arief <edho@myconan.net>
parents: 423
diff changeset
185 " only for debug : display the current syntax item name
b86827ee1aae Various vimrc cleanup.
Edho Arief <edho@myconan.net>
parents: 423
diff changeset
186 " %= right-align following items
b86827ee1aae Various vimrc cleanup.
Edho Arief <edho@myconan.net>
parents: 423
diff changeset
187 " #%n buffer number
b86827ee1aae Various vimrc cleanup.
Edho Arief <edho@myconan.net>
parents: 423
diff changeset
188 " %l/%L,%c%V line number, total number of lines, and column number
b86827ee1aae Various vimrc cleanup.
Edho Arief <edho@myconan.net>
parents: 423
diff changeset
189 function SetStatusLineStyle()
b86827ee1aae Various vimrc cleanup.
Edho Arief <edho@myconan.net>
parents: 423
diff changeset
190 if &stl == '' || &stl =~ 'synID'
b86827ee1aae Various vimrc cleanup.
Edho Arief <edho@myconan.net>
parents: 423
diff changeset
191 let &stl="%f %y%([%R%M]%)%{'!'[&ff=='".&ff."']}%{'$'[!&list]}%{'~'[&pm=='']}%=#%n %l/%L,%c%V "
b86827ee1aae Various vimrc cleanup.
Edho Arief <edho@myconan.net>
parents: 423
diff changeset
192 else
b86827ee1aae Various vimrc cleanup.
Edho Arief <edho@myconan.net>
parents: 423
diff changeset
193 let &stl="%f %y%([%R%M]%)%{'!'[&ff=='".&ff."']}%{'$'[!&list]} (%{synIDattr(synID(line('.'),col('.'),0),'name')})%=#%n %l/%L,%c%V "
b86827ee1aae Various vimrc cleanup.
Edho Arief <edho@myconan.net>
parents: 423
diff changeset
194 endif
b86827ee1aae Various vimrc cleanup.
Edho Arief <edho@myconan.net>
parents: 423
diff changeset
195 endfunc
b86827ee1aae Various vimrc cleanup.
Edho Arief <edho@myconan.net>
parents: 423
diff changeset
196 " Switch between the normal and vim-debug modes in the status line
b86827ee1aae Various vimrc cleanup.
Edho Arief <edho@myconan.net>
parents: 423
diff changeset
197 nmap _ds :call SetStatusLineStyle()<CR>
b86827ee1aae Various vimrc cleanup.
Edho Arief <edho@myconan.net>
parents: 423
diff changeset
198 call SetStatusLineStyle()
b86827ee1aae Various vimrc cleanup.
Edho Arief <edho@myconan.net>
parents: 423
diff changeset
199 " Window title
b86827ee1aae Various vimrc cleanup.
Edho Arief <edho@myconan.net>
parents: 423
diff changeset
200 if has('title')
493
1ad9091c464e Properly set window name for vim.
edogawaconan <me@myconan.net>
parents: 476
diff changeset
201 if &term == "screen"
1ad9091c464e Properly set window name for vim.
edogawaconan <me@myconan.net>
parents: 476
diff changeset
202 set t_ts=]0;
1ad9091c464e Properly set window name for vim.
edogawaconan <me@myconan.net>
parents: 476
diff changeset
203 set t_fs=
1ad9091c464e Properly set window name for vim.
edogawaconan <me@myconan.net>
parents: 476
diff changeset
204 endif
494
229acf12b960 Better vim titlestring.
edogawaconan <me@myconan.net>
parents: 493
diff changeset
205 set title
229acf12b960 Better vim titlestring.
edogawaconan <me@myconan.net>
parents: 493
diff changeset
206 let &titlestring = $user
424
b86827ee1aae Various vimrc cleanup.
Edho Arief <edho@myconan.net>
parents: 423
diff changeset
207 endif
b86827ee1aae Various vimrc cleanup.
Edho Arief <edho@myconan.net>
parents: 423
diff changeset
208 endif
618
fb9d19959976 Support for local vimrc file
nanaya <me@nanaya.pro>
parents: 617
diff changeset
209
619
7045cd713864 Simpler variable
nanaya <me@nanaya.pro>
parents: 618
diff changeset
210 if filereadable($HOME."/.vimrc.local")
7045cd713864 Simpler variable
nanaya <me@nanaya.pro>
parents: 618
diff changeset
211 source $HOME/.vimrc.local
618
fb9d19959976 Support for local vimrc file
nanaya <me@nanaya.pro>
parents: 617
diff changeset
212 endif