mirror of
https://github.com/keanuplayz/dotfiles.git
synced 2024-08-15 02:33:12 +00:00
Compare commits
7 commits
4932e97a4d
...
955a4d07f4
Author | SHA1 | Date | |
---|---|---|---|
|
955a4d07f4 | ||
|
eea04f738e | ||
|
76eacb2ac2 | ||
|
f06382d651 | ||
|
c62a48504f | ||
|
796a8a9c4d | ||
|
630d6885a1 |
13 changed files with 94 additions and 51 deletions
1
nvim/after/ftplugin/diff.vim
Normal file
1
nvim/after/ftplugin/diff.vim
Normal file
|
@ -0,0 +1 @@
|
|||
setlocal nofoldenable foldmethod=manual
|
|
@ -2,9 +2,10 @@ source <sfile>:h/text.vim
|
|||
|
||||
let s:src_file = expand('%')
|
||||
let s:out_file = s:src_file.'.html'
|
||||
let &l:makeprg = 'markdown2htmldoc '.shellescape(s:src_file).' '.shellescape(s:out_file)
|
||||
let &l:makeprg = 'markdown2htmldoc'
|
||||
for s:arg in get(g:, 'dotfiles_markdown2htmldoc_options', [])
|
||||
let &l:makeprg .= ' '.shellescape(s:arg)
|
||||
endfor
|
||||
let &l:makeprg .= ' -- '.shellescape(s:src_file).' '.shellescape(s:out_file)
|
||||
|
||||
nnoremap <buffer> <F5> <Cmd>Open %.html<CR>
|
||||
|
|
1
nvim/after/ftplugin/sass.vim
Normal file
1
nvim/after/ftplugin/sass.vim
Normal file
|
@ -0,0 +1 @@
|
|||
source <sfile>:h/scss.vim
|
|
@ -1 +1,9 @@
|
|||
source <sfile>:h/css.vim
|
||||
|
||||
let s:src_file = expand('%')
|
||||
let s:out_file = s:src_file.'.css'
|
||||
let &l:makeprg = 'sass'
|
||||
for s:arg in get(g:, 'dotfiles_dart_sass_options', [])
|
||||
let &l:makeprg .= ' '.shellescape(s:arg)
|
||||
endfor
|
||||
let &l:makeprg .= ' -- '.shellescape(s:src_file).':'.shellescape(s:out_file)
|
||||
|
|
|
@ -5,7 +5,8 @@
|
|||
|
||||
execute 'source' fnameescape(g:dotfiles_dir.'/colorschemes/out/vim.vim')
|
||||
|
||||
if !&termguicolors && exists('$_COLORSCHEME_TERMINAL')
|
||||
let s:is_gui_color = !has('win32') && !has('win64') && !has('win32unix') && has('termguicolors') && &termguicolors
|
||||
if s:is_gui_color && exists('$_COLORSCHEME_TERMINAL')
|
||||
set notermguicolors
|
||||
endif
|
||||
|
||||
|
@ -25,36 +26,42 @@
|
|||
endfunction
|
||||
|
||||
let s:colors = g:dotfiles_colorscheme_base16_colors
|
||||
function s:hi(group, fg, bg, attr, guisp)
|
||||
let args = ''
|
||||
function s:hi(group, fg, bg, attr, sp)
|
||||
let fg = {}
|
||||
let bg = {}
|
||||
let attr = 'NONE'
|
||||
let sp = {}
|
||||
if a:fg isnot ''
|
||||
let fg = s:is_number(a:fg) ? s:colors[a:fg] : {'gui': a:fg, 'cterm': a:fg}
|
||||
let args .= ' guifg=' . fg.gui . ' ctermfg=' . fg.cterm
|
||||
endif
|
||||
if a:bg isnot ''
|
||||
let bg = s:is_number(a:bg) ? s:colors[a:bg] : {'gui': a:bg, 'cterm': a:bg}
|
||||
let args .= ' guibg=' . bg.gui . ' ctermbg=' . bg.cterm
|
||||
endif
|
||||
if a:attr isnot ''
|
||||
let args .= ' gui=' . a:attr . ' cterm=' . a:attr
|
||||
let attr = a:attr
|
||||
endif
|
||||
if a:guisp isnot ''
|
||||
let guisp = s:is_number(a:guisp) ? s:colors[a:guisp].gui : a:guisp
|
||||
let args .= ' guisp=' . guisp
|
||||
if a:sp isnot ''
|
||||
let sp = s:is_number(a:sp) ? s:colors[a:sp] : {'gui': a:sp, 'cterm': a:sp}
|
||||
endif
|
||||
exec 'hi' a:group args
|
||||
exec 'hi' a:group
|
||||
\ 'guifg='.get(fg, 'gui', 'NONE') 'ctermfg='.get(fg, 'cterm', 'NONE')
|
||||
\ 'guibg='.get(bg, 'gui', 'NONE') 'ctermbg='.get(bg, 'cterm', 'NONE')
|
||||
\ 'gui='.(attr) 'cterm='.(attr)
|
||||
\ 'guisp='.get(sp, 'gui', 'NONE')
|
||||
endfunction
|
||||
" }}}
|
||||
|
||||
" General syntax highlighting {{{
|
||||
|
||||
" TODO: `hi clear` ?
|
||||
|
||||
call s:hi('Normal', 0x5, 0x0, '', '')
|
||||
call s:hi('Italic', 0xE, '', 'italic', '')
|
||||
call s:hi('Bold', 0xA, '', 'bold', '')
|
||||
call s:hi('Underlined', 0x8, '', 'underline', '')
|
||||
call s:hi('Title', 0xD, '', 'NONE', '')
|
||||
call s:hi('Title', 0xD, '', '', '')
|
||||
hi! link Directory Title
|
||||
call s:hi('Conceal', 0xC, 'NONE', '', '')
|
||||
call s:hi('Conceal', 0xC, '', '', '')
|
||||
call s:hi('NonText', 0x3, '', '', '')
|
||||
hi! link SpecialKey Special
|
||||
call s:hi('MatchParen', 'fg', 0x3, '', '')
|
||||
|
@ -78,7 +85,7 @@
|
|||
hi! link SpecialComment Comment
|
||||
call s:hi('Todo', 'bg', 0xA, 'bold', '')
|
||||
call s:hi('Function', 0xD, '', '', '')
|
||||
call s:hi('Identifier', 0x8, '', 'none', '')
|
||||
call s:hi('Identifier', 0x8, '', '', '')
|
||||
hi! link Variable Identifier
|
||||
" call s:hi('Include', 0xF, '', '', '')
|
||||
hi! link Include Keyword
|
||||
|
@ -88,7 +95,7 @@
|
|||
hi! link Delimiter NONE
|
||||
call s:hi('Special', 0xC, '', '', '')
|
||||
call s:hi('Tag', 0xA, '', '', '')
|
||||
call s:hi('Type', 0xA, '', 'none', '')
|
||||
call s:hi('Type', 0xA, '', '', '')
|
||||
hi! link Typedef Type
|
||||
|
||||
" }}}
|
||||
|
@ -96,8 +103,8 @@
|
|||
" User interface {{{
|
||||
|
||||
call s:hi('Error', 'bg', 0x8, '', '')
|
||||
call s:hi('ErrorMsg', 0x8, 'NONE', '', '')
|
||||
call s:hi('WarningMsg', 0x9, 'NONE', '', '')
|
||||
call s:hi('ErrorMsg', 0x8, '', '', '')
|
||||
call s:hi('WarningMsg', 0x9, '', '', '')
|
||||
call s:hi('TooLong', 0x8, '', '', '')
|
||||
call s:hi('Debug', 0x8, '', '', '')
|
||||
hi! link CocErrorSign Error
|
||||
|
@ -110,7 +117,7 @@
|
|||
call s:hi('FoldColumn', 0xC, 0x1, '', '')
|
||||
call s:hi('Folded', 0x3, 0x1, '', '')
|
||||
|
||||
call s:hi('IncSearch', 0x1, 0x9, 'none', '')
|
||||
call s:hi('IncSearch', 0x1, 0x9, '', '')
|
||||
call s:hi('Search', 0x1, 0xA, '', '')
|
||||
hi! link Substitute Search
|
||||
|
||||
|
@ -120,7 +127,7 @@
|
|||
call s:hi('Visual', '', 0x2, '', '')
|
||||
call s:hi('WildMenu', 0x1, 'fg', '', '')
|
||||
|
||||
call s:hi('CursorLine', '', 0x1, 'none', '')
|
||||
call s:hi('CursorLine', '', 0x1, '', '')
|
||||
hi! link CursorColumn CursorLine
|
||||
call s:hi('ColorColumn', '', 0x1, '', '')
|
||||
call s:hi('LineNr', 0x3, 0x1, '', '')
|
||||
|
@ -128,7 +135,7 @@
|
|||
call s:hi('QuickFixLine', '', 0x2, '', '')
|
||||
|
||||
call s:hi('SignColumn', 0x3, 0x1, '', '')
|
||||
call s:hi('StatusLine', 0x4, 0x1, 'none', '')
|
||||
call s:hi('StatusLine', 0x4, 0x1, '', '')
|
||||
call s:hi('StatusLineNC', 0x3, 0x1, '', '')
|
||||
call s:hi('VertSplit', 0x2, 0x2, '', '')
|
||||
call s:hi('TabLine', 0x3, 0x1, '', '')
|
||||
|
@ -142,13 +149,12 @@
|
|||
hi! link ctrlsfLnumMatch ctrlsfMatch
|
||||
|
||||
let s:spell_fg = s:is_kitty ? '' : 'bg'
|
||||
let s:spell_bg = s:is_kitty ? 'NONE' : ''
|
||||
let s:spell_attr = s:is_kitty ? 'undercurl' : ''
|
||||
call s:hi('SpellBad', s:spell_fg, s:spell_bg, s:spell_attr, 0x8)
|
||||
call s:hi('SpellLocal', s:spell_fg, s:spell_bg, s:spell_attr, 0xC)
|
||||
call s:hi('SpellCap', s:spell_fg, s:spell_bg, s:spell_attr, 0xD)
|
||||
call s:hi('SpellRare', s:spell_fg, s:spell_bg, s:spell_attr, 0xE)
|
||||
unlet s:is_kitty s:spell_fg s:spell_bg s:spell_attr
|
||||
call s:hi('SpellBad', s:spell_fg, s:is_kitty ? '' : 0x8, s:spell_attr, 0x8)
|
||||
call s:hi('SpellLocal', s:spell_fg, s:is_kitty ? '' : 0xC, s:spell_attr, 0xC)
|
||||
call s:hi('SpellCap', s:spell_fg, s:is_kitty ? '' : 0xD, s:spell_attr, 0xD)
|
||||
call s:hi('SpellRare', s:spell_fg, s:is_kitty ? '' : 0xE, s:spell_attr, 0xE)
|
||||
unlet s:spell_fg s:spell_attr
|
||||
|
||||
call s:hi('Sneak', 'bg', 0xB, 'bold', '')
|
||||
hi! link SneakScope Visual
|
||||
|
|
|
@ -63,8 +63,17 @@ if exists(':Sleuth')
|
|||
" shiftwidth to the unreasonable value picked above, which vim-sleuth
|
||||
" internally compares with its local `s:default_shiftwidth`, sees that both
|
||||
" are the same, and proceeds to execute the indent detection algorithm.
|
||||
" Boom, my work here is done.
|
||||
autocmd BufEnter * let &l:shiftwidth = s:fake_default_shiftwidth | Sleuth
|
||||
" ALSO Note how I'm not using `BufEnter` as vim-sleuth does because
|
||||
" apparently `BufWinEnter` leads to better compatibility with the
|
||||
" indentLine plugin and potentially less useless invocations (see the note
|
||||
" about window splits in the docs for this event). Oh, one last thing:
|
||||
" vim-sleuth forgets to assign the tabstop options, which I have to do as
|
||||
" well. But anyway, boom, my work here is done.
|
||||
autocmd BufWinEnter *
|
||||
\ let &l:shiftwidth = s:fake_default_shiftwidth
|
||||
\| Sleuth
|
||||
\| let &l:tabstop = &l:shiftwidth
|
||||
\| let &l:softtabstop = &l:shiftwidth
|
||||
augroup END
|
||||
|
||||
" HACK: In case you are wondering why I'm using Polyglot's bundled vim-sleuth
|
||||
|
|
|
@ -15,8 +15,8 @@ set commentstring=//%s
|
|||
function SetIndent(expandtab, shiftwidth)
|
||||
let &l:expandtab = a:expandtab
|
||||
let &l:shiftwidth = str2nr(a:shiftwidth)
|
||||
let &l:tabstop = &shiftwidth
|
||||
let &l:softtabstop = &shiftwidth
|
||||
let &l:tabstop = &l:shiftwidth
|
||||
let &l:softtabstop = &l:shiftwidth
|
||||
endfunction
|
||||
command -nargs=1 Indent call SetIndent(1, <q-args>)
|
||||
command -nargs=1 IndentTabs call SetIndent(0, <q-args>)
|
||||
|
|
|
@ -123,6 +123,8 @@ endif
|
|||
nnoremap <silent> <F1> <Cmd>Helptags<CR>
|
||||
nnoremap <silent> <leader>f <Cmd>Files<CR>
|
||||
nnoremap <silent> <leader>b <Cmd>Buffers<CR>
|
||||
" <https://github.com/junegunn/fzf/blob/764316a53d0eb60b315f0bbcd513de58ed57a876/src/tui/tui.go#L496-L515>
|
||||
let $FZF_DEFAULT_OPTS = '--color=16'
|
||||
let g:fzf_layout = { 'down': '~40%' }
|
||||
let g:fzf_preview_window = ['right:noborder', 'ctrl-/']
|
||||
" }}}
|
||||
|
|
|
@ -14,20 +14,24 @@ BEGIN {
|
|||
print "";
|
||||
}
|
||||
|
||||
function print_color(color) {
|
||||
printf "\033[48;5;%sm \033[0m", color
|
||||
function print_color(color, idx) {
|
||||
if (OPT_COLOR_CODES) {
|
||||
printf "\033[1;30;48;5;%sm %02X \033[0m", color, idx;
|
||||
} else {
|
||||
printf "\033[48;5;%sm \033[0m", color;
|
||||
}
|
||||
}
|
||||
|
||||
function test_standard_colors() {
|
||||
print "16 standard colors:";
|
||||
for (color = 0; color < 16; color += 1) print_color(color);
|
||||
for (color = 0; color < 16; color += 1) print_color(color, color);
|
||||
print "";
|
||||
}
|
||||
|
||||
function test_base16_colorscheme() {
|
||||
print "base16 colorscheme:";
|
||||
split("0 18 19 8 20 7 21 15 1 16 3 2 6 4 5 17", colors, " ");
|
||||
for (i = 1; i <= length(colors); i++) print_color(colors[i]);
|
||||
for (i = 1; i <= length(colors); i++) print_color(colors[i], i - 1);
|
||||
print "";
|
||||
}
|
||||
|
||||
|
@ -39,7 +43,8 @@ function test_6x6x6_cube() {
|
|||
for (row = 0; row < 6; row++) {
|
||||
for (block_x = 0; block_x < block_grid_w; block_x++) {
|
||||
for (col = 0; col < 6; col++) {
|
||||
print_color(16 + col + 6*row + 6*6*block_x + block_grid_w*6*6*block_y);
|
||||
color = col + 6*row + 6*6*block_x + block_grid_w*6*6*block_y
|
||||
print_color(16 + color, color);
|
||||
}
|
||||
}
|
||||
print "";
|
||||
|
@ -50,7 +55,7 @@ function test_6x6x6_cube() {
|
|||
function test_grayscale() {
|
||||
print "grayscale from black to white in 24 steps:";
|
||||
for (color = 0; color < 24; color += 1) {
|
||||
print_color(16 + 6*6*6 + color)
|
||||
print_color(16 + 6*6*6 + color, color)
|
||||
}
|
||||
print "";
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
set -eu
|
||||
|
||||
script_dir="$(dirname "$0")"
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
set -eu
|
||||
|
||||
script_dir="$(dirname "$0")"
|
||||
cols="$(tput cols)"
|
||||
|
|
7
scripts/colortest3
Executable file
7
scripts/colortest3
Executable file
|
@ -0,0 +1,7 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -eu
|
||||
|
||||
script_dir="$(dirname "$0")"
|
||||
|
||||
exec awk -v OPT_COLOR_CODES=1 -f "${script_dir}/../script-resources/colortest.awk"
|
|
@ -31,3 +31,6 @@ export JQ_COLORS="${(j.:.)jq_colors}"
|
|||
unset jq_colors
|
||||
|
||||
export HOMEBREW_NO_AUTO_UPDATE=1
|
||||
|
||||
# https://github.com/junegunn/fzf/blob/764316a53d0eb60b315f0bbcd513de58ed57a876/src/tui/tui.go#L496-L515
|
||||
export FZF_DEFAULT_OPTS="--color=16"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue