diff options
author | Max Christian Pohle | 2019-10-13 13:47:17 +0200 |
---|---|---|
committer | Max Christian Pohle | 2019-10-13 13:47:17 +0200 |
commit | 5ffd36adcb5e2aa352609a3d4e005b3e99173442 (patch) | |
tree | d92a75df87f63313b3a91e8279d39aadb37471e4 | |
parent | ba1f099db5afeedb323c05127df1cc34df85ec85 (diff) | |
download | vim-5ffd36adcb5e2aa352609a3d4e005b3e99173442.tar.bz2 vim-5ffd36adcb5e2aa352609a3d4e005b3e99173442.zip |
Refactored 'splash' a lot & minor fixes in statusline
-rw-r--r-- | plugin/max-splash.vim | 43 | ||||
-rw-r--r-- | plugin/statusline.vim | 12 | ||||
-rw-r--r-- | vimrc-common | 11 |
3 files changed, 38 insertions, 28 deletions
diff --git a/plugin/max-splash.vim b/plugin/max-splash.vim index bc578e1..3a23e60 100644 --- a/plugin/max-splash.vim +++ b/plugin/max-splash.vim | |||
@@ -3,24 +3,31 @@ | |||
3 | " Shows recently used files from the current directory in a location list | 3 | " Shows recently used files from the current directory in a location list |
4 | "======================================================================================================================= | 4 | "======================================================================================================================= |
5 | 5 | ||
6 | " moved after VimEnter of statusline, so that it does not get overwritten any | 6 | " autocmd VimEnter * call setloclist(0, filter(map(copy(v:oldfiles), {_, p->{'filename': expand(get(split(p, "'"), 0))}}), { val -> echo val})) |
7 | " more | 7 | " from the list of recent files: make absolute paths, filter out files not |
8 | if empty(argv()) | 8 | " contained in cwd and finally filter out directories and non-files... |
9 | 9 | autocmd StdinReadPre * let s:std_in=1 | |
10 | " autocmd VimEnter * call setloclist(0, filter(map(copy(v:oldfiles), {_, p->{'filename': expand(get(split(p, "'"), 0))}}), { val -> echo val})) | 10 | autocmd VimEnter * if !exists("s:std_in") && empty(argv()) |
11 | 11 | \ | call setloclist(0, []) | |
12 | " from the list of recent files: make absolute paths, filter out files not | 12 | \ | :lopen |
13 | " contained in cwd and finally filter out directories and non-files... | 13 | \ | setlocal nospell |
14 | autocmd StdinReadPre * let s:std_in=1 | 14 | \ | setlocal signcolumn=yes |
15 | autocmd VimEnter * if !exists("s:std_in") | call setloclist(0, [], 'r', | 15 | \ | setfiletype qf |
16 | \ { | 16 | \ | call setloclist(0, [], 'r', { |
17 | \ 'title':'Recently used files in directory: '.getcwd(), | 17 | \ 'title':'Recently used files in directory: '.getcwd(), |
18 | \ 'items':map(filter(filter( | 18 | \ 'items':sort(map(filter(filter(map(copy(v:oldfiles[:100]), |
19 | \ map(copy(v:oldfiles), | 19 | \ {_, p->expand(p)}), |
20 | \ {_, p->expand(p)}), 'v:val =~ "'.getcwd().'/"'), 'filereadable(v:val)'), | 20 | \ 'v:val =~ "'.getcwd().'/"'), |
21 | \ {_, p->{'filename': fnamemodify(p, ':.')}}) | 21 | \ 'filereadable(v:val)'), |
22 | \ }) | exec ':lopen '.getloclist(0, {'size' : 1}).size | setfiletype qf | wincmd w | 22 | \ {_, p->{'filename': p, |
23 | endif | 23 | \ 'module': printf("%s | %-*s ", |
24 | \ strftime("%F %H:%M", | ||
25 | \ getftime(p)), | ||
26 | \ winwidth(0) - wincol() - 20, | ||
27 | \ fnamemodify(p, ':.') | ||
28 | \ )}}), | ||
29 | \ {a1, a2 -> a1.module < a2.module}) | ||
30 | \ }) | wincmd w | ||
24 | 31 | ||
25 | " http://vimdoc.sourceforge.net/htmldoc/quickfix.html#:caddexpr | 32 | " http://vimdoc.sourceforge.net/htmldoc/quickfix.html#:caddexpr |
26 | " for c in range(char2nr('a'), char2nr('z')) + range(char2nr('A'), char2nr('Z')) + range(0,9) | let p = getpos("'".nr2char(c)) | if (p[1] > 0) | exec "sign define mark_".nr2char(c)." text=".nr2char(c)." linehl=linenr" | exec "sign place ".c." name=mark_".nr2char(c)." line=".p[1] | endif | endfor | 33 | " for c in range(char2nr('a'), char2nr('z')) + range(char2nr('A'), char2nr('Z')) + range(0,9) | let p = getpos("'".nr2char(c)) | if (p[1] > 0) | exec "sign define mark_".nr2char(c)." text=".nr2char(c)." linehl=linenr" | exec "sign place ".c." name=mark_".nr2char(c)." line=".p[1] | endif | endfor |
diff --git a/plugin/statusline.vim b/plugin/statusline.vim index dc98a71..e6f175d 100644 --- a/plugin/statusline.vim +++ b/plugin/statusline.vim | |||
@@ -58,12 +58,13 @@ augroup MAX_FANCYLINE | |||
58 | \ .'%#StatusLineHighlight#' | 58 | \ .'%#StatusLineHighlight#' |
59 | \ .'%#'.a:highlight_group.'#' | 59 | \ .'%#'.a:highlight_group.'#' |
60 | \ .g:symbol_screen_edge | 60 | \ .g:symbol_screen_edge |
61 | \ .'%(%w%h%q%)'.' '.l:mode.' '.g:status_sym_sep_start | 61 | \ .'%{&buftype != "" ? " ".&buftype : ""}' |
62 | \ .' '.l:mode.g:status_sym_sep_start | ||
62 | \ .'%{argc() > 1 ? " ".(argidx() + 1).":".argc()." ".g:status_sym_sep_start : ""}' | 63 | \ .'%{argc() > 1 ? " ".(argidx() + 1).":".argc()." ".g:status_sym_sep_start : ""}' |
63 | \ .'%{haslocaldir() ? fnamemodify(getcwd(), ":.:~")." " :""}' | 64 | \ .'%{haslocaldir() ? fnamemodify(getcwd(), ":.:~")." " :""}' |
64 | \ .'%{&readonly ? " 🔒" : ""}' | 65 | \ .'%{&readonly ? " 🔒" : ""}' |
65 | \ .'%{&modified ? " 💾 " : ""}' | 66 | \ .'%{&modified ? " 💾 " : ""}' |
66 | \ .'%{winbufnr(0)." "}' | 67 | \ .'%{" [".winbufnr(0)."] "}' |
67 | \ .'%{bufname("%") == "" ? "" : fnamemodify(expand("%"), ":~:.")}' | 68 | \ .'%{bufname("%") == "" ? "" : fnamemodify(expand("%"), ":~:.")}' |
68 | \ .'%{&titlestring ? has("nvim") ? b:term_title:expand(&titlestring) : "" }' | 69 | \ .'%{&titlestring ? has("nvim") ? b:term_title:expand(&titlestring) : "" }' |
69 | \ .'%{exists("w:quickfix_title") ? w:quickfix_title : ""}' | 70 | \ .'%{exists("w:quickfix_title") ? w:quickfix_title : ""}' |
@@ -111,7 +112,7 @@ augroup MAX_FANCYLINE | |||
111 | \ .g:status_sym_start | 112 | \ .g:status_sym_start |
112 | \ .'%(%#'.a:highlight_group.'#%)' | 113 | \ .'%(%#'.a:highlight_group.'#%)' |
113 | \ .' ' | 114 | \ .' ' |
114 | \ .'%-3(%)' | 115 | \ .'%-2(%)' |
115 | \ .'%(%#'.a:highlight_group.'#%)' | 116 | \ .'%(%#'.a:highlight_group.'#%)' |
116 | \ .'%(%{v:servername} %{v:this_session}%)' | 117 | \ .'%(%{v:servername} %{v:this_session}%)' |
117 | \ .g:status_sym_sep_end.' ' | 118 | \ .g:status_sym_sep_end.' ' |
@@ -136,10 +137,11 @@ augroup MAX_FANCYLINE | |||
136 | highlight! StatusLine cterm=reverse | 137 | highlight! StatusLine cterm=reverse |
137 | " exec 'highlight! User3 guifg=#D2A032 guibg='.l:fgcolor | 138 | " exec 'highlight! User3 guifg=#D2A032 guibg='.l:fgcolor |
138 | endfunction | 139 | endfunction |
140 | call ApplyColorScheme() | ||
141 | |||
139 | " apply colors from the loaded colorscheme... | 142 | " apply colors from the loaded colorscheme... |
140 | " when changing the colorscheme also apply new colors to the statusbar... | 143 | " when changing the colorscheme also apply new colors to the statusbar... |
141 | autocmd VimEnter,ColorScheme * call ApplyColorScheme() | 144 | autocmd ColorScheme * call ApplyColorScheme() |
142 | |||
143 | autocmd WinEnter * setlocal statusline=%!UpdateStatus(g:group_active) | 145 | autocmd WinEnter * setlocal statusline=%!UpdateStatus(g:group_active) |
144 | autocmd WinLeave * setlocal statusline< | 146 | autocmd WinLeave * setlocal statusline< |
145 | augroup END " MAX_FANCYLINE | 147 | augroup END " MAX_FANCYLINE |
diff --git a/vimrc-common b/vimrc-common index 77ebbdf..44dea70 100644 --- a/vimrc-common +++ b/vimrc-common | |||
@@ -201,6 +201,12 @@ if has("autocmd") | |||
201 | " use the shada/viminfo file to return the cursor to where it was... | 201 | " use the shada/viminfo file to return the cursor to where it was... |
202 | autocmd BufReadPost * call setpos(".", getpos("'\"")) | 202 | autocmd BufReadPost * call setpos(".", getpos("'\"")) |
203 | autocmd BufWinEnter * if &previewwindow | setlocal nonumber nolist signcolumn=no filetype=c nobuflisted | endif | 203 | autocmd BufWinEnter * if &previewwindow | setlocal nonumber nolist signcolumn=no filetype=c nobuflisted | endif |
204 | |||
205 | " Workaround: Allows Vim to yank text within wayland | ||
206 | if $XDG_SESSION_TYPE ==# 'wayland' && !has('nvim') | ||
207 | autocmd TextYankPost * call system("wl-copy", getreg('+')) | ||
208 | endif | ||
209 | |||
204 | autocmd TextYankPost * echo '> text yanked to '. | 210 | autocmd TextYankPost * echo '> text yanked to '. |
205 | \ (get(v:event,'regname') == '' | 211 | \ (get(v:event,'regname') == '' |
206 | \ ? 'default register' | 212 | \ ? 'default register' |
@@ -350,11 +356,6 @@ augroup KEYBOARD_MAPPING | |||
350 | if has('nvim') " only neovim... | 356 | if has('nvim') " only neovim... |
351 | " shortcut \t opens a terminal in a horizontal split | 357 | " shortcut \t opens a terminal in a horizontal split |
352 | nnoremap <leader>t :new +terminal<CR> | 358 | nnoremap <leader>t :new +terminal<CR> |
353 | else | ||
354 | " allow vim to yank in wayland | ||
355 | if $XDG_SESSION_TYPE ==# 'wayland' | ||
356 | xnoremap "+y y:call system("wl-copy", @")<cr> | ||
357 | endif | ||
358 | endif | 359 | endif |
359 | augroup END | 360 | augroup END |
360 | 361 | ||