From 6b208622d4567b688f4051ee6c2c3b1077828886 Mon Sep 17 00:00:00 2001 From: Max Christian Pohle Date: Thu, 5 Apr 2018 20:48:02 +0200 Subject: Added recent file list when opening empty vim --- vimrc-full | 41 ++++++++++++++++++++++++++++++++--------- 1 file changed, 32 insertions(+), 9 deletions(-) diff --git a/vimrc-full b/vimrc-full index 819222f..cc4114c 100644 --- a/vimrc-full +++ b/vimrc-full @@ -10,6 +10,10 @@ set virtualedit=all | " virtual edit should be default behaviour, set nonumber norelativenumber | " do not show numbers by default, because that causes a performance loss, instead activate them on a file type basis set ignorecase smartcase hlsearch | " search with ignore case by default, but use case sensitive search when one capital char is contained and highlight while typing (even though its slower) + +set path+=** | " allow recursive searches for files +let &path = &path.",/usr/lib/modules/".substitute(system('uname -r'), "\n", "", "")."/build/include" + "======================================================================================================================= " SHELL "======================================================================================================================= @@ -187,7 +191,6 @@ set noautochdir | " When on, Vim will change the current working d set nostartofline | " when scrolling: do not move the cursor to column 1 set nowrap | " but do not (by default) wrap long lines around set nrformats+=alpha | " allows CTRL-A & CTRL-X to increment and decrement letters, not just numbers -set path+=** | " allow recursive searches for files set incsearch | " highlight pattern while entering it (performance wise this isn't that good) set pumheight=8 | " Determines the maximum number of items to show in the pop-up menu for set scrolljump=5 | " how many lines get scrolled into view when cursor reaches the screens edge @@ -198,7 +201,7 @@ set writedelay=0 " display and performance set lazyredraw | " disables redraw during macro execution (improves performance) set cmdheight=2 | " sets the command line's height -set signcolumn=yes | " auto=auto hide, yes=always, no=never show the column with error indicators +set signcolumn=auto | " auto=auto hide, yes=always, no=never show the column with error indicators set nocursorcolumn | " turn visual cursor column off (improves performance) set updatetime=80 | " updates the screen more often set redrawtime=1500 | " Timeout in milliseconds for redrawing the screen (switches syntax off when ssh too slow) / CTRL+L to retry @@ -253,7 +256,7 @@ set nosmartindent set cindent cinoptions+=(0 | " indent at parentheses set noshiftround | " indent/un-indent sna=ps to multiple of shiftwidths -set equalalways | " do not evenly size windows when opening new or closing old +set noequalalways | " do not evenly size windows when opening new or closing old set nocursorline | " turn visual cursor line off (improves performance) "======================================================================================================================= @@ -1043,26 +1046,35 @@ function! ExtendColorTheme() " highlight! link LightlineLeft_tabline_1 ColorColumn " highlight! link LightlineLeft_tabline_0_1 ColorColumn - highlight! Todo guibg=#ffffaa guifg=#000000 gui=bold term=bold highlight! cStatement guifg=red gui=bold term=bold + highlight! link Convention Error + " automatically enter list mode when going in insert mode (makes above syntax command temporarily ineffective) autocmd InsertEnter * set list autocmd InsertLeave * set nolist - " highlight double words (its unlikely they are right) - autocmd InsertLeave * syntax match Convention /\v<(\w+)\_s+\1>/ containedin=ALL + " autocmd InsertLeave * call matchadd('Conceal', ' \+$', -1, 101, { 'conceal': '⟶' }) + autocmd InsertEnter * call matchdelete(101) + autocmd InsertLeave * call matchadd('Convention', ' \+$', -1, 101, { 'conceal': '⟶' }) " Show trailing whitepace and spaces before a tab as part of the syntax highlighting - highlight! link Convention Error - autocmd BufEnter,InsertLeave * syntax match Convention /\s\+$\| \+\ze\t/ containedin=ALL - autocmd InsertEnter * syntax clear Convention + " autocmd BufEnter,InsertLeave * syntax match Convention /\s\+$\| \+\ze\t/ containedin=ALL + " autocmd Syntax * syntax match Convention /\s\+$\| \+\ze\t/ containedin=ALL + " autocmd BufEnter,BufWritePost * syntax match Convention /\s\+$\| \+\ze\t/ containedin=ALL + " autocmd InsertEnter * syntax clear Convention " autocmd BufEnter,InsertLeave * execute ':syntax match Convention /\%>'.&textwidth.'v./ containedin=ALL' autocmd InsertEnter * set colorcolumn=80,120 autocmd InsertLeave * set colorcolumn& " set colorcolumn= | " not used, because we have a :match directive for textwidth + " +" if argc() == 0 + " rv + " autocmd VimEnter * split +bro\ ol +" endif +" endfunction autocmd! ColorScheme * call ExtendColorTheme() @@ -1074,6 +1086,7 @@ set termguicolors | " When on, uses highlight-guifg and highlight-guibg attribut if filereadable(expand("~/.vimrc_background")) && filereadable(expand("~/.config/base16-shell/colortest")) let g:base16_shell_path="~/.config/base16-shell/scripts" let base16colorspace=256 + let syntax_cmd="skip" " vim internal, use base16 and no default colors set background=dark source ~/.vimrc_background else @@ -1101,3 +1114,13 @@ autocmd VimEnter,WinEnter * exec ':set scrolljump='.winheight(0)/2 " display highlight group under the cursor map h :echo map(synstack(line('.'), col('.')), 'synIDattr(v:val, "name")') + +if argc() == 0 + " autocmd VimEnter * call setloclist(0, filter(map(copy(v:oldfiles), {_, p->{'filename': expand(get(split(p, "'"), 0))}}), { val -> echo val})) + + " from the list of recent files: make absolute paths, filter out files not + " contained in cwd and finally filter out directories and non-files... + autocmd VimEnter * call setqflist(map(filter(filter( + \ map(copy(v:oldfiles), {_, p->expand(p)}), 'v:val =~ "'.getcwd().'"'), + \ 'filereadable(v:val)'), {_, p->{'filename': fnamemodify(p, ':.')}})) | copen | only +endif -- cgit v1.2.3