aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Christian Pohle2017-10-11 20:10:49 +0200
committerMax Christian Pohle2017-10-11 20:10:49 +0200
commit307d2ef4d4d0174f749388fdd6396d8bc64d0f52 (patch)
tree8490821c7374dd3de70f3314d896db9b7d5f1cbd
parent73cf61bc33ace9b5c3f0eedaab5fa9a5b3f2e0a9 (diff)
downloadvim-307d2ef4d4d0174f749388fdd6396d8bc64d0f52.tar.bz2
vim-307d2ef4d4d0174f749388fdd6396d8bc64d0f52.zip
Minor improvements, mostly from reading :help
-rw-r--r--doc/shortcuts.txt13
-rw-r--r--vimrc-full57
2 files changed, 50 insertions, 20 deletions
diff --git a/doc/shortcuts.txt b/doc/shortcuts.txt
index a5c33ae..fdd28c8 100644
--- a/doc/shortcuts.txt
+++ b/doc/shortcuts.txt
@@ -23,8 +23,9 @@ ciw = select inner word
23caw = select 'a word' 23caw = select 'a word'
24" where c can be replaced by v for visual mode 24" where c can be replaced by v for visual mode
25 25
26 26:%s/foo/bar/g = replace all foo with bar
27 27:g/foo/s/bar//g = on lines with foo replace bar with nothing
28:g!/foo/s/bar//g = on lines not containing foo replace bar with nothing
28 29
29[visual mode] # with selected lines 30[visual mode] # with selected lines
30gq = formats text so that it fits in whatever :set textwidth was set 31gq = formats text so that it fits in whatever :set textwidth was set
@@ -144,6 +145,14 @@ viB:sort = sort inner block by name
144[fancy utf-8 symbols] 145[fancy utf-8 symbols]
145 146
146 147
148[debugging]
149:profile! start /tmp/profile.log
150:profile func *
151:profile file *
152" At this point do slow actions
153:profdel *
154:e /tmp/profile.log
155
147[vim modeline] 156[vim modeline]
148filetype can have multiple values, like python.django 157filetype can have multiple values, like python.django
149The last line can be a mode line, which holds settings like tab width: 158The last line can be a mode line, which holds settings like tab width:
diff --git a/vimrc-full b/vimrc-full
index f99a5c1..4e73d20 100644
--- a/vimrc-full
+++ b/vimrc-full
@@ -52,7 +52,7 @@ if has("multi_byte")
52 set listchars+=extends:» | " symbols used when using :set list (which displays non-printable chars) 52 set listchars+=extends:» | " symbols used when using :set list (which displays non-printable chars)
53 set listchars+=precedes:« | " symbols used when using :set list (which displays non-printable chars) 53 set listchars+=precedes:« | " symbols used when using :set list (which displays non-printable chars)
54 54
55 set listchars+=tab:▏\ | " 55 set listchars+=tab:▏\ | "
56 set listchars+=trail:· | " symbols used when using :set list (which displays non-printable chars) 56 set listchars+=trail:· | " symbols used when using :set list (which displays non-printable chars)
57 " set listchars+=eol:↲ | " symbols used when using :set list (which displays non-printable chars) 57 " set listchars+=eol:↲ | " symbols used when using :set list (which displays non-printable chars)
58 " set listchars+=space:· | " symbols used when using :set list (which displays non-printable chars) 58 " set listchars+=space:· | " symbols used when using :set list (which displays non-printable chars)
@@ -232,6 +232,15 @@ set equalalways | " do not evenly size windows when opening new or
232set nocursorline | " turn visual cursor line off (improves performance) 232set nocursorline | " turn visual cursor line off (improves performance)
233"======================================================================================================================= 233"=======================================================================================================================
234 234
235" Vim8 has a terminal command...
236if has('terminal')
237 " use default ESC key to leave insert mode in the internal terminal emulator
238 tnoremap <Esc> <C-W>N
239 " make terminal windows hidden by default (copied from :help terminal)
240 autocmd BufWinEnter * if &buftype == 'terminal' | setlocal bufhidden=hide | endif
241endif
242
243
235" NEOVIM_incompatible: 244" NEOVIM_incompatible:
236" 245"
237if has('nvim') " Neovim? 246if has('nvim') " Neovim?
@@ -318,7 +327,7 @@ if has("autocmd")
318 autocmd FileType vim setlocal keywordprg=:help |. 327 autocmd FileType vim setlocal keywordprg=:help |.
319 autocmd FileType c,cpp setlocal equalprg=clang-format 328 autocmd FileType c,cpp setlocal equalprg=clang-format
320 autocmd FileType c,cpp setlocal breakat-=- 329 autocmd FileType c,cpp setlocal breakat-=-
321 autocmd WinNew * if &previewwindow | setlocal nonumber signcolumn=no filetype=c nobuflisted | endif 330 autocmd BufWinEnter * if &previewwindow | setlocal nonumber signcolumn=no filetype=c nobuflisted | endif
322 331
323 332
324 " autocmd FileType c,cpp setlocal iskeyword-=_ 333 " autocmd FileType c,cpp setlocal iskeyword-=_
@@ -415,8 +424,8 @@ if has("autocmd")
415 \ :execute ':!nvr --servername /tmp/nvimsocket --remote % +'.line('.')<CR>:stopinsert<CR>:set readonly<CR> 424 \ :execute ':!nvr --servername /tmp/nvimsocket --remote % +'.line('.')<CR>:stopinsert<CR>:set readonly<CR>
416 425
417 menu &Verify.&Textwidth\ and\ white\ space 426 menu &Verify.&Textwidth\ and\ white\ space
418 \ :execute ':match SpellBad /\%>'.&textwidth.'v./'<CR> 427 \ :execute ':match Error /\%>'.&textwidth.'v./'<CR>
419 \ :2match SpellBad /\s\+$/<CR> 428 \ :2match Error /\s\+$/<CR>
420 429
421 menu &Verify.Highlight\ current\ file\ name 430 menu &Verify.Highlight\ current\ file\ name
422 \ :execute ':match SpellBad /'.escape(expand('%:t'), '.').'/'<CR> 431 \ :execute ':match SpellBad /'.escape(expand('%:t'), '.').'/'<CR>
@@ -590,9 +599,9 @@ let g:lightline_buffer_git_icon = ' '
590let g:lightline_buffer_ellipsis_icon = '..' 599let g:lightline_buffer_ellipsis_icon = '..'
591let g:lightline_buffer_expand_left_icon = '◀ ' 600let g:lightline_buffer_expand_left_icon = '◀ '
592let g:lightline_buffer_expand_right_icon = ' ▶' 601let g:lightline_buffer_expand_right_icon = ' ▶'
593let g:lightline_buffer_active_buffer_left_icon = '' 602" let g:lightline_buffer_active_buffer_left_icon = ' '
594let g:lightline_buffer_active_buffer_right_icon = '' 603" let g:lightline_buffer_active_buffer_right_icon = ''
595let g:lightline_buffer_separator_icon = ' ' 604" let g:lightline_buffer_separator_icon = 'XX'
596 605
597" lightline-buffer function settings 606" lightline-buffer function settings
598let g:lightline_buffer_show_bufnr = 0 607let g:lightline_buffer_show_bufnr = 0
@@ -606,7 +615,12 @@ let g:lightline_buffer_minfextlen = 3
606let g:lightline_buffer_reservelen = 20 615let g:lightline_buffer_reservelen = 20
607 616
608" \ ['warnings', 'errors', 'syntastic'] 617" \ ['warnings', 'errors', 'syntastic']
618" \ 'left': [ [ 'bufferinfo' ], [ 'bufferbefore', 'buffercurrent', 'bufferafter' ], ],
609let g:lightline = { 619let g:lightline = {
620 \ 'tabline': {
621 \ 'left': [ [ 'bufferinfo' ], [ 'bufferbefore', 'buffercurrent', 'bufferafter' ], ],
622 \ 'right': [ [], [ 'close' ] ],
623 \ },
610 \ 'colorscheme': 'Tomorrow_Night_Bright', 624 \ 'colorscheme': 'Tomorrow_Night_Bright',
611 \ 'separator': { 'left': "\ue0b0", 'right': "\ue0b2" }, 625 \ 'separator': { 'left': "\ue0b0", 'right': "\ue0b2" },
612 \ 'subseparator': { 'left': "\ue0b1", 'right': "\ue0b3" }, 626 \ 'subseparator': { 'left': "\ue0b1", 'right': "\ue0b3" },
@@ -620,13 +634,10 @@ let g:lightline = {
620 \ [ 'spell', 'fileencoding', 'fileformat', 'filetype' ] 634 \ [ 'spell', 'fileencoding', 'fileformat', 'filetype' ]
621 \ ], 635 \ ],
622 \ }, 636 \ },
623 \ 'tabline': {
624 \ 'left': [ [ 'bufferinfo' ], [ 'bufferbefore', 'buffercurrent', 'bufferafter' ], ],
625 \ 'right': [ [], [ 'close' ] ],
626 \ },
627 \ 'component': { 637 \ 'component': {
628 \ 'tagbar': '%{substitute(tagbar#currenttag("%s", "", "fs"), "\(.*\)", "", "")}', 638 \ 'tagbar': '%{substitute(tagbar#currenttag("%s", "", "fs"), "\(.*\)", "", "")}',
629 \ 'ycmparent': '%{substitute(execute("YcmComplete GetParent"), "\(.*\)", "", "")}' 639 \ 'ycmparent': '%{substitute(execute("YcmComplete GetParent"), "\(.*\)", "", "")}',
640 \ 'filename': '%t'
630 \ }, 641 \ },
631 \ 'component_expand': { 642 \ 'component_expand': {
632 \ 'buffercurrent': 'lightline#buffer#buffercurrent2', 643 \ 'buffercurrent': 'lightline#buffer#buffercurrent2',
@@ -661,7 +672,7 @@ autocmd! ColorScheme * call ExtendLightlineColorTheme()
661 let g:ycm_server_python_interpreter = 'python3' 672 let g:ycm_server_python_interpreter = 'python3'
662 let g:ycm_python_binary_path = '/usr/bin/python3' " the python interpreter of choice (for code checking) 673 let g:ycm_python_binary_path = '/usr/bin/python3' " the python interpreter of choice (for code checking)
663 let g:ycm_add_preview_to_completeopt = 1 " reuse existing preview window 674 let g:ycm_add_preview_to_completeopt = 1 " reuse existing preview window
664 let g:ycm_autoclose_preview_window_after_insertion = 0 675 let g:ycm_autoclose_preview_window_after_insertion = 1
665 let g:ycm_collect_identifiers_from_tags_files = 0 " Let YCM read tags from Ctags file 676 let g:ycm_collect_identifiers_from_tags_files = 0 " Let YCM read tags from Ctags file
666 let g:ycm_seed_identifiers_with_syntax = 1 " Completion for programming language's keyword 677 let g:ycm_seed_identifiers_with_syntax = 1 " Completion for programming language's keyword
667 let g:ycm_complete_in_comments = 1 " Completion in comments 678 let g:ycm_complete_in_comments = 1 " Completion in comments
@@ -738,10 +749,13 @@ autocmd! ColorScheme * call ExtendLightlineColorTheme()
738"======================================================================================================================= 749"=======================================================================================================================
739" Plug 'rhysd/vim-clang-format' | unnecessary, because we can just :pyf /usr/share/clang/clang-format.py 750" Plug 'rhysd/vim-clang-format' | unnecessary, because we can just :pyf /usr/share/clang/clang-format.py
740Plug 'kana/vim-operator-user' " dependency, which allows overriding the = operator for indentation 751Plug 'kana/vim-operator-user' " dependency, which allows overriding the = operator for indentation
752
753" TODO: check if this is unrequired, when set equalprog is set to that py file
741autocmd FileType c,cpp,objc map <buffer> = :pyf /usr/share/clang/clang-format.py<CR> 754autocmd FileType c,cpp,objc map <buffer> = :pyf /usr/share/clang/clang-format.py<CR>
755
742" let g:clang_format#detect_style_file = 1 756" let g:clang_format#detect_style_file = 1
743" autocmd FileType c,cpp,objc map <buffer> = <Plug>(operator-clang-format) 757" autocmd FileType c,cpp,objc map <buffer> = <Plug>(operator-clang-format)
744 758
745" Plug 'tpope/vim-characterize' | " normal mode: make ga show character names of Unicode chars (ga shows hex and dec values) 759" Plug 'tpope/vim-characterize' | " normal mode: make ga show character names of Unicode chars (ga shows hex and dec values)
746" Plug 'rkitover/vimpager' 760" Plug 'rkitover/vimpager'
747" found this command instead (use as PAGER): 761" found this command instead (use as PAGER):
@@ -797,14 +811,14 @@ function! ExtendColorTheme()
797 highlight! link Folded LineNr 811 highlight! link Folded LineNr
798 highlight! Cursor guibg=#729fcf ctermbg=yellow 812 highlight! Cursor guibg=#729fcf ctermbg=yellow
799 highlight! link VertSplit LineNr 813 highlight! link VertSplit LineNr
800 highlight! SpellBad ctermbg=none 814 " highlight! SpellBad ctermbg=none
801 highlight! SpecialKey ctermfg=19 815 highlight! SpecialKey ctermfg=19
802 highlight! WhiteSpace ctermfg=19 816 highlight! WhiteSpace ctermfg=19
803 817
804 highlight! link TabLine LineNr 818 highlight! link TabLine LineNr
805 highlight! TabLineSel ctermbg=blue ctermfg=black 819 highlight! TabLineSel ctermbg=blue ctermfg=black
806 highlight! link TabLineFill LineNr 820 highlight! link TabLineFill LineNr
807 highlight! Search ctermbg=12 ctermfg=0 821 highlight! Search ctermbg=LightYellow ctermfg=black
808 822
809 " generic, which should exist but don't 823 " generic, which should exist but don't
810 highlight! Bold cterm=bold gui=bold 824 highlight! Bold cterm=bold gui=bold
@@ -814,6 +828,13 @@ function! ExtendColorTheme()
814 828
815 " make tab stop (see listchars) less disturbing... 829 " make tab stop (see listchars) less disturbing...
816 highlight! link SpecialKey NonText 830 highlight! link SpecialKey NonText
831
832
833 " Show trailing whitepace and spaces before a tab as part of the syntax highlighting
834 autocmd Syntax * syn match Error /\s\+$\| \+\ze\t/ containedin=ALL
835 " automatically enter list mode when going in insert mode (makes above syntax command temporarily ineffective)
836 autocmd InsertEnter * set list
837 autocmd InsertLeave * set nolist
817endfunction 838endfunction
818autocmd! ColorScheme * call ExtendColorTheme() 839autocmd! ColorScheme * call ExtendColorTheme()
819 840
@@ -830,7 +851,7 @@ else
830 colorscheme base16-phd 851 colorscheme base16-phd
831endif 852endif
832 853
833set background=light 854" set background=dark
834 855
835" ====================================================================================================================== 856" ======================================================================================================================
836" TESTING: 857" TESTING:
@@ -844,4 +865,4 @@ set scrolloff=0 | " keeps cursor centered
844autocmd VimEnter,WinEnter * exec ':set scrolljump='.winheight(0)/2 865autocmd VimEnter,WinEnter * exec ':set scrolljump='.winheight(0)/2
845 866
846" display highlight group under the cursor 867" display highlight group under the cursor
847map <leader>h :echo map(synstack(line('.'), col('.')), 'synIDattr(v:val, "name")') 868map <leader>h :echo map(synstack(line('.'), col('.')), 'synIDattr(v:val, "name")')<CR>
..