stuff. python things. what am i doing with my life
This commit is contained in:
parent
5e2e2842dd
commit
8ae0cef391
|
@ -39,7 +39,7 @@ fade-out-step = 0.06;
|
|||
blur-background = true;
|
||||
blur-background-frame = true;
|
||||
blur-background-fixed = false;
|
||||
blur-kern = "3x3box";
|
||||
blur-kern = "7x7gaussian";
|
||||
|
||||
opacity-rule = [
|
||||
"40:class_g = 'Bspwm' && class_i = 'presel_feedback'",
|
||||
|
@ -47,6 +47,7 @@ opacity-rule = [
|
|||
];
|
||||
|
||||
shadow-exclude = [
|
||||
"!focused",
|
||||
"name *?= 'Notification'",
|
||||
"class_g ?= 'Notify-osd'",
|
||||
"class_g = 'Bspwm'",
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
# font height and padding.
|
||||
notification_height = 0
|
||||
|
||||
separator_height = 2
|
||||
separator_height = 0
|
||||
padding = 12 # Padding between text and separator.
|
||||
horizontal_padding = 10
|
||||
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
" Vim filetype plugin
|
||||
" Language: generic git output
|
||||
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
|
||||
" Last Change: 2013 May 30
|
||||
|
||||
" Only do this when not done yet for this buffer
|
||||
if (exists("b:did_ftplugin"))
|
||||
finish
|
||||
endif
|
||||
let b:did_ftplugin = 1
|
||||
|
||||
if !exists('b:git_dir')
|
||||
if expand('%:p') =~# '[\/]\.git[\/]modules[\/]'
|
||||
" Stay out of the way
|
||||
elseif expand('%:p') =~# '[\/]\.git[\/]worktrees'
|
||||
let b:git_dir = matchstr(expand('%:p'),'.*\.git[\/]worktrees[\/][^\/]\+\>')
|
||||
elseif expand('%:p') =~# '\.git\>'
|
||||
let b:git_dir = matchstr(expand('%:p'),'.*\.git\>')
|
||||
elseif $GIT_DIR != ''
|
||||
let b:git_dir = $GIT_DIR
|
||||
endif
|
||||
if (has('win32') || has('win64')) && exists('b:git_dir')
|
||||
let b:git_dir = substitute(b:git_dir,'\\','/','g')
|
||||
endif
|
||||
endif
|
||||
|
||||
if exists('*shellescape') && exists('b:git_dir') && b:git_dir != ''
|
||||
if b:git_dir =~# '/\.git$' " Not a bare repository
|
||||
let &l:path = escape(fnamemodify(b:git_dir,':h'),'\, ').','.&l:path
|
||||
endif
|
||||
let &l:path = escape(b:git_dir,'\, ').','.&l:path
|
||||
let &l:keywordprg = 'git --git-dir='.shellescape(b:git_dir).' show'
|
||||
else
|
||||
setlocal keywordprg=git\ show
|
||||
endif
|
||||
if has('gui_running')
|
||||
let &l:keywordprg = substitute(&l:keywordprg,'^git\>','git --no-pager','')
|
||||
endif
|
||||
|
||||
setlocal includeexpr=substitute(v:fname,'^[^/]\\+/','','')
|
||||
let b:undo_ftplugin = "setl keywordprg< path< includeexpr<"
|
|
@ -0,0 +1,64 @@
|
|||
" Vim filetype plugin
|
||||
" Language: git commit file
|
||||
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
|
||||
" Last Change: 2013 May 30
|
||||
|
||||
" Only do this when not done yet for this buffer
|
||||
if (exists("b:did_ftplugin"))
|
||||
finish
|
||||
endif
|
||||
|
||||
runtime! ftplugin/git.vim
|
||||
let b:did_ftplugin = 1
|
||||
|
||||
setlocal comments=:# commentstring=#\ %s
|
||||
setlocal nomodeline tabstop=8 formatoptions+=tl textwidth=72
|
||||
setlocal formatoptions-=c formatoptions-=r formatoptions-=o formatoptions-=q
|
||||
let b:undo_ftplugin = 'setl modeline< tabstop< formatoptions< tw< com< cms<'
|
||||
|
||||
if exists("g:no_gitcommit_commands") || v:version < 700
|
||||
finish
|
||||
endif
|
||||
|
||||
if !exists("b:git_dir")
|
||||
let b:git_dir = expand("%:p:h")
|
||||
endif
|
||||
|
||||
command! -bang -bar -buffer -complete=custom,s:diffcomplete -nargs=* DiffGitCached :call s:gitdiffcached(<bang>0,b:git_dir,<f-args>)
|
||||
|
||||
let b:undo_ftplugin = b:undo_ftplugin . "|delc DiffGitCached"
|
||||
|
||||
function! s:diffcomplete(A,L,P)
|
||||
let args = ""
|
||||
if a:P <= match(a:L." -- "," -- ")+3
|
||||
let args = args . "-p\n--stat\n--shortstat\n--summary\n--patch-with-stat\n--no-renames\n-B\n-M\n-C\n"
|
||||
end
|
||||
if exists("b:git_dir") && a:A !~ '^-'
|
||||
let tree = fnamemodify(b:git_dir,':h')
|
||||
if strpart(getcwd(),0,strlen(tree)) == tree
|
||||
let args = args."\n".system("git diff --cached --name-only")
|
||||
endif
|
||||
endif
|
||||
return args
|
||||
endfunction
|
||||
|
||||
function! s:gitdiffcached(bang,gitdir,...)
|
||||
let tree = fnamemodify(a:gitdir,':h')
|
||||
let name = tempname()
|
||||
let git = "git"
|
||||
if strpart(getcwd(),0,strlen(tree)) != tree
|
||||
let git .= " --git-dir=".(exists("*shellescape") ? shellescape(a:gitdir) : '"'.a:gitdir.'"')
|
||||
endif
|
||||
if a:0
|
||||
let extra = join(map(copy(a:000),exists("*shellescape") ? 'shellescape(v:val)' : "'\"'.v:val.'\"'"))
|
||||
else
|
||||
let extra = "-p --stat=".&columns
|
||||
endif
|
||||
call system(git." diff --cached --no-color --no-ext-diff ".extra." > ".(exists("*shellescape") ? shellescape(name) : name))
|
||||
exe "pedit ".(exists("*fnameescape") ? fnameescape(name) : name)
|
||||
wincmd P
|
||||
let b:git_dir = a:gitdir
|
||||
command! -bang -bar -buffer -complete=custom,s:diffcomplete -nargs=* DiffGitCached :call s:gitdiffcached(<bang>0,b:git_dir,<f-args>)
|
||||
nnoremap <buffer> <silent> q :q<CR>
|
||||
setlocal buftype=nowrite nobuflisted noswapfile nomodifiable filetype=git
|
||||
endfunction
|
|
@ -0,0 +1,15 @@
|
|||
" Vim filetype plugin
|
||||
" Language: git config file
|
||||
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
|
||||
" Last Change: 2009 Dec 24
|
||||
|
||||
" Only do this when not done yet for this buffer
|
||||
if (exists("b:did_ftplugin"))
|
||||
finish
|
||||
endif
|
||||
let b:did_ftplugin = 1
|
||||
|
||||
setlocal formatoptions-=t formatoptions+=croql
|
||||
setlocal comments=:#,:; commentstring=;\ %s
|
||||
|
||||
let b:undo_ftplugin = "setl fo< com< cms<"
|
|
@ -0,0 +1,47 @@
|
|||
" Snippets from vim-help
|
||||
" Credits: https://github.com/dahu/vim-help
|
||||
|
||||
if exists('b:did_ftplugin')
|
||||
finish
|
||||
endif
|
||||
let b:did_ftplugin = 1
|
||||
|
||||
let s:save_cpo = &cpoptions
|
||||
set cpoptions&vim
|
||||
|
||||
let b:undo_ftplugin = 'setlocal spell<'
|
||||
setlocal nospell
|
||||
|
||||
setlocal nohidden
|
||||
setlocal iskeyword+=:
|
||||
setlocal iskeyword+=#
|
||||
setlocal iskeyword+=-
|
||||
|
||||
wincmd L
|
||||
|
||||
" Jump to links with enter
|
||||
nmap <buffer> <CR> <C-]>
|
||||
|
||||
" Jump back with backspace
|
||||
nmap <buffer> <BS> <C-T>
|
||||
|
||||
" Skip to next option link
|
||||
nmap <buffer> o /'[a-z]\{2,\}'<CR>
|
||||
|
||||
" Skip to previous option link
|
||||
nmap <buffer> O ?'[a-z]\{2,\}'<CR>
|
||||
|
||||
" Skip to next subject link
|
||||
nmap <buffer><nowait> s /\|\S\+\|<CR>l
|
||||
|
||||
" Skip to previous subject link
|
||||
nmap <buffer> S h?\|\S\+\|<CR>l
|
||||
|
||||
" Skip to next tag (subject anchor)
|
||||
nmap <buffer> t /\*\S\+\*<CR>l
|
||||
|
||||
" Skip to previous tag (subject anchor)
|
||||
nmap <buffer> T h?\*\S\+\*<CR>l
|
||||
|
||||
let &cpoptions = s:save_cpo
|
||||
" vim: set ts=2 sw=2 tw=80 noet :
|
|
@ -0,0 +1,9 @@
|
|||
highlight clear SpellBad
|
||||
highlight SpellBad term=standout ctermfg=1
|
||||
highlight SpellBad term=underline cterm=underline
|
||||
highlight clear SpellCap
|
||||
highlight SpellCap term=underline cterm=underline
|
||||
highlight clear SpellRare
|
||||
highlight SpellRare term=underline cterm=underline
|
||||
highlight clear SpellLocal
|
||||
highlight SpellLocal term=underline cterm=underline
|
|
@ -1,10 +1,24 @@
|
|||
setl ts=4
|
||||
setl sts=4
|
||||
setl sw=4
|
||||
setl et
|
||||
setl tw=80
|
||||
setl colorcolumn=79
|
||||
setl smartindent
|
||||
setl autoindent
|
||||
setl formatoptions+=croq
|
||||
setl cinwords=if,elif,else,for,while,try,except,finally,def,class,with
|
||||
setlocal ts=4
|
||||
setlocal sts=4
|
||||
setlocal sw=4
|
||||
setlocal et
|
||||
setlocal tw=80
|
||||
setlocal colorcolumn=79
|
||||
setlocal smartindent
|
||||
setlocal autoindent
|
||||
setlocal formatoptions+=croq
|
||||
setlocal omnifunc=
|
||||
setlocal cinwords=if,elif,else,for,while,try,except,finally,def,class,with
|
||||
|
||||
nnoremap <leader>y :0,$!yapf<Cr>
|
||||
|
||||
let g:ale_sign_column_always = 1
|
||||
let g:ale_set_loclist = 0
|
||||
let g:ale_set_quickfix = 1
|
||||
|
||||
" Check Python files with flake8 and pylint.
|
||||
let b:ale_linters = ['flake8', 'pylint']
|
||||
" Fix Python files with autopep8 and yapf.
|
||||
let b:ale_fixers = ['autopep8', 'yapf']
|
||||
" Disable warnings about trailing whitespace for Python files.
|
||||
let b:ale_warn_about_trailing_whitespace = 0
|
|
@ -1,3 +1,48 @@
|
|||
set updatetime=2000
|
||||
autocmd CursorHold,CursorHoldI * silent! wall
|
||||
setlocal wrap
|
||||
setlocal sw=2
|
||||
setlocal tabstop=2
|
||||
setlocal expandtab
|
||||
setlocal textwidth=80
|
||||
setlocal softtabstop=2
|
||||
setlocal linebreak
|
||||
setlocal autoindent
|
||||
setl spelllang=es
|
||||
setl updatetime=2000
|
||||
|
||||
" Makes autocompletion for references nice
|
||||
set iskeyword+=:
|
||||
set iskeyword+=-:
|
||||
set iskeyword+=_:
|
||||
|
||||
" .tex files always interpreted as latex and not plain tex
|
||||
let g:tex_flavor='latex'
|
||||
let g:Tex_DefaultTargetFormat =" pdf"
|
||||
|
||||
" don't try to force highlighting matching sections
|
||||
let g:vimtex_motion_matchparen=0
|
||||
|
||||
" enable completion
|
||||
let g:vimtex_complete_enable=1
|
||||
|
||||
let g:vimtex_compiler_progname = 'nvr'
|
||||
let g:vimtex_view_use_temp_files = 2
|
||||
let g:vimtex_view_method = 'zathura'
|
||||
let g:vimtex_quickfix_mode = 0 " do not open the quickfix window automatically
|
||||
|
||||
" deoplete completion for LaTeX
|
||||
if !exists('g:deoplete#omni#input_patterns')
|
||||
let g:deoplete#omni#input_patterns = {}
|
||||
endif
|
||||
let g:deoplete#omni#input_patterns.tex = g:vimtex#re#deoplete
|
||||
|
||||
augroup texsave
|
||||
autocmd!
|
||||
autocmd CursorHold,CursorHoldI * silent! wall
|
||||
augroup END
|
||||
|
||||
command Compile normal! :52 split <cr><c-w>j:terminal latexmk %<CR>G
|
||||
|
||||
iab enum \begin{enumerate}<CR>\item{}<CR>\end{enumerate}<esc>k0f{a
|
||||
iab itemz \begin{itemize}<CR>\item{}<CR>\end{itemize}<esc>k0f{a
|
||||
iab fig \begin{figure}<CR>\includegraphics{}<CR>\caption{}<CR>\end{figure}<esc>2k0f{a
|
||||
iab fram \begin{frame}<CR>\end{frame}<esc>kA<CR>
|
|
@ -0,0 +1,429 @@
|
|||
" PEP8 compatible Python indent file
|
||||
" Language: Python
|
||||
" Maintainer: Daniel Hahler <https://daniel.hahler.de/>
|
||||
" Prev Maintainer: Hynek Schlawack <hs@ox.cx>
|
||||
" Prev Maintainer: Eric Mc Sween <em@tomcom.de> (address invalid)
|
||||
" Original Author: David Bustos <bustos@caltech.edu> (address invalid)
|
||||
" License: CC0
|
||||
"
|
||||
" vim-python-pep8-indent - A nicer Python indentation style for vim.
|
||||
" Written in 2004 by David Bustos <bustos@caltech.edu>
|
||||
" Maintained from 2004-2005 by Eric Mc Sween <em@tomcom.de>
|
||||
" Maintained from 2013 by Hynek Schlawack <hs@ox.cx>
|
||||
" Maintained from 2017 by Daniel Hahler <https://daniel.hahler.de/>
|
||||
"
|
||||
" To the extent possible under law, the author(s) have dedicated all copyright
|
||||
" and related and neighboring rights to this software to the public domain
|
||||
" worldwide. This software is distributed without any warranty.
|
||||
" You should have received a copy of the CC0 Public Domain Dedication along
|
||||
" with this software. If not, see
|
||||
" <http://creativecommons.org/publicdomain/zero/1.0/>.
|
||||
|
||||
" Only load this indent file when no other was loaded.
|
||||
if exists('b:did_indent')
|
||||
finish
|
||||
endif
|
||||
let b:did_indent = 1
|
||||
|
||||
setlocal nolisp
|
||||
setlocal autoindent
|
||||
setlocal indentexpr=GetPythonPEPIndent(v:lnum)
|
||||
setlocal indentkeys=!^F,o,O,<:>,0),0],0},=elif,=except
|
||||
|
||||
if !exists('g:python_pep8_indent_multiline_string')
|
||||
let g:python_pep8_indent_multiline_string = 0
|
||||
endif
|
||||
|
||||
let s:block_rules = {
|
||||
\ '^\s*elif\>': ['if', 'elif'],
|
||||
\ '^\s*except\>': ['try', 'except'],
|
||||
\ '^\s*finally\>': ['try', 'except', 'else']
|
||||
\ }
|
||||
let s:block_rules_multiple = {
|
||||
\ '^\s*else\>': ['if', 'elif', 'for', 'try', 'except'],
|
||||
\ }
|
||||
" Pairs to look for when searching for opening parenthesis.
|
||||
" The value is the maximum offset in lines.
|
||||
let s:paren_pairs = {'()': 50, '[]': 100, '{}': 1000}
|
||||
|
||||
if &filetype ==# 'pyrex' || &filetype ==# 'cython'
|
||||
let b:control_statement = '\v^\s*(class|def|if|while|with|for|except|cdef|cpdef)>'
|
||||
else
|
||||
let b:control_statement = '\v^\s*(class|def|if|while|with|for|except)>'
|
||||
endif
|
||||
let s:stop_statement = '^\s*\(break\|continue\|raise\|return\|pass\)\>'
|
||||
|
||||
" Skip strings and comments. Return 1 for chars to skip.
|
||||
" jedi* refers to syntax definitions from jedi-vim for call signatures, which
|
||||
" are inserted temporarily into the buffer.
|
||||
let s:skip_special_chars = 'synIDattr(synID(line("."), col("."), 0), "name") ' .
|
||||
\ '=~? "\\vstring|comment|jedi\\S"'
|
||||
|
||||
let s:skip_after_opening_paren = 'synIDattr(synID(line("."), col("."), 0), "name") ' .
|
||||
\ '=~? "\\vcomment|jedi\\S"'
|
||||
|
||||
" Also ignore anything concealed.
|
||||
" Wrapper around synconcealed for older Vim (7.3.429, used on Travis CI).
|
||||
function! s:is_concealed(line, col)
|
||||
let concealed = synconcealed(a:line, a:col)
|
||||
return len(concealed) && concealed[0]
|
||||
endfunction
|
||||
if has('conceal')
|
||||
let s:skip_special_chars .= '|| s:is_concealed(line("."), col("."))'
|
||||
endif
|
||||
|
||||
|
||||
let s:skip_search = 'synIDattr(synID(line("."), col("."), 0), "name") ' .
|
||||
\ '=~? "comment"'
|
||||
|
||||
" Use 'shiftwidth()' instead of '&sw'.
|
||||
" (Since Vim patch 7.3.629, 'shiftwidth' can be set to 0 to follow 'tabstop').
|
||||
if exists('*shiftwidth')
|
||||
function! s:sw()
|
||||
return shiftwidth()
|
||||
endfunction
|
||||
else
|
||||
function! s:sw()
|
||||
return &shiftwidth
|
||||
endfunction
|
||||
endif
|
||||
|
||||
function! s:pair_sort(x, y)
|
||||
if a:x[0] == a:y[0]
|
||||
return a:x[1] == a:y[1] ? 0 : a:x[1] > a:y[1] ? 1 : -1
|
||||
else
|
||||
return a:x[0] > a:y[0] ? 1 : -1
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" Find backwards the closest open parenthesis/bracket/brace.
|
||||
function! s:find_opening_paren(...)
|
||||
" optional arguments: line and column (defaults to 1) to search around
|
||||
if a:0 > 0
|
||||
let view = winsaveview()
|
||||
call cursor(a:1, a:0 > 1 ? a:2 : 1)
|
||||
let ret = s:find_opening_paren()
|
||||
call winrestview(view)
|
||||
return ret
|
||||
endif
|
||||
|
||||
" Return if cursor is in a comment.
|
||||
exe 'if' s:skip_search '| return [0, 0] | endif'
|
||||
|
||||
let nearest = [0, 0]
|
||||
for [p, maxoff] in items(s:paren_pairs)
|
||||
let stopline = max([0, line('.') - maxoff, nearest[0]])
|
||||
let next = searchpairpos(
|
||||
\ '\V'.p[0], '', '\V'.p[1], 'bnW', s:skip_special_chars, stopline)
|
||||
if next[0] && (next[0] > nearest[0] || (next[0] == nearest[0] && next[1] > nearest[1]))
|
||||
let nearest = next
|
||||
endif
|
||||
endfor
|
||||
return nearest
|
||||
endfunction
|
||||
|
||||
" Find the start of a multi-line statement
|
||||
function! s:find_start_of_multiline_statement(lnum)
|
||||
let lnum = a:lnum
|
||||
while lnum > 0
|
||||
if getline(lnum - 1) =~# '\\$'
|
||||
let lnum = prevnonblank(lnum - 1)
|
||||
else
|
||||
let [paren_lnum, _] = s:find_opening_paren(lnum)
|
||||
if paren_lnum < 1
|
||||
return lnum
|
||||
else
|
||||
let lnum = paren_lnum
|
||||
endif
|
||||
endif
|
||||
endwhile
|
||||
endfunction
|
||||
|
||||
" Find possible indent(s) of the block starter that matches the current line.
|
||||
function! s:find_start_of_block(lnum, types, multiple)
|
||||
let r = []
|
||||
let types = copy(a:types)
|
||||
let re = '\V\^\s\*\('.join(a:types, '\|').'\)\>'
|
||||
let lnum = a:lnum
|
||||
let last_indent = indent(lnum) + 1
|
||||
while lnum > 0 && last_indent > 0
|
||||
let indent = indent(lnum)
|
||||
if indent < last_indent
|
||||
for type in types
|
||||
let re = '\v^\s*'.type.'>'
|
||||
if getline(lnum) =~# re
|
||||
if !a:multiple
|
||||
return [indent]
|
||||
endif
|
||||
if index(r, indent) == -1
|
||||
let r += [indent]
|
||||
endif
|
||||
" Remove any handled type, e.g. 'if'.
|
||||
call remove(types, index(types, type))
|
||||
endif
|
||||
endfor
|
||||
let last_indent = indent(lnum)
|
||||
endif
|
||||
let lnum = prevnonblank(lnum - 1)
|
||||
endwhile
|
||||
return r
|
||||
endfunction
|
||||
|
||||
" Is "expr" true for every position in "lnum", beginning at "start"?
|
||||
" (optionally up to a:1 / 4th argument)
|
||||
function! s:match_expr_on_line(expr, lnum, start, ...)
|
||||
let text = getline(a:lnum)
|
||||
let end = a:0 ? a:1 : len(text)
|
||||
if a:start > end
|
||||
return 1
|
||||
endif
|
||||
let save_pos = getpos('.')
|
||||
let r = 1
|
||||
for i in range(a:start, end)
|
||||
call cursor(a:lnum, i)
|
||||
if !(eval(a:expr) || text[i-1] =~# '\s')
|
||||
let r = 0
|
||||
break
|
||||
endif
|
||||
endfor
|
||||
call setpos('.', save_pos)
|
||||
return r
|
||||
endfunction
|
||||
|
||||
" Line up with open parenthesis/bracket/brace.
|
||||
function! s:indent_like_opening_paren(lnum)
|
||||
let [paren_lnum, paren_col] = s:find_opening_paren(a:lnum)
|
||||
if paren_lnum <= 0
|
||||
return -2
|
||||
endif
|
||||
let text = getline(paren_lnum)
|
||||
let base = indent(paren_lnum)
|
||||
|
||||
let nothing_after_opening_paren = s:match_expr_on_line(
|
||||
\ s:skip_after_opening_paren, paren_lnum, paren_col+1)
|
||||
let starts_with_closing_paren = getline(a:lnum) =~# '^\s*[])}]'
|
||||
|
||||
if nothing_after_opening_paren
|
||||
if starts_with_closing_paren
|
||||
let res = base
|
||||
else
|
||||
let res = base + s:sw()
|
||||
endif
|
||||
else
|
||||
" Indent to match position of opening paren.
|
||||
let res = paren_col
|
||||
endif
|
||||
|
||||
" If this line is the continuation of a control statement
|
||||
" indent further to distinguish the continuation line
|
||||
" from the next logical line.
|
||||
if text =~# b:control_statement && res == base + s:sw()
|
||||
return base + s:sw() * 2
|
||||
else
|
||||
return res
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" Match indent of first block of this type.
|
||||
function! s:indent_like_block(lnum)
|
||||
let text = getline(a:lnum)
|
||||
for [multiple, block_rules] in [
|
||||
\ [0, s:block_rules],
|
||||
\ [1, s:block_rules_multiple]]
|
||||
for [line_re, blocks] in items(block_rules)
|
||||
if text !~# line_re
|
||||
continue
|
||||
endif
|
||||
|
||||
let indents = s:find_start_of_block(a:lnum - 1, blocks, multiple)
|
||||
if !len(indents)
|
||||
return -1
|
||||
endif
|
||||
if len(indents) == 1
|
||||
return indents[0]
|
||||
endif
|
||||
|
||||
" Multiple valid indents, e.g. for 'else' with both try and if.
|
||||
let indent = indent(a:lnum)
|
||||
if index(indents, indent) != -1
|
||||
" The indent is valid, keep it.
|
||||
return indent
|
||||
endif
|
||||
" Fallback to the first/nearest one.
|
||||
return indents[0]
|
||||
endfor
|
||||
endfor
|
||||
return -2
|
||||
endfunction
|
||||
|
||||
function! s:indent_like_previous_line(lnum)
|
||||
let lnum = prevnonblank(a:lnum - 1)
|
||||
|
||||
" No previous line, keep current indent.
|
||||
if lnum < 1
|
||||
return -1
|
||||
endif
|
||||
|
||||
let text = getline(lnum)
|
||||
let start = s:find_start_of_multiline_statement(lnum)
|
||||
let base = indent(start)
|
||||
let current = indent(a:lnum)
|
||||
|
||||
" Jump to last character in previous line.
|
||||
call cursor(lnum, len(text))
|
||||
let ignore_last_char = eval(s:skip_special_chars)
|
||||
|
||||
" Search for final colon that is not inside something to be ignored.
|
||||
while 1
|
||||
let curpos = getpos('.')[2]
|
||||
if curpos == 1 | break | endif
|
||||
if eval(s:skip_special_chars) || text[curpos-1] =~# '\s'
|
||||
normal! h
|
||||
continue
|
||||
elseif text[curpos-1] ==# ':'
|
||||
return base + s:sw()
|
||||
endif
|
||||
break
|
||||
endwhile
|
||||
|
||||
if text =~# '\\$' && !ignore_last_char
|
||||
" If this line is the continuation of a control statement
|
||||
" indent further to distinguish the continuation line
|
||||
" from the next logical line.
|
||||
if getline(start) =~# b:control_statement
|
||||
return base + s:sw() * 2
|
||||
endif
|
||||
|
||||
" Nest (other) explicit continuations only one level deeper.
|
||||
return base + s:sw()
|
||||
endif
|
||||
|
||||
let empty = getline(a:lnum) =~# '^\s*$'
|
||||
|
||||
" Current and prev line are empty, next is not -> indent like next.
|
||||
if empty && a:lnum > 1 &&
|
||||
\ (getline(a:lnum - 1) =~# '^\s*$') &&
|
||||
\ !(getline(a:lnum + 1) =~# '^\s*$')
|
||||
return indent(a:lnum + 1)
|
||||
endif
|
||||
|
||||
" If the previous statement was a stop-execution statement or a pass
|
||||
if getline(start) =~# s:stop_statement
|
||||
" Remove one level of indentation if the user hasn't already dedented
|
||||
if empty || current > base - s:sw()
|
||||
return base - s:sw()
|
||||
endif
|
||||
" Otherwise, trust the user
|
||||
return -1
|
||||
endif
|
||||
|
||||
if !empty && s:is_dedented_already(current, base)
|
||||
return -1
|
||||
endif
|
||||
|
||||
" In all other cases, line up with the start of the previous statement.
|
||||
return base
|
||||
endfunction
|
||||
|
||||
" If this line is dedented and the number of indent spaces is valid
|
||||
" (multiple of the indentation size), trust the user.
|
||||
function! s:is_dedented_already(current, base)
|
||||
let dedent_size = a:current - a:base
|
||||
return (dedent_size < 0 && a:current % s:sw() == 0) ? 1 : 0
|
||||
endfunction
|
||||
|
||||
" Is the syntax at lnum (and optionally cnum) a python string?
|
||||
function! s:is_python_string(lnum, ...)
|
||||
let line = getline(a:lnum)
|
||||
let linelen = len(line)
|
||||
if linelen < 1
|
||||
let linelen = 1
|
||||
endif
|
||||
let cols = a:0 ? type(a:1) != type([]) ? [a:1] : a:1 : range(1, linelen)
|
||||
for cnum in cols
|
||||
if match(map(synstack(a:lnum, cnum),
|
||||
\ "synIDattr(v:val, 'name')"), 'python\S*String') == -1
|
||||
return 0
|
||||
end
|
||||
endfor
|
||||
return 1
|
||||
endfunction
|
||||
|
||||
function! GetPythonPEPIndent(lnum)
|
||||
" First line has indent 0
|
||||
if a:lnum == 1
|
||||
return 0
|
||||
endif
|
||||
|
||||
let line = getline(a:lnum)
|
||||
let prevline = getline(a:lnum-1)
|
||||
|
||||
" Multilinestrings: continous, docstring or starting.
|
||||
if s:is_python_string(a:lnum-1, len(prevline))
|
||||
\ && (s:is_python_string(a:lnum, 1)
|
||||
\ || match(line, '^\%("""\|''''''\)') != -1)
|
||||
|
||||
" Indent closing quotes as the line with the opening ones.
|
||||
let match_quotes = match(line, '^\s*\zs\%("""\|''''''\)')
|
||||
if match_quotes != -1
|
||||
" closing multiline string
|
||||
let quotes = line[match_quotes:(match_quotes+2)]
|
||||
let pairpos = searchpairpos(quotes, '', quotes, 'b')
|
||||
if pairpos[0] != 0
|
||||
return indent(pairpos[0])
|
||||
else
|
||||
" TODO: test to cover this!
|
||||
endif
|
||||
endif
|
||||
|
||||
if s:is_python_string(a:lnum-1)
|
||||
" Previous line is (completely) a string.
|
||||
return indent(a:lnum-1)
|
||||
endif
|
||||
|
||||
if match(prevline, '^\s*\%("""\|''''''\)') != -1
|
||||
" docstring.
|
||||
return indent(a:lnum-1)
|
||||
endif
|
||||
|
||||
let indent_multi = get(b:, 'python_pep8_indent_multiline_string',
|
||||
\ get(g:, 'python_pep8_indent_multiline_string', 0))
|
||||
if match(prevline, '\v%("""|'''''')$') != -1
|
||||
" Opening multiline string, started in previous line.
|
||||
if (&autoindent && indent(a:lnum) == indent(a:lnum-1))
|
||||
\ || match(line, '\v^\s+$') != -1
|
||||
" <CR> with empty line or to split up 'foo("""bar' into
|
||||
" 'foo("""' and 'bar'.
|
||||
if indent_multi == -2
|
||||
return indent(a:lnum-1) + s:sw()
|
||||
endif
|
||||
return indent_multi
|
||||
endif
|
||||
endif
|
||||
|
||||
" Keep existing indent.
|
||||
if match(line, '\v^\s*\S') != -1
|
||||
return -1
|
||||
endif
|
||||
|
||||
if indent_multi != -2
|
||||
return indent_multi
|
||||
endif
|
||||
|
||||
return s:indent_like_opening_paren(a:lnum)
|
||||
endif
|
||||
|
||||
" Parens: If we can find an open parenthesis/bracket/brace, line up with it.
|
||||
let indent = s:indent_like_opening_paren(a:lnum)
|
||||
if indent >= -1
|
||||
return indent
|
||||
endif
|
||||
|
||||
" Blocks: Match indent of first block of this type.
|
||||
let indent = s:indent_like_block(a:lnum)
|
||||
if indent >= -1
|
||||
return indent
|
||||
endif
|
||||
|
||||
return s:indent_like_previous_line(a:lnum)
|
||||
endfunction
|
|
@ -16,11 +16,18 @@
|
|||
" Plugins {{{
|
||||
call plug#begin('~/.config/nvim/plugged')
|
||||
Plug 'junegunn/vim-plug'
|
||||
Plug 'junegunn/goyo.vim', { 'for': 'mail'}
|
||||
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
|
||||
Plug 'jiangmiao/auto-pairs'
|
||||
Plug 'tpope/vim-surround'
|
||||
"Plug 'davidhalter/jedi-vim', { 'for': 'python3' }
|
||||
Plug 'zchee/deoplete-jedi', { 'for': 'python3' }
|
||||
Plug 'w0rp/ale'
|
||||
Plug 'sbdchd/neoformat'
|
||||
Plug 'junegunn/goyo.vim', { 'for': 'mail', 'on': 'Goyo'}
|
||||
Plug 'scrooloose/nerdtree', { 'on': ['NERDTreeFind', 'NERDTreeToggle'] }
|
||||
Plug 'christoomey/vim-tmux-navigator'
|
||||
Plug 'zefei/vim-wintabs'
|
||||
Plug 'Shougo/vinarise.vim'
|
||||
"Plug 'Shougo/vinarise.vim'
|
||||
Plug 'lervag/vimtex', { 'for': 'tex' }
|
||||
"Plug 'xuhdev/vim-latex-live-preview', { 'for': 'tex' }
|
||||
Plug '/usr/bin/fzf'
|
||||
|
@ -39,6 +46,7 @@
|
|||
let $NVIM_TUI_ENABLE_CURSOR_SHAPE=1
|
||||
let $NVIM_TUI_ENABLE_TRUE_COLOR=1
|
||||
|
||||
set binary
|
||||
set encoding=utf-8 " The encoding displayed.
|
||||
set fileencoding=utf-8 " The encoding written to file.
|
||||
scriptencoding utf-8 " Set utf-8 as default script encoding
|
||||
|
@ -48,7 +56,10 @@
|
|||
set showmode " Always show mode
|
||||
set textwidth=120 " Text width is 120 characters
|
||||
set cmdheight=1 " Command line height
|
||||
set cmdwinheight=5 " Command-line lines
|
||||
set pumheight=10 " Completion window max size
|
||||
set helpheight=12 " Minimum help window height
|
||||
set previewheight=12 " Completion preview height
|
||||
set noswapfile " New buffers will be loaded without creating a swapfile
|
||||
set hidden " Enables to switch between unsaved buffers and keep undo history
|
||||
set lazyredraw " Don't redraw while executing macros (better performance)
|
||||
|
@ -96,11 +107,21 @@
|
|||
set undodir=$HOME/.config/nvim/undo
|
||||
set termguicolors
|
||||
set fillchars="fold: " " Characters to fill the statuslines and vertical separators
|
||||
set fillchars+=vert:\│ " Make vertical split separator full line
|
||||
|
||||
set nrformats-=octal
|
||||
set pastetoggle=<F12>
|
||||
set breakat=\ \ ;:,!? " Long lines break chars
|
||||
set shortmess=aoOtIWcFs " Shorten messages and don't show intro
|
||||
set omnifunc=syntaxcomplete#Complete
|
||||
set complete+=]
|
||||
set completeopt-=preview
|
||||
set completeopt+=noinsert,longest,noselect,menuone
|
||||
set formatoptions+=n
|
||||
let &formatlistpat='^\s*\(\d\+[\]:.)}\t ]\|[*-][\t ]\)\s*'
|
||||
|
||||
" Display all matching files when we tab complete
|
||||
set wildmenu
|
||||
set wildignorecase
|
||||
set wildoptions=tagfile
|
||||
set wildignore+=.git,.hg,.svn
|
||||
set wildignore+=*.aux,*.out,*.toc
|
||||
set wildignore+=*.o,*.obj,*.exe,*.dll,*.manifest,*.rbc,*.class
|
||||
|
@ -111,14 +132,15 @@
|
|||
set wildignore+=*.doc,*.pdf,*.cbr,*.cbz
|
||||
set wildignore+=*.zip,*.tar.gz,*.tar.bz2,*.rar,*.tar.xz,*.kgb
|
||||
set wildignore+=*.swp,.lock,.DS_Store,._*
|
||||
set wildignore+=.stversions,*.pyc,*.spl,*.o,*.out,*~,%*
|
||||
set wildignore+=*vim/backups*
|
||||
set wildignore+=*sass-cache*
|
||||
set wildignore+=tmp/**
|
||||
set wildignore+=*.gem
|
||||
set wildignore+=log/**
|
||||
set wildignore+=*cache*
|
||||
set wildignore+=*logs*
|
||||
set wildignore+=*node_modules/**
|
||||
set wildignore+=__pycache__,*.egg-info
|
||||
set wildmode=longest:list,full
|
||||
|
||||
colorscheme turtles
|
||||
|
@ -145,6 +167,19 @@
|
|||
endif
|
||||
endfunction
|
||||
|
||||
function! LinterStatus() abort
|
||||
let l:counts = ale#statusline#Count(bufnr(''))
|
||||
|
||||
let l:all_errors = l:counts.error + l:counts.style_error
|
||||
let l:all_non_errors = l:counts.total - l:all_errors
|
||||
|
||||
return l:counts.total == 0 ? 'OK' : printf(
|
||||
\ '%dW %dE',
|
||||
\ all_non_errors,
|
||||
\ all_errors
|
||||
\)
|
||||
endfunction
|
||||
|
||||
set statusline=
|
||||
set statusline+=%#SpecialKey#
|
||||
set statusline+=\ %{StatuslineGit()}
|
||||
|
@ -153,6 +188,7 @@
|
|||
set statusline+=\ %y
|
||||
set statusline+=\ %h%m%r%w%q
|
||||
set statusline+=%=
|
||||
set statusline+=%{LinterStatus()}
|
||||
set statusline+=%{PasteForStatusline()}
|
||||
set statusline+=\ %{&fileencoding?&fileencoding:&encoding}
|
||||
set statusline+=\ [%{&fileformat}\]
|
||||
|
@ -183,8 +219,8 @@
|
|||
aug mutt_settings
|
||||
autocmd BufRead,BufNewFile /tmp/neomutt* let g:goyo_width=90
|
||||
autocmd BufRead,BufNewFile /tmp/neomutt* :Goyo
|
||||
autocmd BufEnter /tmp/neomutt* :exe "normal! 9j\<cr>I"
|
||||
autocmd BufEnter /tmp/neomutt* set spelllang=es
|
||||
autocmd BufEnter /tmp/neomutt* :exe "normal! 9j\<cr>o"
|
||||
autocmd BufEnter /tmp/neomutt* setl spelllang=es
|
||||
aug END
|
||||
endif
|
||||
"}}}
|
||||
|
@ -212,6 +248,34 @@
|
|||
let g:netrw_winsize=25
|
||||
" }}}
|
||||
|
||||
" {{{ Ale
|
||||
let g:ale_echo_msg_error_str = 'E'
|
||||
let g:ale_echo_msg_warning_str = 'W'
|
||||
let g:ale_echo_msg_format = '[%linter%] %s [%severity%]'
|
||||
" }}}
|
||||
|
||||
" Jedi {{{
|
||||
" let g:jedi#completions_enabled = 0
|
||||
" let g:jedi#auto_vim_configuration = 0
|
||||
" let g:jedi#smart_auto_mappings = 0
|
||||
" let g:jedi#show_call_signatures = 1
|
||||
" let g:jedi#use_tag_stack = 0
|
||||
" let g:jedi#popup_select_first = 0
|
||||
" let g:jedi#popup_on_dot = 0
|
||||
" let g:jedi#max_doc_height = 100
|
||||
" let g:jedi#quickfix_window_height = 10
|
||||
" let g:jedi#use_splits_not_buffers = 'right'
|
||||
"}}}
|
||||
|
||||
" Deoplete {{{
|
||||
let g:deoplete#enable_at_startup = 1
|
||||
let g:deoplete#sources#jedi#show_docstring = 1
|
||||
let g:deoplete#enable_ignore_case = 1
|
||||
let g:deoplete#enable_smart_case = 1
|
||||
let g:context_filetype#same_filetypes = {}
|
||||
let g:context_filetype#same_filetypes._ = '_'
|
||||
"}}}
|
||||
|
||||
" FZF {{{
|
||||
" An action can be a reference to a function that processes selected lines
|
||||
function! s:build_quickfix_list(lines)
|
||||
|
@ -339,7 +403,7 @@
|
|||
|
||||
" NerdTree {{{
|
||||
autocmd StdinReadPre * let s:std_in=1
|
||||
let NERDTreeIgnore=['\.rbc$', '\~$', '\.pyc$', '\.db$', '\.sqlite$', '.o$', 'bower_components', 'node_modules', '__pycache__']
|
||||
let NERDTreeIgnore=['\.rbc$', '\~$', '\.pyc$', '\.pyo$', '\.db$', '\.sqlite$', '.o$', 'bower_components', 'node_modules', '__pycache__']
|
||||
let g:NERDTreeSortOrder=['^__\.py$', '\/$', '*', '\.swp$', '\.bak$', '\~$']
|
||||
let NERDTreeNaturalSort = 1
|
||||
let NERDTreeShowHidden=1
|
||||
|
@ -364,19 +428,21 @@
|
|||
nnoremap <silent> M-Tab :TmuxNavigatePrevious<cr>
|
||||
" }}}
|
||||
|
||||
" LaTeX {{{
|
||||
let g:tex_flavor = "latex"
|
||||
" }}}
|
||||
|
||||
" Mappings {{{
|
||||
map <M-p> :!w<Enter>:!pdflatex <C-r>%<Enter>
|
||||
map <M-a> :setlocal spell! spelllang=es<CR>
|
||||
map <M-u> :setlocal spell! spelllang=en<CR>
|
||||
map <M-g> :Goyo<CR>
|
||||
map <F9> :!w<Enter>:!pdflatex <C-r>%<Enter>
|
||||
map <F6> :setlocal spell! spelllang=es<CR>
|
||||
map <F7> :setlocal spell! spelllang=en<CR>
|
||||
map <F8> :Goyo<CR>
|
||||
inoremap <M-g> <esc>:Goyo<CR>a
|
||||
|
||||
nmap <silent> <F10> <Plug>(ale_previous_wrap)
|
||||
nmap <silent> <F11> <Plug>(ale_next_wrap)
|
||||
|
||||
nnoremap <leader>f :Neoformat<CR>
|
||||
vnoremap <leader>f :Neoformat<CR>
|
||||
|
||||
" FZF really is a lifechanger
|
||||
nnoremap <C-p> :FZF<CR>
|
||||
nnoremap <F4> :FZF<CR>
|
||||
nnoremap <leader>xb :Buffers<cr>
|
||||
nnoremap <leader>xc :History:<cr>
|
||||
nnoremap <leader>xf :Files<cr>
|
||||
|
@ -398,7 +464,7 @@
|
|||
imap <c-x><c-l> <plug>(fzf-complete-line)
|
||||
|
||||
nnoremap <silent> <F2> :NERDTreeFind<CR>
|
||||
nnoremap <leader>t :NERDTreeToggle<CR>
|
||||
nnoremap <silent> <F3> :NERDTreeToggle<CR>
|
||||
nnoremap <leader>pi :PlugInstall<CR>
|
||||
nnoremap <leader>pu :PlugUpdate<CR>
|
||||
nnoremap <leader>pU :PlugUpgrade<CR>
|
||||
|
@ -417,6 +483,14 @@
|
|||
nnoremap <leader>wnv :vnew<CR>
|
||||
nnoremap <leader>wns :new<CR>
|
||||
|
||||
" ensure that ctrl+u in insert mode can be reversed
|
||||
" http://vim.wikia.com/wiki/Recover_from_accidental_Ctrl-U
|
||||
inoremap <c-u> <c-g>u<c-u>
|
||||
inoremap <c-w> <c-g>u<c-w>
|
||||
|
||||
" My vim wants to enter all the time, enter all the time
|
||||
nnoremap <silent> <CR> i<CR><ESC>
|
||||
|
||||
" Fix indentation
|
||||
nnoremap <leader>i mzgg=G`z<CR>
|
||||
|
||||
|
@ -433,6 +507,16 @@
|
|||
vnoremap j gj
|
||||
vnoremap k gk
|
||||
|
||||
" Use tab for indenting in visual mode
|
||||
vnoremap <Tab> >gv|
|
||||
vnoremap <S-Tab> <gv
|
||||
|
||||
noremap <silent> <Home> g<Home>
|
||||
noremap <silent> <End> g<End>
|
||||
inoremap <silent> <Home> <C-o>g<Home>
|
||||
inoremap <silent> <End> <C-o>g<End>
|
||||
noremap Y y$
|
||||
|
||||
" Center screen when jumping and moving
|
||||
nnoremap <silent> n :norm! nzz<CR>
|
||||
nnoremap <silent> N :norm! Nzz<CR>
|
||||
|
@ -448,8 +532,8 @@
|
|||
vnoremap <C-b> <C-b>zz
|
||||
|
||||
" Tabs
|
||||
nnoremap <C-n> :tabnew<CR>
|
||||
nnoremap <leader>bx :bd!<CR>
|
||||
nnoremap <C-Tab> :tabnew<CR>
|
||||
nnoremap <M-Tab> :bd!<CR>
|
||||
nnoremap <Tab> :bnext!<CR>
|
||||
nnoremap <S-Tab> :bprev!<CR>
|
||||
|
||||
|
|
|
@ -0,0 +1,489 @@
|
|||
" Vim syntax file
|
||||
" Language: C
|
||||
" Maintainer: Bram Moolenaar <Bram@vim.org>
|
||||
" Last Change: 2016 Nov 18
|
||||
|
||||
" Quit when a (custom) syntax file was already loaded
|
||||
if exists("b:current_syntax")
|
||||
finish
|
||||
endif
|
||||
|
||||
let s:cpo_save = &cpo
|
||||
set cpo&vim
|
||||
|
||||
let s:ft = matchstr(&ft, '^\([^.]\)\+')
|
||||
|
||||
" A bunch of useful C keywords
|
||||
syn keyword cStatement goto break return continue asm
|
||||
syn keyword cLabel case default
|
||||
syn keyword cConditional if else switch
|
||||
syn keyword cRepeat while for do
|
||||
|
||||
syn keyword cTodo contained TODO FIXME XXX
|
||||
|
||||
" It's easy to accidentally add a space after a backslash that was intended
|
||||
" for line continuation. Some compilers allow it, which makes it
|
||||
" unpredictable and should be avoided.
|
||||
syn match cBadContinuation contained "\\\s\+$"
|
||||
|
||||
" cCommentGroup allows adding matches for special things in comments
|
||||
syn cluster cCommentGroup contains=cTodo,cBadContinuation
|
||||
|
||||
" String and Character constants
|
||||
" Highlight special characters (those which have a backslash) differently
|
||||
syn match cSpecial display contained "\\\(x\x\+\|\o\{1,3}\|.\|$\)"
|
||||
if !exists("c_no_utf")
|
||||
syn match cSpecial display contained "\\\(u\x\{4}\|U\x\{8}\)"
|
||||
endif
|
||||
|
||||
if !exists("c_no_cformat")
|
||||
" Highlight % items in strings.
|
||||
if !exists("c_no_c99") " ISO C99
|
||||
syn match cFormat display "%\(\d\+\$\)\=[-+' #0*]*\(\d*\|\*\|\*\d\+\$\)\(\.\(\d*\|\*\|\*\d\+\$\)\)\=\([hlLjzt]\|ll\|hh\)\=\([aAbdiuoxXDOUfFeEgGcCsSpn]\|\[\^\=.[^]]*\]\)" contained
|
||||
else
|
||||
syn match cFormat display "%\(\d\+\$\)\=[-+' #0*]*\(\d*\|\*\|\*\d\+\$\)\(\.\(\d*\|\*\|\*\d\+\$\)\)\=\([hlL]\|ll\)\=\([bdiuoxXDOUfeEgGcCsSpn]\|\[\^\=.[^]]*\]\)" contained
|
||||
endif
|
||||
syn match cFormat display "%%" contained
|
||||
endif
|
||||
|
||||
" cCppString: same as cString, but ends at end of line
|
||||
if s:ft ==# "cpp" && !exists("cpp_no_cpp11") && !exists("c_no_cformat")
|
||||
" ISO C++11
|
||||
syn region cString start=+\(L\|u\|u8\|U\|R\|LR\|u8R\|uR\|UR\)\="+ skip=+\\\\\|\\"+ end=+"+ contains=cSpecial,cFormat,@Spell extend
|
||||
syn region cCppString start=+\(L\|u\|u8\|U\|R\|LR\|u8R\|uR\|UR\)\="+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end='$' contains=cSpecial,cFormat,@Spell
|
||||
elseif s:ft ==# "c" && !exists("c_no_c11") && !exists("c_no_cformat")
|
||||
" ISO C99
|
||||
syn region cString start=+\%(L\|U\|u8\)\="+ skip=+\\\\\|\\"+ end=+"+ contains=cSpecial,cFormat,@Spell extend
|
||||
syn region cCppString start=+\%(L\|U\|u8\)\="+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end='$' contains=cSpecial,cFormat,@Spell
|
||||
else
|
||||
" older C or C++
|
||||
syn match cFormat display "%%" contained
|
||||
syn region cString start=+L\="+ skip=+\\\\\|\\"+ end=+"+ contains=cSpecial,cFormat,@Spell extend
|
||||
syn region cCppString start=+L\="+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end='$' contains=cSpecial,cFormat,@Spell
|
||||
endif
|
||||
|
||||
syn region cCppSkip contained start="^\s*\(%:\|#\)\s*\(if\>\|ifdef\>\|ifndef\>\)" skip="\\$" end="^\s*\(%:\|#\)\s*endif\>" contains=cSpaceError,cCppSkip
|
||||
|
||||
syn cluster cStringGroup contains=cCppString,cCppSkip
|
||||
|
||||
syn match cCharacter "L\='[^\\]'"
|
||||
syn match cCharacter "L'[^']*'" contains=cSpecial
|
||||
if exists("c_gnu")
|
||||
syn match cSpecialError "L\='\\[^'\"?\\abefnrtv]'"
|
||||
syn match cSpecialCharacter "L\='\\['\"?\\abefnrtv]'"
|
||||
else
|
||||
syn match cSpecialError "L\='\\[^'\"?\\abfnrtv]'"
|
||||
syn match cSpecialCharacter "L\='\\['\"?\\abfnrtv]'"
|
||||
endif
|
||||
syn match cSpecialCharacter display "L\='\\\o\{1,3}'"
|
||||
syn match cSpecialCharacter display "'\\x\x\{1,2}'"
|
||||
syn match cSpecialCharacter display "L'\\x\x\+'"
|
||||
|
||||
if (s:ft ==# "c" && !exists("c_no_c11")) || (s:ft ==# "cpp" && !exists("cpp_no_cpp11"))
|
||||
" ISO C11 or ISO C++ 11
|
||||
if exists("c_no_cformat")
|
||||
syn region cString start=+\%(U\|u8\=\)"+ skip=+\\\\\|\\"+ end=+"+ contains=cSpecial,@Spell extend
|
||||
else
|
||||
syn region cString start=+\%(U\|u8\=\)"+ skip=+\\\\\|\\"+ end=+"+ contains=cSpecial,cFormat,@Spell extend
|
||||
endif
|
||||
syn match cCharacter "[Uu]'[^\\]'"
|
||||
syn match cCharacter "[Uu]'[^']*'" contains=cSpecial
|
||||
if exists("c_gnu")
|
||||
syn match cSpecialError "[Uu]'\\[^'\"?\\abefnrtv]'"
|
||||
syn match cSpecialCharacter "[Uu]'\\['\"?\\abefnrtv]'"
|
||||
else
|
||||
syn match cSpecialError "[Uu]'\\[^'\"?\\abfnrtv]'"
|
||||
syn match cSpecialCharacter "[Uu]'\\['\"?\\abfnrtv]'"
|
||||
endif
|
||||
syn match cSpecialCharacter display "[Uu]'\\\o\{1,3}'"
|
||||
syn match cSpecialCharacter display "[Uu]'\\x\x\+'"
|
||||
endif
|
||||
|
||||
"when wanted, highlight trailing white space
|
||||
if exists("c_space_errors")
|
||||
if !exists("c_no_trail_space_error")
|
||||
syn match cSpaceError display excludenl "\s\+$"
|
||||
endif
|
||||
if !exists("c_no_tab_space_error")
|
||||
syn match cSpaceError display " \+\t"me=e-1
|
||||
endif
|
||||
endif
|
||||
|
||||
" This should be before cErrInParen to avoid problems with #define ({ xxx })
|
||||
if exists("c_curly_error")
|
||||
syn match cCurlyError "}"
|
||||
syn region cBlock start="{" end="}" contains=ALLBUT,cBadBlock,cCurlyError,@cParenGroup,cErrInParen,cCppParen,cErrInBracket,cCppBracket,@cStringGroup,@Spell fold
|
||||
else
|
||||
syn region cBlock start="{" end="}" transparent fold
|
||||
endif
|
||||
|
||||
" Catch errors caused by wrong parenthesis and brackets.
|
||||
" Also accept <% for {, %> for }, <: for [ and :> for ] (C99)
|
||||
" But avoid matching <::.
|
||||
syn cluster cParenGroup contains=cParenError,cIncluded,cSpecial,cCommentSkip,cCommentString,cComment2String,@cCommentGroup,cCommentStartError,cUserLabel,cBitField,cOctalZero,@cCppOutInGroup,cFormat,cNumber,cFloat,cOctal,cOctalError,cNumbersCom
|
||||
if exists("c_no_curly_error")
|
||||
if s:ft ==# 'cpp' && !exists("cpp_no_cpp11")
|
||||
syn region cParen transparent start='(' end=')' contains=ALLBUT,@cParenGroup,cCppParen,@cStringGroup,@Spell
|
||||
" cCppParen: same as cParen but ends at end-of-line; used in cDefine
|
||||
syn region cCppParen transparent start='(' skip='\\$' excludenl end=')' end='$' contained contains=ALLBUT,@cParenGroup,cParen,cString,@Spell
|
||||
syn match cParenError display ")"
|
||||
syn match cErrInParen display contained "^^<%\|^%>"
|
||||
else
|
||||
syn region cParen transparent start='(' end=')' end='}'me=s-1 contains=ALLBUT,cBlock,@cParenGroup,cCppParen,@cStringGroup,@Spell
|
||||
" cCppParen: same as cParen but ends at end-of-line; used in cDefine
|
||||
syn region cCppParen transparent start='(' skip='\\$' excludenl end=')' end='$' contained contains=ALLBUT,@cParenGroup,cParen,cString,@Spell
|
||||
syn match cParenError display ")"
|
||||
syn match cErrInParen display contained "^[{}]\|^<%\|^%>"
|
||||
endif
|
||||
elseif exists("c_no_bracket_error")
|
||||
if s:ft ==# 'cpp' && !exists("cpp_no_cpp11")
|
||||
syn region cParen transparent start='(' end=')' contains=ALLBUT,@cParenGroup,cCppParen,@cStringGroup,@Spell
|
||||
" cCppParen: same as cParen but ends at end-of-line; used in cDefine
|
||||
syn region cCppParen transparent start='(' skip='\\$' excludenl end=')' end='$' contained contains=ALLBUT,@cParenGroup,cParen,cString,@Spell
|
||||
syn match cParenError display ")"
|
||||
syn match cErrInParen display contained "<%\|%>"
|
||||
else
|
||||
syn region cParen transparent start='(' end=')' end='}'me=s-1 contains=ALLBUT,cBlock,@cParenGroup,cCppParen,@cStringGroup,@Spell
|
||||
" cCppParen: same as cParen but ends at end-of-line; used in cDefine
|
||||
syn region cCppParen transparent start='(' skip='\\$' excludenl end=')' end='$' contained contains=ALLBUT,@cParenGroup,cParen,cString,@Spell
|
||||
syn match cParenError display ")"
|
||||
syn match cErrInParen display contained "[{}]\|<%\|%>"
|
||||
endif
|
||||
else
|
||||
if s:ft ==# 'cpp' && !exists("cpp_no_cpp11")
|
||||
syn region cParen transparent start='(' end=')' contains=ALLBUT,@cParenGroup,cCppParen,cErrInBracket,cCppBracket,@cStringGroup,@Spell
|
||||
" cCppParen: same as cParen but ends at end-of-line; used in cDefine
|
||||
syn region cCppParen transparent start='(' skip='\\$' excludenl end=')' end='$' contained contains=ALLBUT,@cParenGroup,cErrInBracket,cParen,cBracket,cString,@Spell
|
||||
syn match cParenError display "[\])]"
|
||||
syn match cErrInParen display contained "<%\|%>"
|
||||
syn region cBracket transparent start='\[\|<::\@!' end=']\|:>' contains=ALLBUT,@cParenGroup,cErrInParen,cCppParen,cCppBracket,@cStringGroup,@Spell
|
||||
else
|
||||
syn region cParen transparent start='(' end=')' end='}'me=s-1 contains=ALLBUT,cBlock,@cParenGroup,cCppParen,cErrInBracket,cCppBracket,@cStringGroup,@Spell
|
||||
" cCppParen: same as cParen but ends at end-of-line; used in cDefine
|
||||
syn region cCppParen transparent start='(' skip='\\$' excludenl end=')' end='$' contained contains=ALLBUT,@cParenGroup,cErrInBracket,cParen,cBracket,cString,@Spell
|
||||
syn match cParenError display "[\])]"
|
||||
syn match cErrInParen display contained "[\]{}]\|<%\|%>"
|
||||
syn region cBracket transparent start='\[\|<::\@!' end=']\|:>' end='}'me=s-1 contains=ALLBUT,cBlock,@cParenGroup,cErrInParen,cCppParen,cCppBracket,@cStringGroup,@Spell
|
||||
endif
|
||||
" cCppBracket: same as cParen but ends at end-of-line; used in cDefine
|
||||
syn region cCppBracket transparent start='\[\|<::\@!' skip='\\$' excludenl end=']\|:>' end='$' contained contains=ALLBUT,@cParenGroup,cErrInParen,cParen,cBracket,cString,@Spell
|
||||
syn match cErrInBracket display contained "[);{}]\|<%\|%>"
|
||||
endif
|
||||
|
||||
if s:ft ==# 'c' || exists("cpp_no_cpp11")
|
||||
syn region cBadBlock keepend start="{" end="}" contained containedin=cParen,cBracket,cBadBlock transparent fold
|
||||
endif
|
||||
|
||||
"integer number, or floating point number without a dot and with "f".
|
||||
syn case ignore
|
||||
syn match cNumbers display transparent "\<\d\|\.\d" contains=cNumber,cFloat,cOctalError,cOctal
|
||||
" Same, but without octal error (for comments)
|
||||
syn match cNumbersCom display contained transparent "\<\d\|\.\d" contains=cNumber,cFloat,cOctal
|
||||
syn match cNumber display contained "\d\+\(u\=l\{0,2}\|ll\=u\)\>"
|
||||
"hex number
|
||||
syn match cNumber display contained "0x\x\+\(u\=l\{0,2}\|ll\=u\)\>"
|
||||
" Flag the first zero of an octal number as something special
|
||||
syn match cOctal display contained "0\o\+\(u\=l\{0,2}\|ll\=u\)\>" contains=cOctalZero
|
||||
syn match cOctalZero display contained "\<0"
|
||||
syn match cFloat display contained "\d\+f"
|
||||
"floating point number, with dot, optional exponent
|
||||
syn match cFloat display contained "\d\+\.\d*\(e[-+]\=\d\+\)\=[fl]\="
|
||||
"floating point number, starting with a dot, optional exponent
|
||||
syn match cFloat display contained "\.\d\+\(e[-+]\=\d\+\)\=[fl]\=\>"
|
||||
"floating point number, without dot, with exponent
|
||||
syn match cFloat display contained "\d\+e[-+]\=\d\+[fl]\=\>"
|
||||
if !exists("c_no_c99")
|
||||
"hexadecimal floating point number, optional leading digits, with dot, with exponent
|
||||
syn match cFloat display contained "0x\x*\.\x\+p[-+]\=\d\+[fl]\=\>"
|
||||
"hexadecimal floating point number, with leading digits, optional dot, with exponent
|
||||
syn match cFloat display contained "0x\x\+\.\=p[-+]\=\d\+[fl]\=\>"
|
||||
endif
|
||||
|
||||
" flag an octal number with wrong digits
|
||||
syn match cOctalError display contained "0\o*[89]\d*"
|
||||
syn case match
|
||||
|
||||
if exists("c_comment_strings")
|
||||
" A comment can contain cString, cCharacter and cNumber.
|
||||
" But a "*/" inside a cString in a cComment DOES end the comment! So we
|
||||
" need to use a special type of cString: cCommentString, which also ends on
|
||||
" "*/", and sees a "*" at the start of the line as comment again.
|
||||
" Unfortunately this doesn't very well work for // type of comments :-(
|
||||
syn match cCommentSkip contained "^\s*\*\($\|\s\+\)"
|
||||
syn region cCommentString contained start=+L\=\\\@<!"+ skip=+\\\\\|\\"+ end=+"+ end=+\*/+me=s-1 contains=cSpecial,cCommentSkip
|
||||
syn region cComment2String contained start=+L\=\\\@<!"+ skip=+\\\\\|\\"+ end=+"+ end="$" contains=cSpecial
|
||||
syn region cCommentL start="//" skip="\\$" end="$" keepend contains=@cCommentGroup,cComment2String,cCharacter,cNumbersCom,cSpaceError,@Spell
|
||||
if exists("c_no_comment_fold")
|
||||
" Use "extend" here to have preprocessor lines not terminate halfway a
|
||||
" comment.
|
||||
syn region cComment matchgroup=cCommentStart start="/\*" end="\*/" contains=@cCommentGroup,cCommentStartError,cCommentString,cCharacter,cNumbersCom,cSpaceError,@Spell extend
|
||||
else
|
||||
syn region cComment matchgroup=cCommentStart start="/\*" end="\*/" contains=@cCommentGroup,cCommentStartError,cCommentString,cCharacter,cNumbersCom,cSpaceError,@Spell fold extend
|
||||
endif
|
||||
else
|
||||
syn region cCommentL start="//" skip="\\$" end="$" keepend contains=@cCommentGroup,cSpaceError,@Spell
|
||||
if exists("c_no_comment_fold")
|
||||
syn region cComment matchgroup=cCommentStart start="/\*" end="\*/" contains=@cCommentGroup,cCommentStartError,cSpaceError,@Spell extend
|
||||
else
|
||||
syn region cComment matchgroup=cCommentStart start="/\*" end="\*/" contains=@cCommentGroup,cCommentStartError,cSpaceError,@Spell fold extend
|
||||
endif
|
||||
endif
|
||||
" keep a // comment separately, it terminates a preproc. conditional
|
||||
syn match cCommentError display "\*/"
|
||||
syn match cCommentStartError display "/\*"me=e-1 contained
|
||||
|
||||
syn keyword cOperator sizeof
|
||||
if exists("c_gnu")
|
||||
syn keyword cStatement __asm__
|
||||
syn keyword cOperator typeof __real__ __imag__
|
||||
endif
|
||||
syn keyword cType int long short char void
|
||||
syn keyword cType signed unsigned float double
|
||||
if !exists("c_no_ansi") || exists("c_ansi_typedefs")
|
||||
syn keyword cType size_t ssize_t off_t wchar_t ptrdiff_t sig_atomic_t fpos_t
|
||||
syn keyword cType clock_t time_t va_list jmp_buf FILE DIR div_t ldiv_t
|
||||
syn keyword cType mbstate_t wctrans_t wint_t wctype_t
|
||||
endif
|
||||
if !exists("c_no_c99") " ISO C99
|
||||
syn keyword cType _Bool bool _Complex complex _Imaginary imaginary
|
||||
syn keyword cType int8_t int16_t int32_t int64_t
|
||||
syn keyword cType uint8_t uint16_t uint32_t uint64_t
|
||||
if !exists("c_no_bsd")
|
||||
" These are BSD specific.
|
||||
syn keyword cType u_int8_t u_int16_t u_int32_t u_int64_t
|
||||
endif
|
||||
syn keyword cType int_least8_t int_least16_t int_least32_t int_least64_t
|
||||
syn keyword cType uint_least8_t uint_least16_t uint_least32_t uint_least64_t
|
||||
syn keyword cType int_fast8_t int_fast16_t int_fast32_t int_fast64_t
|
||||
syn keyword cType uint_fast8_t uint_fast16_t uint_fast32_t uint_fast64_t
|
||||
syn keyword cType intptr_t uintptr_t
|
||||
syn keyword cType intmax_t uintmax_t
|
||||
endif
|
||||
if exists("c_gnu")
|
||||
syn keyword cType __label__ __complex__ __volatile__
|
||||
endif
|
||||
|
||||
syn keyword cStructure struct union enum typedef
|
||||
syn keyword cStorageClass static register auto volatile extern const
|
||||
if exists("c_gnu")
|
||||
syn keyword cStorageClass inline __attribute__
|
||||
endif
|
||||
if !exists("c_no_c99") && s:ft !=# 'cpp'
|
||||
syn keyword cStorageClass inline restrict
|
||||
endif
|
||||
if !exists("c_no_c11")
|
||||
syn keyword cStorageClass _Alignas alignas
|
||||
syn keyword cOperator _Alignof alignof
|
||||
syn keyword cStorageClass _Atomic
|
||||
syn keyword cOperator _Generic
|
||||
syn keyword cStorageClass _Noreturn noreturn
|
||||
syn keyword cOperator _Static_assert static_assert
|
||||
syn keyword cStorageClass _Thread_local thread_local
|
||||
syn keyword cType char16_t char32_t
|
||||
endif
|
||||
|
||||
if !exists("c_no_ansi") || exists("c_ansi_constants") || exists("c_gnu")
|
||||
if exists("c_gnu")
|
||||
syn keyword cConstant __GNUC__ __FUNCTION__ __PRETTY_FUNCTION__ __func__
|
||||
endif
|
||||
syn keyword cConstant __LINE__ __FILE__ __DATE__ __TIME__ __STDC__
|
||||
syn keyword cConstant __STDC_VERSION__
|
||||
syn keyword cConstant CHAR_BIT MB_LEN_MAX MB_CUR_MAX
|
||||
syn keyword cConstant UCHAR_MAX UINT_MAX ULONG_MAX USHRT_MAX
|
||||
syn keyword cConstant CHAR_MIN INT_MIN LONG_MIN SHRT_MIN
|
||||
syn keyword cConstant CHAR_MAX INT_MAX LONG_MAX SHRT_MAX
|
||||
syn keyword cConstant SCHAR_MIN SINT_MIN SLONG_MIN SSHRT_MIN
|
||||
syn keyword cConstant SCHAR_MAX SINT_MAX SLONG_MAX SSHRT_MAX
|
||||
if !exists("c_no_c99")
|
||||
syn keyword cConstant __func__ __VA_ARGS__
|
||||
syn keyword cConstant LLONG_MIN LLONG_MAX ULLONG_MAX
|
||||
syn keyword cConstant INT8_MIN INT16_MIN INT32_MIN INT64_MIN
|
||||
syn keyword cConstant INT8_MAX INT16_MAX INT32_MAX INT64_MAX
|
||||
syn keyword cConstant UINT8_MAX UINT16_MAX UINT32_MAX UINT64_MAX
|
||||
syn keyword cConstant INT_LEAST8_MIN INT_LEAST16_MIN INT_LEAST32_MIN INT_LEAST64_MIN
|
||||
syn keyword cConstant INT_LEAST8_MAX INT_LEAST16_MAX INT_LEAST32_MAX INT_LEAST64_MAX
|
||||
syn keyword cConstant UINT_LEAST8_MAX UINT_LEAST16_MAX UINT_LEAST32_MAX UINT_LEAST64_MAX
|
||||
syn keyword cConstant INT_FAST8_MIN INT_FAST16_MIN INT_FAST32_MIN INT_FAST64_MIN
|
||||
syn keyword cConstant INT_FAST8_MAX INT_FAST16_MAX INT_FAST32_MAX INT_FAST64_MAX
|
||||
syn keyword cConstant UINT_FAST8_MAX UINT_FAST16_MAX UINT_FAST32_MAX UINT_FAST64_MAX
|
||||
syn keyword cConstant INTPTR_MIN INTPTR_MAX UINTPTR_MAX
|
||||
syn keyword cConstant INTMAX_MIN INTMAX_MAX UINTMAX_MAX
|
||||
syn keyword cConstant PTRDIFF_MIN PTRDIFF_MAX SIG_ATOMIC_MIN SIG_ATOMIC_MAX
|
||||
syn keyword cConstant SIZE_MAX WCHAR_MIN WCHAR_MAX WINT_MIN WINT_MAX
|
||||
endif
|
||||
syn keyword cConstant FLT_RADIX FLT_ROUNDS
|
||||
syn keyword cConstant FLT_DIG FLT_MANT_DIG FLT_EPSILON
|
||||
syn keyword cConstant DBL_DIG DBL_MANT_DIG DBL_EPSILON
|
||||
syn keyword cConstant LDBL_DIG LDBL_MANT_DIG LDBL_EPSILON
|
||||
syn keyword cConstant FLT_MIN FLT_MAX FLT_MIN_EXP FLT_MAX_EXP
|
||||
syn keyword cConstant FLT_MIN_10_EXP FLT_MAX_10_EXP
|
||||
syn keyword cConstant DBL_MIN DBL_MAX DBL_MIN_EXP DBL_MAX_EXP
|
||||
syn keyword cConstant DBL_MIN_10_EXP DBL_MAX_10_EXP
|
||||
syn keyword cConstant LDBL_MIN LDBL_MAX LDBL_MIN_EXP LDBL_MAX_EXP
|
||||
syn keyword cConstant LDBL_MIN_10_EXP LDBL_MAX_10_EXP
|
||||
syn keyword cConstant HUGE_VAL CLOCKS_PER_SEC NULL
|
||||
syn keyword cConstant LC_ALL LC_COLLATE LC_CTYPE LC_MONETARY
|
||||
syn keyword cConstant LC_NUMERIC LC_TIME
|
||||
syn keyword cConstant SIG_DFL SIG_ERR SIG_IGN
|
||||
syn keyword cConstant SIGABRT SIGFPE SIGILL SIGHUP SIGINT SIGSEGV SIGTERM
|
||||
" Add POSIX signals as well...
|
||||
syn keyword cConstant SIGABRT SIGALRM SIGCHLD SIGCONT SIGFPE SIGHUP
|
||||
syn keyword cConstant SIGILL SIGINT SIGKILL SIGPIPE SIGQUIT SIGSEGV
|
||||
syn keyword cConstant SIGSTOP SIGTERM SIGTRAP SIGTSTP SIGTTIN SIGTTOU
|
||||
syn keyword cConstant SIGUSR1 SIGUSR2
|
||||
syn keyword cConstant _IOFBF _IOLBF _IONBF BUFSIZ EOF WEOF
|
||||
syn keyword cConstant FOPEN_MAX FILENAME_MAX L_tmpnam
|
||||
syn keyword cConstant SEEK_CUR SEEK_END SEEK_SET
|
||||
syn keyword cConstant TMP_MAX stderr stdin stdout
|
||||
syn keyword cConstant EXIT_FAILURE EXIT_SUCCESS RAND_MAX
|
||||
" POSIX 2001
|
||||
syn keyword cConstant SIGBUS SIGPOLL SIGPROF SIGSYS SIGURG
|
||||
syn keyword cConstant SIGVTALRM SIGXCPU SIGXFSZ
|
||||
" non-POSIX signals
|
||||
syn keyword cConstant SIGWINCH SIGINFO
|
||||
" Add POSIX errors as well
|
||||
syn keyword cConstant E2BIG EACCES EAGAIN EBADF EBADMSG EBUSY
|
||||
syn keyword cConstant ECANCELED ECHILD EDEADLK EDOM EEXIST EFAULT
|
||||
syn keyword cConstant EFBIG EILSEQ EINPROGRESS EINTR EINVAL EIO EISDIR
|
||||
syn keyword cConstant EMFILE EMLINK EMSGSIZE ENAMETOOLONG ENFILE ENODEV
|
||||
syn keyword cConstant ENOENT ENOEXEC ENOLCK ENOMEM ENOSPC ENOSYS
|
||||
syn keyword cConstant ENOTDIR ENOTEMPTY ENOTSUP ENOTTY ENXIO EPERM
|
||||
syn keyword cConstant EPIPE ERANGE EROFS ESPIPE ESRCH ETIMEDOUT EXDEV
|
||||
" math.h
|
||||
syn keyword cConstant M_E M_LOG2E M_LOG10E M_LN2 M_LN10 M_PI M_PI_2 M_PI_4
|
||||
syn keyword cConstant M_1_PI M_2_PI M_2_SQRTPI M_SQRT2 M_SQRT1_2
|
||||
endif
|
||||
if !exists("c_no_c99") " ISO C99
|
||||
syn keyword cConstant true false
|
||||
endif
|
||||
|
||||
" Accept %: for # (C99)
|
||||
syn region cPreCondit start="^\s*\zs\(%:\|#\)\s*\(if\|ifdef\|ifndef\|elif\)\>" skip="\\$" end="$" keepend contains=cComment,cCommentL,cCppString,cCharacter,cCppParen,cParenError,cNumbers,cCommentError,cSpaceError
|
||||
syn match cPreConditMatch display "^\s*\zs\(%:\|#\)\s*\(else\|endif\)\>"
|
||||
if !exists("c_no_if0")
|
||||
syn cluster cCppOutInGroup contains=cCppInIf,cCppInElse,cCppInElse2,cCppOutIf,cCppOutIf2,cCppOutElse,cCppInSkip,cCppOutSkip
|
||||
syn region cCppOutWrapper start="^\s*\zs\(%:\|#\)\s*if\s\+0\+\s*\($\|//\|/\*\|&\)" end=".\@=\|$" contains=cCppOutIf,cCppOutElse,@NoSpell fold
|
||||
syn region cCppOutIf contained start="0\+" matchgroup=cCppOutWrapper end="^\s*\(%:\|#\)\s*endif\>" contains=cCppOutIf2,cCppOutElse
|
||||
if !exists("c_no_if0_fold")
|
||||
syn region cCppOutIf2 contained matchgroup=cCppOutWrapper start="0\+" end="^\s*\(%:\|#\)\s*\(else\>\|elif\s\+\(0\+\s*\($\|//\|/\*\|&\)\)\@!\|endif\>\)"me=s-1 contains=cSpaceError,cCppOutSkip,@Spell fold
|
||||
else
|
||||
syn region cCppOutIf2 contained matchgroup=cCppOutWrapper start="0\+" end="^\s*\(%:\|#\)\s*\(else\>\|elif\s\+\(0\+\s*\($\|//\|/\*\|&\)\)\@!\|endif\>\)"me=s-1 contains=cSpaceError,cCppOutSkip,@Spell
|
||||
endif
|
||||
syn region cCppOutElse contained matchgroup=cCppOutWrapper start="^\s*\zs\(%:\|#\)\s*\(else\|elif\)" end="^\s*\zs\(%:\|#\)\s*endif\>"me=s-1 contains=TOP,cPreCondit
|
||||
syn region cCppInWrapper start="^\s*\zs\(%:\|#\)\s*if\s\+0*[1-9]\d*\s*\($\|//\|/\*\||\)" end=".\@=\|$" contains=cCppInIf,cCppInElse fold
|
||||
syn region cCppInIf contained matchgroup=cCppInWrapper start="\d\+" end="^\s*\zs\(%:\|#\)\s*endif\>" contains=TOP,cPreCondit
|
||||
if !exists("c_no_if0_fold")
|
||||
syn region cCppInElse contained start="^\s*\zs\(%:\|#\)\s*\(else\>\|elif\s\+\(0*[1-9]\d*\s*\($\|//\|/\*\||\)\)\@!\)" end=".\@=\|$" containedin=cCppInIf contains=cCppInElse2 fold
|
||||
else
|
||||
syn region cCppInElse contained start="^\s*\zs\(%:\|#\)\s*\(else\>\|elif\s\+\(0*[1-9]\d*\s*\($\|//\|/\*\||\)\)\@!\)" end=".\@=\|$" containedin=cCppInIf contains=cCppInElse2
|
||||
endif
|
||||
syn region cCppInElse2 contained matchgroup=cCppInWrapper start="^\s*\zs\(%:\|#\)\s*\(else\|elif\)\([^/]\|/[^/*]\)*" end="^\s*\zs\(%:\|#\)\s*endif\>"me=s-1 contains=cSpaceError,cCppOutSkip,@Spell
|
||||
syn region cCppOutSkip contained start="^\s*\zs\(%:\|#\)\s*\(if\>\|ifdef\>\|ifndef\>\)" skip="\\$" end="^\s*\zs\(%:\|#\)\s*endif\>" contains=cSpaceError,cCppOutSkip
|
||||
syn region cCppInSkip contained matchgroup=cCppInWrapper start="^\s*\zs\(%:\|#\)\s*\(if\s\+\(\d\+\s*\($\|//\|/\*\||\|&\)\)\@!\|ifdef\>\|ifndef\>\)" skip="\\$" end="^\s*\zs\(%:\|#\)\s*endif\>" containedin=cCppOutElse,cCppInIf,cCppInSkip contains=TOP,cPreProc
|
||||
endif
|
||||
syn region cIncluded display contained start=+"+ skip=+\\\\\|\\"+ end=+"+
|
||||
syn match cIncluded display contained "<[^>]*>"
|
||||
syn match cInclude display "^\s*\zs\(%:\|#\)\s*include\>\s*["<]" contains=cIncluded
|
||||
"syn match cLineSkip "\\$"
|
||||
syn cluster cPreProcGroup contains=cPreCondit,cIncluded,cInclude,cDefine,cErrInParen,cErrInBracket,cUserLabel,cSpecial,cOctalZero,cCppOutWrapper,cCppInWrapper,@cCppOutInGroup,cFormat,cNumber,cFloat,cOctal,cOctalError,cNumbersCom,cString,cCommentSkip,cCommentString,cComment2String,@cCommentGroup,cCommentStartError,cParen,cBracket,cMulti,cBadBlock
|
||||
syn region cDefine start="^\s*\zs\(%:\|#\)\s*\(define\|undef\)\>" skip="\\$" end="$" keepend contains=ALLBUT,@cPreProcGroup,@Spell
|
||||
syn region cPreProc start="^\s*\zs\(%:\|#\)\s*\(pragma\>\|line\>\|warning\>\|warn\>\|error\>\)" skip="\\$" end="$" keepend contains=ALLBUT,@cPreProcGroup,@Spell
|
||||
|
||||
" Highlight User Labels
|
||||
syn cluster cMultiGroup contains=cIncluded,cSpecial,cCommentSkip,cCommentString,cComment2String,@cCommentGroup,cCommentStartError,cUserCont,cUserLabel,cBitField,cOctalZero,cCppOutWrapper,cCppInWrapper,@cCppOutInGroup,cFormat,cNumber,cFloat,cOctal,cOctalError,cNumbersCom,cCppParen,cCppBracket,cCppString
|
||||
if s:ft ==# 'c' || exists("cpp_no_cpp11")
|
||||
syn region cMulti transparent start='?' skip='::' end=':' contains=ALLBUT,@cMultiGroup,@Spell,@cStringGroup
|
||||
endif
|
||||
" Avoid matching foo::bar() in C++ by requiring that the next char is not ':'
|
||||
syn cluster cLabelGroup contains=cUserLabel
|
||||
syn match cUserCont display "^\s*\zs\I\i*\s*:$" contains=@cLabelGroup
|
||||
syn match cUserCont display ";\s*\zs\I\i*\s*:$" contains=@cLabelGroup
|
||||
if s:ft ==# 'cpp'
|
||||
syn match cUserCont display "^\s*\zs\%(class\|struct\|enum\)\@!\I\i*\s*:[^:]"me=e-1 contains=@cLabelGroup
|
||||
syn match cUserCont display ";\s*\zs\%(class\|struct\|enum\)\@!\I\i*\s*:[^:]"me=e-1 contains=@cLabelGroup
|
||||
else
|
||||
syn match cUserCont display "^\s*\zs\I\i*\s*:[^:]"me=e-1 contains=@cLabelGroup
|
||||
syn match cUserCont display ";\s*\zs\I\i*\s*:[^:]"me=e-1 contains=@cLabelGroup
|
||||
endif
|
||||
|
||||
syn match cUserLabel display "\I\i*" contained
|
||||
|
||||
" Avoid recognizing most bitfields as labels
|
||||
syn match cBitField display "^\s*\zs\I\i*\s*:\s*[1-9]"me=e-1 contains=cType
|
||||
syn match cBitField display ";\s*\zs\I\i*\s*:\s*[1-9]"me=e-1 contains=cType
|
||||
|
||||
if exists("c_minlines")
|
||||
let b:c_minlines = c_minlines
|
||||
else
|
||||
if !exists("c_no_if0")
|
||||
let b:c_minlines = 50 " #if 0 constructs can be long
|
||||
else
|
||||
let b:c_minlines = 15 " mostly for () constructs
|
||||
endif
|
||||
endif
|
||||
if exists("c_curly_error")
|
||||
syn sync fromstart
|
||||
else
|
||||
exec "syn sync ccomment cComment minlines=" . b:c_minlines
|
||||
endif
|
||||
|
||||
" Define the default highlighting.
|
||||
" Only used when an item doesn't have highlighting yet
|
||||
hi def link cFormat cSpecial
|
||||
hi def link cCppString cString
|
||||
hi def link cCommentL cComment
|
||||
hi def link cCommentStart cComment
|
||||
hi def link cLabel Label
|
||||
hi def link cUserLabel Label
|
||||
hi def link cConditional Conditional
|
||||
hi def link cRepeat Repeat
|
||||
hi def link cCharacter Character
|
||||
hi def link cSpecialCharacter cSpecial
|
||||
hi def link cNumber Number
|
||||
hi def link cOctal Number
|
||||
hi def link cOctalZero PreProc " link this to Error if you want
|
||||
hi def link cFloat Float
|
||||
hi def link cOctalError cError
|
||||
hi def link cParenError cError
|
||||
hi def link cErrInParen cError
|
||||
hi def link cErrInBracket cError
|
||||
hi def link cCommentError cError
|
||||
hi def link cCommentStartError cError
|
||||
hi def link cSpaceError cError
|
||||
hi def link cSpecialError cError
|
||||
hi def link cCurlyError cError
|
||||
hi def link cOperator Operator
|
||||
hi def link cStructure Structure
|
||||
hi def link cStorageClass StorageClass
|
||||
hi def link cInclude Include
|
||||
hi def link cPreProc PreProc
|
||||
hi def link cDefine Macro
|
||||
hi def link cIncluded cString
|
||||
hi def link cError Error
|
||||
hi def link cStatement Statement
|
||||
hi def link cCppInWrapper cCppOutWrapper
|
||||
hi def link cCppOutWrapper cPreCondit
|
||||
hi def link cPreConditMatch cPreCondit
|
||||
hi def link cPreCondit PreCondit
|
||||
hi def link cType Type
|
||||
hi def link cConstant Constant
|
||||
hi def link cCommentString cString
|
||||
hi def link cComment2String cString
|
||||
hi def link cCommentSkip cComment
|
||||
hi def link cString String
|
||||
hi def link cComment Comment
|
||||
hi def link cSpecial SpecialChar
|
||||
hi def link cTodo Todo
|
||||
hi def link cBadContinuation Error
|
||||
hi def link cCppOutSkip cCppOutIf2
|
||||
hi def link cCppInElse2 cCppOutIf2
|
||||
hi def link cCppOutIf2 cCppOut
|
||||
hi def link cCppOut Comment
|
||||
|
||||
let b:current_syntax = "c"
|
||||
|
||||
unlet s:ft
|
||||
|
||||
let &cpo = s:cpo_save
|
||||
unlet s:cpo_save
|
||||
" vim: ts=8
|
|
@ -0,0 +1,76 @@
|
|||
" Vim syntax file
|
||||
" Language: C++
|
||||
" Current Maintainer: vim-jp (https://github.com/vim-jp/vim-cpp)
|
||||
" Previous Maintainer: Ken Shan <ccshan@post.harvard.edu>
|
||||
|
||||
" quit when a syntax file was already loaded
|
||||
if exists("b:current_syntax")
|
||||
finish
|
||||
endif
|
||||
|
||||
" Read the C syntax to start with
|
||||
runtime! syntax/c.vim
|
||||
unlet b:current_syntax
|
||||
|
||||
" C++ extensions
|
||||
syn keyword cppStatement new delete this friend using
|
||||
syn keyword cppAccess public protected private
|
||||
syn keyword cppModifier inline virtual explicit export
|
||||
syn keyword cppType bool wchar_t
|
||||
syn keyword cppExceptions throw try catch
|
||||
syn keyword cppOperator operator typeid
|
||||
syn keyword cppOperator and bitor or xor compl bitand and_eq or_eq xor_eq not not_eq
|
||||
syn match cppCast "\<\(const\|static\|dynamic\|reinterpret\)_cast\s*<"me=e-1
|
||||
syn match cppCast "\<\(const\|static\|dynamic\|reinterpret\)_cast\s*$"
|
||||
syn keyword cppStorageClass mutable
|
||||
syn keyword cppStructure class typename template namespace
|
||||
syn keyword cppBoolean true false
|
||||
syn keyword cppConstant __cplusplus
|
||||
|
||||
" C++ 11 extensions
|
||||
if !exists("cpp_no_cpp11")
|
||||
syn keyword cppModifier override final
|
||||
syn keyword cppType nullptr_t auto
|
||||
syn keyword cppExceptions noexcept
|
||||
syn keyword cppStorageClass constexpr decltype thread_local
|
||||
syn keyword cppConstant nullptr
|
||||
syn keyword cppConstant ATOMIC_FLAG_INIT ATOMIC_VAR_INIT
|
||||
syn keyword cppConstant ATOMIC_BOOL_LOCK_FREE ATOMIC_CHAR_LOCK_FREE
|
||||
syn keyword cppConstant ATOMIC_CHAR16_T_LOCK_FREE ATOMIC_CHAR32_T_LOCK_FREE
|
||||
syn keyword cppConstant ATOMIC_WCHAR_T_LOCK_FREE ATOMIC_SHORT_LOCK_FREE
|
||||
syn keyword cppConstant ATOMIC_INT_LOCK_FREE ATOMIC_LONG_LOCK_FREE
|
||||
syn keyword cppConstant ATOMIC_LLONG_LOCK_FREE ATOMIC_POINTER_LOCK_FREE
|
||||
syn region cppRawString matchgroup=cppRawStringDelimiter start=+\%(u8\|[uLU]\)\=R"\z([[:alnum:]_{}[\]#<>%:;.?*\+\-/\^&|~!=,"']\{,16}\)(+ end=+)\z1"+ contains=@Spell
|
||||
endif
|
||||
|
||||
" C++ 14 extensions
|
||||
if !exists("cpp_no_cpp14")
|
||||
syn case ignore
|
||||
syn match cppNumber display "\<0b[01]\('\=[01]\+\)*\(u\=l\{0,2}\|ll\=u\)\>"
|
||||
syn match cppNumber display "\<[1-9]\('\=\d\+\)*\(u\=l\{0,2}\|ll\=u\)\>" contains=cFloat
|
||||
syn match cppNumber display "\<0x\x\('\=\x\+\)*\(u\=l\{0,2}\|ll\=u\)\>"
|
||||
syn case match
|
||||
endif
|
||||
|
||||
" The minimum and maximum operators in GNU C++
|
||||
syn match cppMinMax "[<>]?"
|
||||
|
||||
" Default highlighting
|
||||
hi def link cppAccess cppStatement
|
||||
hi def link cppCast cppStatement
|
||||
hi def link cppExceptions Exception
|
||||
hi def link cppOperator Operator
|
||||
hi def link cppStatement Statement
|
||||
hi def link cppModifier Type
|
||||
hi def link cppType Type
|
||||
hi def link cppStorageClass StorageClass
|
||||
hi def link cppStructure Structure
|
||||
hi def link cppBoolean Boolean
|
||||
hi def link cppConstant Constant
|
||||
hi def link cppRawStringDelimiter Delimiter
|
||||
hi def link cppRawString String
|
||||
hi def link cppNumber Number
|
||||
|
||||
let b:current_syntax = "cpp"
|
||||
|
||||
" vim: ts=8
|
|
@ -0,0 +1,78 @@
|
|||
" Vim syntax file
|
||||
" Language: generic git output
|
||||
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
|
||||
" Last Change: 2010 May 21
|
||||
|
||||
if exists("b:current_syntax")
|
||||
finish
|
||||
endif
|
||||
|
||||
syn case match
|
||||
syn sync minlines=50
|
||||
|
||||
syn include @gitDiff syntax/diff.vim
|
||||
|
||||
syn region gitHead start=/\%^/ end=/^$/
|
||||
syn region gitHead start=/\%(^commit\%( \x\{40\}\)\{1,\}\%(\s*(.*)\)\=$\)\@=/ end=/^$/
|
||||
|
||||
" For git reflog and git show ...^{tree}, avoid sync issues
|
||||
syn match gitHead /^\d\{6\} \%(\w\{4} \)\=\x\{40\}\%( [0-3]\)\=\t.*/
|
||||
syn match gitHead /^\x\{40\} \x\{40}\t.*/
|
||||
|
||||
syn region gitDiff start=/^\%(diff --git \)\@=/ end=/^\%(diff --\|$\)\@=/ contains=@gitDiff fold
|
||||
syn region gitDiff start=/^\%(@@ -\)\@=/ end=/^\%(diff --\%(git\|cc\|combined\) \|$\)\@=/ contains=@gitDiff
|
||||
|
||||
syn region gitDiffMerge start=/^\%(diff --\%(cc\|combined\) \)\@=/ end=/^\%(diff --\|$\)\@=/ contains=@gitDiff
|
||||
syn region gitDiffMerge start=/^\%(@@@@* -\)\@=/ end=/^\%(diff --\|$\)\@=/ contains=@gitDiff
|
||||
syn match gitDiffAdded "^ \++.*" contained containedin=gitDiffMerge
|
||||
syn match gitDiffRemoved "^ \+-.*" contained containedin=gitDiffMerge
|
||||
|
||||
syn match gitKeyword /^\%(object\|type\|tag\|commit\|tree\|parent\|encoding\)\>/ contained containedin=gitHead nextgroup=gitHash,gitType skipwhite
|
||||
syn match gitKeyword /^\%(tag\>\|ref:\)/ contained containedin=gitHead nextgroup=gitReference skipwhite
|
||||
syn match gitKeyword /^Merge:/ contained containedin=gitHead nextgroup=gitHashAbbrev skipwhite
|
||||
syn match gitMode /^\d\{6\}/ contained containedin=gitHead nextgroup=gitType,gitHash skipwhite
|
||||
syn match gitIdentityKeyword /^\%(author\|committer\|tagger\)\>/ contained containedin=gitHead nextgroup=gitIdentity skipwhite
|
||||
syn match gitIdentityHeader /^\%(Author\|Commit\|Tagger\):/ contained containedin=gitHead nextgroup=gitIdentity skipwhite
|
||||
syn match gitDateHeader /^\%(AuthorDate\|CommitDate\|Date\):/ contained containedin=gitHead nextgroup=gitDate skipwhite
|
||||
|
||||
syn match gitReflogHeader /^Reflog:/ contained containedin=gitHead nextgroup=gitReflogMiddle skipwhite
|
||||
syn match gitReflogHeader /^Reflog message:/ contained containedin=gitHead skipwhite
|
||||
syn match gitReflogMiddle /\S\+@{\d\+} (/he=e-2 nextgroup=gitIdentity
|
||||
|
||||
syn match gitDate /\<\u\l\l \u\l\l \d\=\d \d\d:\d\d:\d\d \d\d\d\d [+-]\d\d\d\d/ contained
|
||||
syn match gitDate /-\=\d\+ [+-]\d\d\d\d\>/ contained
|
||||
syn match gitDate /\<\d\+ \l\+ ago\>/ contained
|
||||
syn match gitType /\<\%(tag\|commit\|tree\|blob\)\>/ contained nextgroup=gitHash skipwhite
|
||||
syn match gitStage /\<\d\t\@=/ contained
|
||||
syn match gitReference /\S\+\S\@!/ contained
|
||||
syn match gitHash /\<\x\{40\}\>/ contained nextgroup=gitIdentity,gitStage,gitHash skipwhite
|
||||
syn match gitHash /^\<\x\{40\}\>/ containedin=gitHead contained nextgroup=gitHash skipwhite
|
||||
syn match gitHashAbbrev /\<\x\{4,40\}\>/ contained nextgroup=gitHashAbbrev skipwhite
|
||||
syn match gitHashAbbrev /\<\x\{4,39\}\.\.\./he=e-3 contained nextgroup=gitHashAbbrev skipwhite
|
||||
|
||||
syn match gitIdentity /\S.\{-\} <[^>]*>/ contained nextgroup=gitDate skipwhite
|
||||
syn region gitEmail matchgroup=gitEmailDelimiter start=/</ end=/>/ keepend oneline contained containedin=gitIdentity
|
||||
|
||||
syn match gitNotesHeader /^Notes:\ze\n /
|
||||
|
||||
hi def link gitDateHeader gitIdentityHeader
|
||||
hi def link gitIdentityHeader gitIdentityKeyword
|
||||
hi def link gitIdentityKeyword Label
|
||||
hi def link gitNotesHeader gitKeyword
|
||||
hi def link gitReflogHeader gitKeyword
|
||||
hi def link gitKeyword Keyword
|
||||
hi def link gitIdentity String
|
||||
hi def link gitEmailDelimiter Delimiter
|
||||
hi def link gitEmail Special
|
||||
hi def link gitDate Number
|
||||
hi def link gitMode Number
|
||||
hi def link gitHashAbbrev gitHash
|
||||
hi def link gitHash Identifier
|
||||
hi def link gitReflogMiddle gitReference
|
||||
hi def link gitReference Function
|
||||
hi def link gitStage gitType
|
||||
hi def link gitType Type
|
||||
hi def link gitDiffAdded diffAdded
|
||||
hi def link gitDiffRemoved diffRemoved
|
||||
|
||||
let b:current_syntax = "git"
|
|
@ -0,0 +1,84 @@
|
|||
" Vim syntax file
|
||||
" Language: git commit file
|
||||
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
|
||||
" Filenames: *.git/COMMIT_EDITMSG
|
||||
" Last Change: 2013 May 30
|
||||
|
||||
if exists("b:current_syntax")
|
||||
finish
|
||||
endif
|
||||
|
||||
syn case match
|
||||
syn sync minlines=50
|
||||
|
||||
if has("spell")
|
||||
syn spell toplevel
|
||||
endif
|
||||
|
||||
syn include @gitcommitDiff syntax/diff.vim
|
||||
syn region gitcommitDiff start=/\%(^diff --\%(git\|cc\|combined\) \)\@=/ end=/^\%(diff --\|$\|#\)\@=/ fold contains=@gitcommitDiff
|
||||
|
||||
syn match gitcommitFirstLine "\%^[^#].*" nextgroup=gitcommitBlank skipnl
|
||||
syn match gitcommitSummary "^.\{0,50\}" contained containedin=gitcommitFirstLine nextgroup=gitcommitOverflow contains=@Spell
|
||||
syn match gitcommitOverflow ".*" contained contains=@Spell
|
||||
syn match gitcommitBlank "^[^#].*" contained contains=@Spell
|
||||
syn match gitcommitComment "^#.*"
|
||||
syn match gitcommitHead "^\%(# .*\n\)\+#$" contained transparent
|
||||
syn match gitcommitOnBranch "\%(^# \)\@<=On branch" contained containedin=gitcommitComment nextgroup=gitcommitBranch skipwhite
|
||||
syn match gitcommitOnBranch "\%(^# \)\@<=Your branch .\{-\} '" contained containedin=gitcommitComment nextgroup=gitcommitBranch skipwhite
|
||||
syn match gitcommitBranch "[^ ']\+" contained
|
||||
syn match gitcommitNoBranch "\%(^# \)\@<=Not currently on any branch." contained containedin=gitcommitComment
|
||||
syn match gitcommitHeader "\%(^# \)\@<=.*:$" contained containedin=gitcommitComment
|
||||
syn region gitcommitAuthor matchgroup=gitCommitHeader start=/\%(^# \)\@<=\%(Author\|Committer\):/ end=/$/ keepend oneline contained containedin=gitcommitComment transparent
|
||||
syn match gitcommitNoChanges "\%(^# \)\@<=No changes$" contained containedin=gitcommitComment
|
||||
|
||||
syn region gitcommitUntracked start=/^# Untracked files:/ end=/^#$\|^#\@!/ contains=gitcommitHeader,gitcommitHead,gitcommitUntrackedFile fold
|
||||
syn match gitcommitUntrackedFile "\t\@<=.*" contained
|
||||
|
||||
syn region gitcommitDiscarded start=/^# Change\%(s not staged for commit\|d but not updated\):/ end=/^#$\|^#\@!/ contains=gitcommitHeader,gitcommitHead,gitcommitDiscardedType fold
|
||||
syn region gitcommitSelected start=/^# Changes to be committed:/ end=/^#$\|^#\@!/ contains=gitcommitHeader,gitcommitHead,gitcommitSelectedType fold
|
||||
syn region gitcommitUnmerged start=/^# Unmerged paths:/ end=/^#$\|^#\@!/ contains=gitcommitHeader,gitcommitHead,gitcommitUnmergedType fold
|
||||
|
||||
|
||||
syn match gitcommitDiscardedType "\t\@<=[[:lower:]][^:]*[[:lower:]]: "he=e-2 contained containedin=gitcommitComment nextgroup=gitcommitDiscardedFile skipwhite
|
||||
syn match gitcommitSelectedType "\t\@<=[[:lower:]][^:]*[[:lower:]]: "he=e-2 contained containedin=gitcommitComment nextgroup=gitcommitSelectedFile skipwhite
|
||||
syn match gitcommitUnmergedType "\t\@<=[[:lower:]][^:]*[[:lower:]]: "he=e-2 contained containedin=gitcommitComment nextgroup=gitcommitUnmergedFile skipwhite
|
||||
syn match gitcommitDiscardedFile ".\{-\}\%($\| -> \)\@=" contained nextgroup=gitcommitDiscardedArrow
|
||||
syn match gitcommitSelectedFile ".\{-\}\%($\| -> \)\@=" contained nextgroup=gitcommitSelectedArrow
|
||||
syn match gitcommitUnmergedFile ".\{-\}\%($\| -> \)\@=" contained nextgroup=gitcommitSelectedArrow
|
||||
syn match gitcommitDiscardedArrow " -> " contained nextgroup=gitcommitDiscardedFile
|
||||
syn match gitcommitSelectedArrow " -> " contained nextgroup=gitcommitSelectedFile
|
||||
syn match gitcommitUnmergedArrow " -> " contained nextgroup=gitcommitSelectedFile
|
||||
|
||||
syn match gitcommitWarning "\%^[^#].*: needs merge$" nextgroup=gitcommitWarning skipnl
|
||||
syn match gitcommitWarning "^[^#].*: needs merge$" nextgroup=gitcommitWarning skipnl contained
|
||||
syn match gitcommitWarning "^\%(no changes added to commit\|nothing \%(added \)\=to commit\)\>.*\%$"
|
||||
|
||||
hi def link gitcommitSummary Keyword
|
||||
hi def link gitcommitComment Comment
|
||||
hi def link gitcommitUntracked gitcommitComment
|
||||
hi def link gitcommitDiscarded gitcommitComment
|
||||
hi def link gitcommitSelected gitcommitComment
|
||||
hi def link gitcommitUnmerged gitcommitComment
|
||||
hi def link gitcommitOnBranch Comment
|
||||
hi def link gitcommitBranch Special
|
||||
hi def link gitcommitNoBranch gitCommitBranch
|
||||
hi def link gitcommitDiscardedType gitcommitType
|
||||
hi def link gitcommitSelectedType gitcommitType
|
||||
hi def link gitcommitUnmergedType gitcommitType
|
||||
hi def link gitcommitType Type
|
||||
hi def link gitcommitNoChanges gitcommitHeader
|
||||
hi def link gitcommitHeader PreProc
|
||||
hi def link gitcommitUntrackedFile gitcommitFile
|
||||
hi def link gitcommitDiscardedFile gitcommitFile
|
||||
hi def link gitcommitSelectedFile gitcommitFile
|
||||
hi def link gitcommitUnmergedFile gitcommitFile
|
||||
hi def link gitcommitFile Constant
|
||||
hi def link gitcommitDiscardedArrow gitcommitArrow
|
||||
hi def link gitcommitSelectedArrow gitcommitArrow
|
||||
hi def link gitcommitUnmergedArrow gitcommitArrow
|
||||
hi def link gitcommitArrow gitcommitComment
|
||||
"hi def link gitcommitOverflow Error
|
||||
hi def link gitcommitBlank Error
|
||||
|
||||
let b:current_syntax = "gitcommit"
|
|
@ -0,0 +1,38 @@
|
|||
" Vim syntax file
|
||||
" Language: git config file
|
||||
" Maintainer: Tim Pope <vimNOSPAM@tpope.org>
|
||||
" Filenames: gitconfig, .gitconfig, *.git/config
|
||||
" Last Change: 2010 May 21
|
||||
|
||||
if exists("b:current_syntax")
|
||||
finish
|
||||
endif
|
||||
|
||||
setlocal iskeyword+=-
|
||||
setlocal iskeyword-=_
|
||||
syn case ignore
|
||||
syn sync minlines=10
|
||||
|
||||
syn match gitconfigComment "[#;].*"
|
||||
syn match gitconfigSection "\%(^\s*\)\@<=\[[a-z0-9.-]\+\]"
|
||||
syn match gitconfigSection '\%(^\s*\)\@<=\[[a-z0-9.-]\+ \+\"\%([^\\"]\|\\.\)*"\]'
|
||||
syn match gitconfigVariable "\%(^\s*\)\@<=\a\k*\%(\s*\%([=#;]\|$\)\)\@=" nextgroup=gitconfigAssignment skipwhite
|
||||
syn region gitconfigAssignment matchgroup=gitconfigNone start=+=\s*+ skip=+\\+ end=+\s*$+ contained contains=gitconfigBoolean,gitconfigNumber,gitConfigString,gitConfigEscape,gitConfigError,gitconfigComment keepend
|
||||
syn keyword gitconfigBoolean true false yes no contained
|
||||
syn match gitconfigNumber "\d\+" contained
|
||||
syn region gitconfigString matchgroup=gitconfigDelim start=+"+ skip=+\\+ end=+"+ matchgroup=gitconfigError end=+[^\\"]\%#\@!$+ contained contains=gitconfigEscape,gitconfigEscapeError
|
||||
syn match gitconfigError +\\.+ contained
|
||||
syn match gitconfigEscape +\\[\\"ntb]+ contained
|
||||
syn match gitconfigEscape +\\$+ contained
|
||||
|
||||
hi def link gitconfigComment Comment
|
||||
hi def link gitconfigSection Keyword
|
||||
hi def link gitconfigVariable Identifier
|
||||
hi def link gitconfigBoolean Boolean
|
||||
hi def link gitconfigNumber Number
|
||||
hi def link gitconfigString String
|
||||
hi def link gitconfigDelim Delimiter
|
||||
hi def link gitconfigEscape Delimiter
|
||||
hi def link gitconfigError Error
|
||||
|
||||
let b:current_syntax = "gitconfig"
|
|
@ -0,0 +1,483 @@
|
|||
" For version 5.x: Clear all syntax items
|
||||
" For versions greater than 6.x: Quit when a syntax file was already loaded
|
||||
if v:version < 600
|
||||
syntax clear
|
||||
elseif exists('b:current_syntax')
|
||||
finish
|
||||
endif
|
||||
|
||||
"
|
||||
" Commands
|
||||
"
|
||||
command! -buffer Python2Syntax let b:python_version_2 = 1 | let &syntax=&syntax
|
||||
command! -buffer Python3Syntax let b:python_version_2 = 0 | let &syntax=&syntax
|
||||
|
||||
" Enable option if it's not defined
|
||||
function! s:EnableByDefault(name)
|
||||
if !exists(a:name)
|
||||
let {a:name} = 1
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" Check if option is enabled
|
||||
function! s:Enabled(name)
|
||||
return exists(a:name) && {a:name}
|
||||
endfunction
|
||||
|
||||
" Is it Python 2 syntax?
|
||||
function! s:Python2Syntax()
|
||||
if exists('b:python_version_2')
|
||||
return b:python_version_2
|
||||
endif
|
||||
return s:Enabled('g:python_version_2')
|
||||
endfunction
|
||||
|
||||
"
|
||||
" Default options
|
||||
"
|
||||
|
||||
call s:EnableByDefault('g:python_slow_sync')
|
||||
call s:EnableByDefault('g:python_highlight_builtin_funcs_kwarg')
|
||||
|
||||
if s:Enabled('g:python_highlight_all')
|
||||
call s:EnableByDefault('g:python_highlight_builtins')
|
||||
if s:Enabled('g:python_highlight_builtins')
|
||||
call s:EnableByDefault('g:python_highlight_builtin_objs')
|
||||
call s:EnableByDefault('g:python_highlight_builtin_funcs')
|
||||
endif
|
||||
call s:EnableByDefault('g:python_highlight_exceptions')
|
||||
call s:EnableByDefault('g:python_highlight_string_formatting')
|
||||
call s:EnableByDefault('g:python_highlight_string_format')
|
||||
call s:EnableByDefault('g:python_highlight_string_templates')
|
||||
call s:EnableByDefault('g:python_highlight_indent_errors')
|
||||
call s:EnableByDefault('g:python_highlight_space_errors')
|
||||
call s:EnableByDefault('g:python_highlight_doctests')
|
||||
call s:EnableByDefault('g:python_print_as_function')
|
||||
call s:EnableByDefault('g:python_highlight_class_vars')
|
||||
call s:EnableByDefault('g:python_highlight_operators')
|
||||
endif
|
||||
|
||||
"
|
||||
" Keywords
|
||||
"
|
||||
|
||||
syn keyword pythonStatement break continue del return pass yield global assert lambda with
|
||||
syn keyword pythonStatement raise nextgroup=pythonExClass skipwhite
|
||||
syn keyword pythonStatement def class nextgroup=pythonFunction skipwhite
|
||||
if s:Enabled('g:python_highlight_class_vars')
|
||||
syn keyword pythonClassVar self cls
|
||||
endif
|
||||
syn keyword pythonRepeat for while
|
||||
syn keyword pythonConditional if elif else
|
||||
syn keyword pythonException try except finally
|
||||
" The standard pyrex.vim unconditionally removes the pythonInclude group, so
|
||||
" we provide a dummy group here to avoid crashing pyrex.vim.
|
||||
syn keyword pythonInclude import
|
||||
syn keyword pythonImport import
|
||||
syn match pythonRaiseFromStatement '\<from\>'
|
||||
syn match pythonImport '^\s*\zsfrom\>'
|
||||
|
||||
|
||||
if s:Python2Syntax()
|
||||
if !s:Enabled('g:python_print_as_function')
|
||||
syn keyword pythonStatement print
|
||||
endif
|
||||
syn keyword pythonStatement exec
|
||||
syn keyword pythonImport as
|
||||
syn match pythonFunction '[a-zA-Z_][a-zA-Z0-9_]*' display contained
|
||||
else
|
||||
syn keyword pythonStatement as nonlocal
|
||||
syn match pythonStatement '\v\.@<!<await>'
|
||||
syn match pythonFunction '\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*' display contained
|
||||
syn match pythonStatement '\<async\s\+def\>' nextgroup=pythonFunction skipwhite
|
||||
syn match pythonStatement '\<async\s\+with\>'
|
||||
syn match pythonStatement '\<async\s\+for\>'
|
||||
syn cluster pythonExpression contains=pythonStatement,pythonRepeat,pythonConditional,pythonOperator,pythonNumber,pythonHexNumber,pythonOctNumber,pythonBinNumber,pythonFloat,pythonString,pythonBytes,pythonBoolean,pythonBuiltinObj,pythonBuiltinFunc
|
||||
endif
|
||||
|
||||
|
||||
"
|
||||
" Operators
|
||||
"
|
||||
syn keyword pythonOperator and in is not or
|
||||
if s:Enabled('g:python_highlight_operators')
|
||||
syn match pythonOperator '\V=\|-\|+\|*\|@\|/\|%\|&\||\|^\|~\|<\|>\|!='
|
||||
endif
|
||||
syn match pythonError '[$?]\|\([-+@%&|^~]\)\1\{1,}\|\([=*/<>]\)\2\{2,}\|\([+@/%&|^~<>]\)\3\@![-+*@/%&|^~<>]\|\*\*[*@/%&|^<>]\|=[*@/%&|^<>]\|-[+*@/%&|^~<]\|[<!>]\+=\{2,}\|!\{2,}=\+' display
|
||||
|
||||
"
|
||||
" Decorators (new in Python 2.4)
|
||||
"
|
||||
|
||||
syn match pythonDecorator '^\s*\zs@' display nextgroup=pythonDottedName skipwhite
|
||||
if s:Python2Syntax()
|
||||
syn match pythonDottedName '[a-zA-Z_][a-zA-Z0-9_]*\%(\.[a-zA-Z_][a-zA-Z0-9_]*\)*' display contained
|
||||
else
|
||||
syn match pythonDottedName '\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*\%(\.\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*\)*' display contained
|
||||
endif
|
||||
syn match pythonDot '\.' display containedin=pythonDottedName
|
||||
|
||||
"
|
||||
" Comments
|
||||
"
|
||||
|
||||
syn match pythonComment '#.*$' display contains=pythonTodo,@Spell
|
||||
if !s:Enabled('g:python_highlight_file_headers_as_comments')
|
||||
syn match pythonRun '\%^#!.*$'
|
||||
syn match pythonCoding '\%^.*\%(\n.*\)\?#.*coding[:=]\s*[0-9A-Za-z-_.]\+.*$'
|
||||
endif
|
||||
syn keyword pythonTodo TODO FIXME XXX contained
|
||||
|
||||
"
|
||||
" Errors
|
||||
"
|
||||
|
||||
syn match pythonError '\<\d\+[^0-9[:space:]]\+\>' display
|
||||
|
||||
" Mixing spaces and tabs also may be used for pretty formatting multiline
|
||||
" statements
|
||||
if s:Enabled('g:python_highlight_indent_errors')
|
||||
syn match pythonIndentError '^\s*\%( \t\|\t \)\s*\S'me=e-1 display
|
||||
endif
|
||||
|
||||
" Trailing space errors
|
||||
if s:Enabled('g:python_highlight_space_errors')
|
||||
syn match pythonSpaceError '\s\+$' display
|
||||
endif
|
||||
|
||||
"
|
||||
" Strings
|
||||
"
|
||||
|
||||
if s:Python2Syntax()
|
||||
" Python 2 strings
|
||||
syn region pythonString start=+[bB]\='+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end=+$+ keepend contains=pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,@Spell
|
||||
syn region pythonString start=+[bB]\="+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ keepend contains=pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,@Spell
|
||||
syn region pythonString start=+[bB]\="""+ skip=+\\"+ end=+"""+ keepend contains=pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,pythonDocTest2,pythonSpaceError,@Spell
|
||||
syn region pythonString start=+[bB]\='''+ skip=+\\'+ end=+'''+ keepend contains=pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,pythonDocTest,pythonSpaceError,@Spell
|
||||
else
|
||||
" Python 3 byte strings
|
||||
syn region pythonBytes start=+[bB]'+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end=+$+ keepend contains=pythonBytesError,pythonBytesContent,@Spell
|
||||
syn region pythonBytes start=+[bB]"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ keepend contains=pythonBytesError,pythonBytesContent,@Spell
|
||||
syn region pythonBytes start=+[bB]'''+ skip=+\\'+ end=+'''+ keepend contains=pythonBytesError,pythonBytesContent,pythonDocTest,pythonSpaceError,@Spell
|
||||
syn region pythonBytes start=+[bB]"""+ skip=+\\"+ end=+"""+ keepend contains=pythonBytesError,pythonBytesContent,pythonDocTest2,pythonSpaceError,@Spell
|
||||
|
||||
syn match pythonBytesError '.\+' display contained
|
||||
syn match pythonBytesContent '[\u0000-\u00ff]\+' display contained contains=pythonBytesEscape,pythonBytesEscapeError
|
||||
endif
|
||||
|
||||
syn match pythonBytesEscape +\\[abfnrtv'"\\]+ display contained
|
||||
syn match pythonBytesEscape '\\\o\o\=\o\=' display contained
|
||||
syn match pythonBytesEscapeError '\\\o\{,2}[89]' display contained
|
||||
syn match pythonBytesEscape '\\x\x\{2}' display contained
|
||||
syn match pythonBytesEscapeError '\\x\x\=\X' display contained
|
||||
syn match pythonBytesEscape '\\$'
|
||||
|
||||
syn match pythonUniEscape '\\u\x\{4}' display contained
|
||||
syn match pythonUniEscapeError '\\u\x\{,3}\X' display contained
|
||||
syn match pythonUniEscape '\\U\x\{8}' display contained
|
||||
syn match pythonUniEscapeError '\\U\x\{,7}\X' display contained
|
||||
syn match pythonUniEscape '\\N{[A-Z ]\+}' display contained
|
||||
syn match pythonUniEscapeError '\\N{[^A-Z ]\+}' display contained
|
||||
|
||||
if s:Python2Syntax()
|
||||
" Python 2 Unicode strings
|
||||
syn region pythonUniString start=+[uU]'+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end=+$+ keepend contains=pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,@Spell
|
||||
syn region pythonUniString start=+[uU]"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ keepend contains=pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,@Spell
|
||||
syn region pythonUniString start=+[uU]'''+ skip=+\\'+ end=+'''+ keepend contains=pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,pythonDocTest,pythonSpaceError,@Spell
|
||||
syn region pythonUniString start=+[uU]"""+ skip=+\\"+ end=+"""+ keepend contains=pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,pythonDocTest2,pythonSpaceError,@Spell
|
||||
else
|
||||
" Python 3 strings
|
||||
syn region pythonString start=+'+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end=+$+ keepend contains=pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,@Spell
|
||||
syn region pythonString start=+"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ keepend contains=pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,@Spell
|
||||
syn region pythonString start=+'''+ skip=+\\'+ end=+'''+ keepend contains=pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,pythonDocTest,pythonSpaceError,@Spell
|
||||
syn region pythonString start=+"""+ skip=+\\"+ end=+"""+ keepend contains=pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,pythonDocTest2,pythonSpaceError,@Spell
|
||||
|
||||
syn region pythonFString start=+[fF]'+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end=+$+ keepend contains=pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,@Spell
|
||||
syn region pythonFString start=+[fF]"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ keepend contains=pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,@Spell
|
||||
syn region pythonFString start=+[fF]'''+ skip=+\\'+ end=+'''+ keepend contains=pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,pythonDocTest,pythonSpaceError,@Spell
|
||||
syn region pythonFString start=+[fF]"""+ skip=+\\"+ end=+"""+ keepend contains=pythonBytesEscape,pythonBytesEscapeError,pythonUniEscape,pythonUniEscapeError,pythonDocTest2,pythonSpaceError,@Spell
|
||||
endif
|
||||
|
||||
if s:Python2Syntax()
|
||||
" Python 2 Unicode raw strings
|
||||
syn region pythonUniRawString start=+[uU][rR]'+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end=+$+ keepend contains=pythonRawEscape,pythonUniRawEscape,pythonUniRawEscapeError,@Spell
|
||||
syn region pythonUniRawString start=+[uU][rR]"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ keepend contains=pythonRawEscape,pythonUniRawEscape,pythonUniRawEscapeError,@Spell
|
||||
syn region pythonUniRawString start=+[uU][rR]'''+ skip=+\\'+ end=+'''+ keepend contains=pythonUniRawEscape,pythonUniRawEscapeError,pythonDocTest,pythonSpaceError,@Spell
|
||||
syn region pythonUniRawString start=+[uU][rR]"""+ skip=+\\"+ end=+"""+ keepend contains=pythonUniRawEscape,pythonUniRawEscapeError,pythonDocTest2,pythonSpaceError,@Spell
|
||||
|
||||
syn match pythonUniRawEscape '\%([^\\]\%(\\\\\)*\)\@<=\\u\x\{4}' display contained
|
||||
syn match pythonUniRawEscapeError '\%([^\\]\%(\\\\\)*\)\@<=\\u\x\{,3}\X' display contained
|
||||
endif
|
||||
|
||||
" Python 2/3 raw strings
|
||||
if s:Python2Syntax()
|
||||
syn region pythonRawString start=+[bB]\=[rR]'+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end=+$+ keepend contains=pythonRawEscape,@Spell
|
||||
syn region pythonRawString start=+[bB]\=[rR]"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ keepend contains=pythonRawEscape,@Spell
|
||||
syn region pythonRawString start=+[bB]\=[rR]'''+ skip=+\\'+ end=+'''+ keepend contains=pythonDocTest,pythonSpaceError,@Spell
|
||||
syn region pythonRawString start=+[bB]\=[rR]"""+ skip=+\\"+ end=+"""+ keepend contains=pythonDocTest2,pythonSpaceError,@Spell
|
||||
else
|
||||
syn region pythonRawString start=+[rR]'+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end=+$+ keepend contains=pythonRawEscape,@Spell
|
||||
syn region pythonRawString start=+[rR]"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ keepend contains=pythonRawEscape,@Spell
|
||||
syn region pythonRawString start=+[rR]'''+ skip=+\\'+ end=+'''+ keepend contains=pythonDocTest,pythonSpaceError,@Spell
|
||||
syn region pythonRawString start=+[rR]"""+ skip=+\\"+ end=+"""+ keepend contains=pythonDocTest2,pythonSpaceError,@Spell
|
||||
|
||||
syn region pythonRawFString start=+\%([fF][rR]\|[rR][fF]\)'+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end=+$+ keepend contains=pythonRawEscape,@Spell
|
||||
syn region pythonRawFString start=+\%([fF][rR]\|[rR][fF]\)"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ keepend contains=pythonRawEscape,@Spell
|
||||
syn region pythonRawFString start=+\%([fF][rR]\|[rR][fF]\)'''+ skip=+\\'+ end=+'''+ keepend contains=pythonDocTest,pythonSpaceError,@Spell
|
||||
syn region pythonRawFString start=+\%([fF][rR]\|[rR][fF]\)"""+ skip=+\\"+ end=+"""+ keepend contains=pythonDocTest,pythonSpaceError,@Spell
|
||||
|
||||
syn region pythonRawBytes start=+\%([bB][rR]\|[rR][bB]\)'+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end=+$+ keepend contains=pythonRawEscape,@Spell
|
||||
syn region pythonRawBytes start=+\%([bB][rR]\|[rR][bB]\)"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ keepend contains=pythonRawEscape,@Spell
|
||||
syn region pythonRawBytes start=+\%([bB][rR]\|[rR][bB]\)'''+ skip=+\\'+ end=+'''+ keepend contains=pythonDocTest,pythonSpaceError,@Spell
|
||||
syn region pythonRawBytes start=+\%([bB][rR]\|[rR][bB]\)"""+ skip=+\\"+ end=+"""+ keepend contains=pythonDocTest2,pythonSpaceError,@Spell
|
||||
endif
|
||||
|
||||
syn match pythonRawEscape +\\['"]+ display contained
|
||||
|
||||
if s:Enabled('g:python_highlight_string_formatting')
|
||||
" % operator string formatting
|
||||
if s:Python2Syntax()
|
||||
syn match pythonStrFormatting '%\%(([^)]\+)\)\=[-#0 +]*\d*\%(\.\d\+\)\=[hlL]\=[diouxXeEfFgGcrs%]' contained containedin=pythonString,pythonUniString,pythonUniRawString,pythonRawString,pythonBytesContent
|
||||
syn match pythonStrFormatting '%[-#0 +]*\%(\*\|\d\+\)\=\%(\.\%(\*\|\d\+\)\)\=[hlL]\=[diouxXeEfFgGcrs%]' contained containedin=pythonString,pythonUniString,pythonUniRawString,pythonRawString,pythonBytesContent
|
||||
else
|
||||
syn match pythonStrFormatting '%\%(([^)]\+)\)\=[-#0 +]*\d*\%(\.\d\+\)\=[hlL]\=[diouxXeEfFgGcrs%]' contained containedin=pythonString,pythonRawString,pythonBytesContent
|
||||
syn match pythonStrFormatting '%[-#0 +]*\%(\*\|\d\+\)\=\%(\.\%(\*\|\d\+\)\)\=[hlL]\=[diouxXeEfFgGcrs%]' contained containedin=pythonString,pythonRawString,pythonBytesContent
|
||||
endif
|
||||
endif
|
||||
|
||||
if s:Enabled('g:python_highlight_string_format')
|
||||
" str.format syntax
|
||||
if s:Python2Syntax()
|
||||
syn match pythonStrFormat '{{\|}}' contained containedin=pythonString,pythonUniString,pythonUniRawString,pythonRawString
|
||||
syn match pythonStrFormat '{\%(\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*\|\d\+\)\=\%(\.\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*\|\[\%(\d\+\|[^!:\}]\+\)\]\)*\%(![rsa]\)\=\%(:\%({\%(\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*\|\d\+\)}\|\%([^}]\=[<>=^]\)\=[ +-]\=#\=0\=\d*,\=\%(\.\d\+\)\=[bcdeEfFgGnosxX%]\=\)\=\)\=}' contained containedin=pythonString,pythonUniString,pythonUniRawString,pythonRawString
|
||||
else
|
||||
syn match pythonStrFormat "{\%(\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*\|\d\+\)\=\%(\.\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*\|\[\%(\d\+\|[^!:\}]\+\)\]\)*\%(![rsa]\)\=\%(:\%({\%(\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*\|\d\+\)}\|\%([^}]\=[<>=^]\)\=[ +-]\=#\=0\=\d*,\=\%(\.\d\+\)\=[bcdeEfFgGnosxX%]\=\)\=\)\=}" contained containedin=pythonString,pythonRawString
|
||||
syn region pythonStrInterpRegion start="{"he=e+1,rs=e+1 end="\%(![rsa]\)\=\%(:\%({\%(\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*\|\d\+\)}\|\%([^}]\=[<>=^]\)\=[ +-]\=#\=0\=\d*,\=\%(\.\d\+\)\=[bcdeEfFgGnosxX%]\=\)\=\)\=}"hs=s-1,re=s-1 extend contained containedin=pythonFString,pythonRawFString contains=pythonStrInterpRegion,@pythonExpression
|
||||
syn match pythonStrFormat "{{\|}}" contained containedin=pythonString,pythonRawString,pythonFString,pythonRawFString
|
||||
endif
|
||||
endif
|
||||
|
||||
if s:Enabled('g:python_highlight_string_templates')
|
||||
" string.Template format
|
||||
if s:Python2Syntax()
|
||||
syn match pythonStrTemplate '\$\$' contained containedin=pythonString,pythonUniString,pythonUniRawString,pythonRawString
|
||||
syn match pythonStrTemplate '\${[a-zA-Z_][a-zA-Z0-9_]*}' contained containedin=pythonString,pythonUniString,pythonUniRawString,pythonRawString
|
||||
syn match pythonStrTemplate '\$[a-zA-Z_][a-zA-Z0-9_]*' contained containedin=pythonString,pythonUniString,pythonUniRawString,pythonRawString
|
||||
else
|
||||
syn match pythonStrTemplate '\$\$' contained containedin=pythonString,pythonRawString
|
||||
syn match pythonStrTemplate '\${[a-zA-Z_][a-zA-Z0-9_]*}' contained containedin=pythonString,pythonRawString
|
||||
syn match pythonStrTemplate '\$[a-zA-Z_][a-zA-Z0-9_]*' contained containedin=pythonString,pythonRawString
|
||||
endif
|
||||
endif
|
||||
|
||||
if s:Enabled('g:python_highlight_doctests')
|
||||
" DocTests
|
||||
syn region pythonDocTest start='^\s*>>>' skip=+\\'+ end=+'''+he=s-1 end='^\s*$' contained
|
||||
syn region pythonDocTest2 start='^\s*>>>' skip=+\\"+ end=+"""+he=s-1 end='^\s*$' contained
|
||||
endif
|
||||
|
||||
"
|
||||
" Numbers (ints, longs, floats, complex)
|
||||
"
|
||||
|
||||
if s:Python2Syntax()
|
||||
syn match pythonHexError '\<0[xX]\x*[g-zG-Z]\+\x*[lL]\=\>' display
|
||||
syn match pythonOctError '\<0[oO]\=\o*\D\+\d*[lL]\=\>' display
|
||||
syn match pythonBinError '\<0[bB][01]*\D\+\d*[lL]\=\>' display
|
||||
|
||||
syn match pythonHexNumber '\<0[xX]\x\+[lL]\=\>' display
|
||||
syn match pythonOctNumber '\<0[oO]\o\+[lL]\=\>' display
|
||||
syn match pythonBinNumber '\<0[bB][01]\+[lL]\=\>' display
|
||||
|
||||
syn match pythonNumberError '\<\d\+\D[lL]\=\>' display
|
||||
syn match pythonNumber '\<\d[lL]\=\>' display
|
||||
syn match pythonNumber '\<[0-9]\d\+[lL]\=\>' display
|
||||
syn match pythonNumber '\<\d\+[lLjJ]\>' display
|
||||
|
||||
syn match pythonOctError '\<0[oO]\=\o*[8-9]\d*[lL]\=\>' display
|
||||
syn match pythonBinError '\<0[bB][01]*[2-9]\d*[lL]\=\>' display
|
||||
|
||||
syn match pythonFloat '\.\d\+\%([eE][+-]\=\d\+\)\=[jJ]\=\>' display
|
||||
syn match pythonFloat '\<\d\+[eE][+-]\=\d\+[jJ]\=\>' display
|
||||
syn match pythonFloat '\<\d\+\.\d*\%([eE][+-]\=\d\+\)\=[jJ]\=' display
|
||||
else
|
||||
syn match pythonOctError '\<0[oO]\=\o*\D\+\d*\>' display
|
||||
" pythonHexError comes after pythonOctError so that 0xffffl is pythonHexError
|
||||
syn match pythonHexError '\<0[xX]\x*[g-zG-Z]\x*\>' display
|
||||
syn match pythonBinError '\<0[bB][01]*\D\+\d*\>' display
|
||||
|
||||
syn match pythonHexNumber '\<0[xX][_0-9a-fA-F]*\x\>' display
|
||||
syn match pythonOctNumber '\<0[oO][_0-7]*\o\>' display
|
||||
syn match pythonBinNumber '\<0[bB][_01]*[01]\>' display
|
||||
|
||||
syn match pythonNumberError '\<\d[_0-9]*\D\>' display
|
||||
syn match pythonNumberError '\<0[_0-9]\+\>' display
|
||||
syn match pythonNumberError '\<0_x\S*\>' display
|
||||
syn match pythonNumberError '\<0[bBxXoO][_0-9a-fA-F]*_\>' display
|
||||
syn match pythonNumberError '\<\d[_0-9]*_\>' display
|
||||
syn match pythonNumber '\<\d\>' display
|
||||
syn match pythonNumber '\<[1-9][_0-9]*\d\>' display
|
||||
syn match pythonNumber '\<\d[jJ]\>' display
|
||||
syn match pythonNumber '\<[1-9][_0-9]*\d[jJ]\>' display
|
||||
|
||||
syn match pythonOctError '\<0[oO]\=\o*[8-9]\d*\>' display
|
||||
syn match pythonBinError '\<0[bB][01]*[2-9]\d*\>' display
|
||||
|
||||
syn match pythonFloat '\.\d\%([_0-9]*\d\)\=\%([eE][+-]\=\d\%([_0-9]*\d\)\=\)\=[jJ]\=\>' display
|
||||
syn match pythonFloat '\<\d\%([_0-9]*\d\)\=[eE][+-]\=\d\%([_0-9]*\d\)\=[jJ]\=\>' display
|
||||
syn match pythonFloat '\<\d\%([_0-9]*\d\)\=\.\d\%([_0-9]*\d\)\=\%([eE][+-]\=\d\%([_0-9]*\d\)\=\)\=[jJ]\=' display
|
||||
endif
|
||||
|
||||
"
|
||||
" Builtin objects and types
|
||||
"
|
||||
|
||||
if s:Enabled('g:python_highlight_builtin_objs')
|
||||
syn keyword pythonNone None
|
||||
syn keyword pythonBoolean True False
|
||||
syn keyword pythonBuiltinObj Ellipsis NotImplemented
|
||||
syn match pythonBuiltinObj '\v\.@<!<%(object|bool|int|float|tuple|str|list|dict|set|frozenset|bytearray|bytes)>'
|
||||
syn keyword pythonBuiltinObj __debug__ __doc__ __file__ __name__ __package__
|
||||
syn keyword pythonBuiltinObj __loader__ __spec__ __path__ __cached__
|
||||
endif
|
||||
|
||||
"
|
||||
" Builtin functions
|
||||
"
|
||||
|
||||
if s:Enabled('g:python_highlight_builtin_funcs')
|
||||
let s:funcs_re = '__import__|abs|all|any|bin|callable|chr|classmethod|compile|complex|delattr|dir|divmod|enumerate|eval|filter|format|getattr|globals|hasattr|hash|help|hex|id|input|isinstance|issubclass|iter|len|locals|map|max|memoryview|min|next|oct|open|ord|pow|property|range|repr|reversed|round|setattr|slice|sorted|staticmethod|sum|super|type|vars|zip'
|
||||
|
||||
if s:Python2Syntax()
|
||||
let s:funcs_re .= '|apply|basestring|buffer|cmp|coerce|execfile|file|intern|long|raw_input|reduce|reload|unichr|unicode|xrange'
|
||||
if s:Enabled('g:python_print_as_function')
|
||||
let s:funcs_re .= '|print'
|
||||
endif
|
||||
else
|
||||
let s:funcs_re .= '|ascii|exec|print'
|
||||
endif
|
||||
|
||||
let s:funcs_re = 'syn match pythonBuiltinFunc ''\v\.@<!\zs<%(' . s:funcs_re . ')>'
|
||||
|
||||
if !s:Enabled('g:python_highlight_builtin_funcs_kwarg')
|
||||
let s:funcs_re .= '\=@!'
|
||||
endif
|
||||
|
||||
execute s:funcs_re . ''''
|
||||
unlet s:funcs_re
|
||||
endif
|
||||
|
||||
"
|
||||
" Builtin exceptions and warnings
|
||||
"
|
||||
|
||||
if s:Enabled('g:python_highlight_exceptions')
|
||||
let s:exs_re = 'BaseException|Exception|ArithmeticError|LookupError|EnvironmentError|AssertionError|AttributeError|BufferError|EOFError|FloatingPointError|GeneratorExit|IOError|ImportError|IndexError|KeyError|KeyboardInterrupt|MemoryError|NameError|NotImplementedError|OSError|OverflowError|ReferenceError|RuntimeError|StopIteration|SyntaxError|IndentationError|TabError|SystemError|SystemExit|TypeError|UnboundLocalError|UnicodeError|UnicodeEncodeError|UnicodeDecodeError|UnicodeTranslateError|ValueError|VMSError|WindowsError|ZeroDivisionError|Warning|UserWarning|BytesWarning|DeprecationWarning|PendingDepricationWarning|SyntaxWarning|RuntimeWarning|FutureWarning|ImportWarning|UnicodeWarning'
|
||||
|
||||
if s:Python2Syntax()
|
||||
let s:exs_re .= '|StandardError'
|
||||
else
|
||||
let s:exs_re .= '|BlockingIOError|ChildProcessError|ConnectionError|BrokenPipeError|ConnectionAbortedError|ConnectionRefusedError|ConnectionResetError|FileExistsError|FileNotFoundError|InterruptedError|IsADirectoryError|NotADirectoryError|PermissionError|ProcessLookupError|TimeoutError|StopAsyncIteration|ResourceWarning'
|
||||
endif
|
||||
|
||||
execute 'syn match pythonExClass ''\v\.@<!\zs<%(' . s:exs_re . ')>'''
|
||||
unlet s:exs_re
|
||||
endif
|
||||
|
||||
if s:Enabled('g:python_slow_sync')
|
||||
syn sync minlines=2000
|
||||
else
|
||||
" This is fast but code inside triple quoted strings screws it up. It
|
||||
" is impossible to fix because the only way to know if you are inside a
|
||||
" triple quoted string is to start from the beginning of the file.
|
||||
syn sync match pythonSync grouphere NONE '):$'
|
||||
syn sync maxlines=200
|
||||
endif
|
||||
|
||||
if v:version >= 508 || !exists('did_python_syn_inits')
|
||||
if v:version <= 508
|
||||
let did_python_syn_inits = 1
|
||||
command -nargs=+ HiLink hi link <args>
|
||||
else
|
||||
command -nargs=+ HiLink hi def link <args>
|
||||
endif
|
||||
|
||||
HiLink pythonStatement Statement
|
||||
HiLink pythonRaiseFromStatement Statement
|
||||
HiLink pythonImport Include
|
||||
HiLink pythonFunction Function
|
||||
HiLink pythonConditional Conditional
|
||||
HiLink pythonRepeat Repeat
|
||||
HiLink pythonException Exception
|
||||
HiLink pythonOperator Operator
|
||||
|
||||
HiLink pythonDecorator Define
|
||||
HiLink pythonDottedName Function
|
||||
HiLink pythonDot Normal
|
||||
|
||||
HiLink pythonComment Comment
|
||||
if !s:Enabled('g:python_highlight_file_headers_as_comments')
|
||||
HiLink pythonCoding Special
|
||||
HiLink pythonRun Special
|
||||
endif
|
||||
HiLink pythonTodo Todo
|
||||
|
||||
HiLink pythonError Error
|
||||
HiLink pythonIndentError Error
|
||||
HiLink pythonSpaceError Error
|
||||
|
||||
HiLink pythonString String
|
||||
HiLink pythonRawString String
|
||||
HiLink pythonRawEscape Special
|
||||
|
||||
HiLink pythonUniEscape Special
|
||||
HiLink pythonUniEscapeError Error
|
||||
|
||||
if s:Python2Syntax()
|
||||
HiLink pythonUniString String
|
||||
HiLink pythonUniRawString String
|
||||
HiLink pythonUniRawEscape Special
|
||||
HiLink pythonUniRawEscapeError Error
|
||||
else
|
||||
HiLink pythonBytes String
|
||||
HiLink pythonRawBytes String
|
||||
HiLink pythonBytesContent String
|
||||
HiLink pythonBytesError Error
|
||||
HiLink pythonBytesEscape Special
|
||||
HiLink pythonBytesEscapeError Error
|
||||
HiLink pythonFString String
|
||||
HiLink pythonRawFString String
|
||||
HiLink pythonStrInterpRegion Special
|
||||
endif
|
||||
|
||||
HiLink pythonStrFormatting Special
|
||||
HiLink pythonStrFormat Special
|
||||
HiLink pythonStrTemplate Special
|
||||
|
||||
HiLink pythonDocTest Special
|
||||
HiLink pythonDocTest2 Special
|
||||
|
||||
HiLink pythonNumber Number
|
||||
HiLink pythonHexNumber Number
|
||||
HiLink pythonOctNumber Number
|
||||
HiLink pythonBinNumber Number
|
||||
HiLink pythonFloat Float
|
||||
HiLink pythonNumberError Error
|
||||
HiLink pythonOctError Error
|
||||
HiLink pythonHexError Error
|
||||
HiLink pythonBinError Error
|
||||
|
||||
HiLink pythonBoolean Boolean
|
||||
HiLink pythonNone Constant
|
||||
|
||||
HiLink pythonBuiltinObj Structure
|
||||
HiLink pythonBuiltinFunc Function
|
||||
|
||||
HiLink pythonExClass Structure
|
||||
HiLink pythonClassVar Identifier
|
||||
|
||||
delcommand HiLink
|
||||
endif
|
||||
|
||||
let b:current_syntax = 'python'
|
|
@ -362,8 +362,7 @@ map pL paste_symlink relative=True
|
|||
map phl paste_hardlink
|
||||
map pht paste_hardlinked_subtree
|
||||
|
||||
map DD console delete
|
||||
#map D shell mv --target-directory="$HOME/.local/share/Trash/files/" %s
|
||||
map dD console delete
|
||||
map Tm shell gio trash -f %s
|
||||
map Te shell gio trash --empty
|
||||
map dd cut
|
||||
|
|
|
@ -49,7 +49,7 @@ hide_username = True
|
|||
; Color theme, use "rtv --list-themes" to view a list of valid options.
|
||||
; This can be an absolute filepath, or the name of a theme file that has
|
||||
; been installed into either the custom of default theme paths.
|
||||
theme = monokai
|
||||
theme = solarized-dark
|
||||
|
||||
################
|
||||
# OAuth Settings
|
||||
|
@ -82,7 +82,7 @@ imgur_client_id = 93396265f59dec9
|
|||
##############
|
||||
; If you would like to define custom bindings, copy this section into your
|
||||
; config file with the [bindings] heading. All commands must be bound to at
|
||||
; least one key for the config to be valid.
|
||||
; least one key for the config to be valid.
|
||||
;
|
||||
; 1.) Plain keys can be represented by either uppercase/lowercase characters
|
||||
; or the hexadecimal numbers referring their ascii codes. For reference, see
|
||||
|
@ -108,7 +108,7 @@ imgur_client_id = 93396265f59dec9
|
|||
; a complete reference.
|
||||
|
||||
; Base page
|
||||
EXIT = q
|
||||
EXIT = q
|
||||
FORCE_EXIT = Q
|
||||
HELP = ?
|
||||
SORT_HOT = 1
|
||||
|
|
|
@ -12,10 +12,10 @@ rotate() {
|
|||
}
|
||||
|
||||
case "$KEY" in
|
||||
"C-b") hsetroot -fill "$file" ;;
|
||||
"C-b") tr '\n' '\0' | xargs -0 hsetroot -fill ;;
|
||||
"C-c") tr '\n' ' ' | xsel -i ;;
|
||||
"C-g") tr '\n' '\0' | xargs -0 gimp & ;;
|
||||
"C-d") gio trash -f "$file" ;;
|
||||
"C-d") tr '\n' '\0' | xargs -0 gio trash -f ;;
|
||||
"C-comma") rotate 270 ;;
|
||||
"C-period") rotate 90 ;;
|
||||
"C-minus") rotate 180 ;;
|
||||
|
|
|
@ -1,26 +0,0 @@
|
|||
[Desktop Entry]
|
||||
Exec=bash -c 'GTK_THEME=Adwaita-dark abiword %U'
|
||||
Icon=abiword
|
||||
Terminal=false
|
||||
Type=Application
|
||||
Categories=Office;WordProcessor;GNOME;GTK;X-Red-Hat-Base;
|
||||
StartupNotify=true
|
||||
X-Desktop-File-Install-Version=0.9
|
||||
MimeType=application/x-abiword;text/x-abiword;text/x-xml-abiword;text/plain;application/msword;application/rtf;application/vnd.plain;application/xhtml+xml;text/html;application/x-crossmark;application/docbook+xml;application/x-t602;application/vnd.oasis.opendocument.text;application/vnd.oasis.opendocument.text-template;application/vnd.oasis.opendocument.text-web;application/vnd.sun.xml.writer;application/vnd.stardivision.writer;text/vnd.wap.wml;application/wordperfect6;application/wordperfect5.1;application/vnd.wordperfect;application/x-abicollab;
|
||||
Name=AbiWord
|
||||
Comment=Compose, edit, and view documents
|
||||
Comment[de]=AbiWord Textverarbeitung
|
||||
GenericName[es]=Procesador de textos
|
||||
Comment[es]=Procesador de textos Abiword
|
||||
GenericName[fr]=Traitement de texte
|
||||
Comment[fr]=Traitement de texte de Gnome Office
|
||||
Comment[nb]=AbiWord Tekstbehandling
|
||||
Comment[nl]=AbiWord tekstverwerker
|
||||
Comment[nn]=AbiWord Tekstbehandling
|
||||
Comment[no]=AbiWord Tekstbehandler
|
||||
Comment[pl]=Edytor tekstu AbiWord
|
||||
Comment[pt]=AbiWord Processador de Texto
|
||||
GenericName[ru]=Текстовый редактор
|
||||
Comment[ru]=Обработка форматированных текстовых документов
|
||||
Comment[ja]=AbiWord ワードプロセッサ
|
||||
|
|
@ -90,6 +90,7 @@ set menu_scroll # scroll in menus
|
|||
set smart_wrap # don't split words
|
||||
set tilde # show tildes like in vim
|
||||
unset markers # no ugly plus signs
|
||||
auto_view application/pdf
|
||||
auto_view text/html # view html automatically
|
||||
alternative_order text/plain text/enriched text/html
|
||||
set quote_regexp = "^( {0,4}[>|:#%]| {0,4}[a-z0-9]+[>|]+)+"
|
||||
|
|
2
.xinitrc
2
.xinitrc
|
@ -20,5 +20,5 @@ wmname LG3D &
|
|||
/usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1 &
|
||||
xsetroot -cursor_name left_ptr &
|
||||
sxhkd &
|
||||
hsetroot -fill /home/deadguy/Pictures/wallpaper/algorave-wp-1366-2.png &
|
||||
hsetroot -fill /home/deadguy/Pictures/wallpaper/wallhaven-559044.png &
|
||||
exec bspwm
|
||||
|
|
26
.zshrc
26
.zshrc
|
@ -36,7 +36,7 @@ source ~/.local/share/icons-in-terminal/icons_bash.sh
|
|||
zstyle ':completion::complete:*' cache-path "$HOME/.config/zstuff/cache"
|
||||
zstyle ':completion:*:complete:-command-::commands' ignored-patterns '*\~'
|
||||
zstyle ':completion:*:builtins' list-colors '=*=1;38;5;142'
|
||||
zstyle ':completion:*:aliases' list-colors '=*=2;38;5;128'
|
||||
zstyle ':completion:*:aliases' list-colors '=*=2;38;5;120'
|
||||
zstyle ':completion:*:options' list-colors '=^(-- *)=34'
|
||||
zstyle ':completion:*' list-dirs-first true
|
||||
zstyle ':completion:*' special-dirs true
|
||||
|
@ -45,7 +45,7 @@ source ~/.local/share/icons-in-terminal/icons_bash.sh
|
|||
zstyle ':completion:*:descriptions' format '%F{yellow}%B--- %d%b --- %f'
|
||||
zstyle ':completion:*:warnings' format 'No matches for: %B%F{cyan}%d%f%b'
|
||||
zstyle ':completion:*:corrections' format '%d %B(%F{red}errors: %e%f)%b'
|
||||
zstyle ':completion:*:messages' format ' %F{orange} -- %d --%f'
|
||||
zstyle ':completion:*:messages' format ' %F{magenta} -- %d --%f'
|
||||
zstyle ':completion:*:options' description 'yes'
|
||||
zstyle ':completion:*:processes' command 'ps -au $USER -o pid,stat,%cpu,%mem,cputime,command'
|
||||
zstyle ':completion:*:processes-names' command 'ps c -u ${USER} -o command | uniq'
|
||||
|
@ -258,6 +258,8 @@ source ~/.local/share/icons-in-terminal/icons_bash.sh
|
|||
export FZF_CTRL_R_OPTS="--preview 'echo {}' --preview-window down:3:hidden:wrap --bind '?:toggle-preview'"
|
||||
export FZF_ALT_C_OPTS="--select-1 --exit-0 --preview 'tree -C {} | head -200'"
|
||||
|
||||
command -v tree > /dev/null && export FZF_ALT_C_OPTS="--preview 'tree -C {} | head -$LINES'"
|
||||
|
||||
# vf - fuzzy open with vim from anywhere
|
||||
vf() {
|
||||
local files
|
||||
|
@ -272,17 +274,6 @@ source ~/.local/share/icons-in-terminal/icons_bash.sh
|
|||
|
||||
# fkill - kill process using fzf.
|
||||
function fkill {
|
||||
local pid
|
||||
pid=$( pstree -T -p -c | fzf -e -m -i +s --reverse --margin=4%,1%,1%,2% --inline-info --header="TAB to (un)select. ENTER to kill selected process(es). ESC or CTRL+C to quit." --prompt='Enter string to filter list of processes > ' | awk '{print $NF}' | awk -F '(' '{print $NF}' | awk -F ')' '{print $1}' )
|
||||
|
||||
if [ "x$pid" != "x" ]
|
||||
then
|
||||
echo "$pid" | xargs kill -${1:-9}
|
||||
fi
|
||||
}
|
||||
|
||||
# fkill - kill process using fzf.
|
||||
function fkill2 {
|
||||
local pid
|
||||
pid=$( pstree -T -p -a | fzf -e -m -i +s --reverse --margin=4%,1%,1%,2% --inline-info --header="TAB to (un)select. ENTER to kill selected process(es). ESC or CTRL+C to quit." --prompt='Enter string to filter list of processes > ' | awk -F ',' '{print $NF}' | awk '{print $1}' )
|
||||
|
||||
|
@ -499,6 +490,7 @@ source ~/.local/share/icons-in-terminal/icons_bash.sh
|
|||
alias pmix='ncpamixer'
|
||||
alias amix='alsamixer'
|
||||
alias vi='nvim'
|
||||
alias vim='nvim'
|
||||
alias chat='irssi'
|
||||
alias play='ncmpcpp'
|
||||
alias tsrc='transmission-remote-cli'
|
||||
|
@ -513,7 +505,7 @@ source ~/.local/share/icons-in-terminal/icons_bash.sh
|
|||
alias p='pacui'
|
||||
alias sr='sr -browser=links' # open in cli browser
|
||||
alias surfraw='surfraw -browser=$BROWSER' # open in gui browser
|
||||
alias foxdot='python -m FoxDot'
|
||||
#alias foxdot='python -m FoxDot'
|
||||
alias ex='exercism'
|
||||
|
||||
# MAXIMUM VERBOSITY YIELDS MAXIMUM RESULTS
|
||||
|
@ -553,12 +545,12 @@ source ~/.local/share/icons-in-terminal/icons_bash.sh
|
|||
|
||||
# Commands
|
||||
alias pacmir='sudo pacman-mirrors -f5'
|
||||
alias wpp='hsetroot -fill'
|
||||
#alias wpp='hsetroot -fill ~/Pictures/wallpaper/'
|
||||
alias tis='tig status'
|
||||
alias til='tig log'
|
||||
alias tib='tig blame -C'
|
||||
alias fuck='sudo pacman -Rns'
|
||||
alias tits='trizen -Syu'
|
||||
alias upd='trizen -Syu'
|
||||
alias ytw='youtube-viewer -C -D -W -f -7 --results=10'
|
||||
alias hoy='calcurse -a --format-apt=" - %m (%S a %E)\n" --format-recur-apt=" - %m (%S a %E)\n"'
|
||||
alias week='calcurse -r7 --format-apt=" - %m (%S a %E)\n" --format-recur-apt=" - %m (%S a %E)\n"'
|
||||
|
@ -645,6 +637,8 @@ source $HOME/.config/zstuff/rc/transmission.zsh
|
|||
# Take a screenshot
|
||||
shot() { maim -d 5 -q -u ~/Pictures/scrot/$(date +%s).png && notify-send 'Screen captured' ;}
|
||||
|
||||
wpp() { hsetroot -fill ~/Pictures/wallpaper/$1 ;}
|
||||
|
||||
# Convert to mp3
|
||||
tomp3() {
|
||||
if [ $# -lt 1 ]; then
|
||||
|
|
|
@ -10,8 +10,8 @@ PAD='AlpsPS/2 ALPS GlidePoint'
|
|||
A=`xinput list-props "$PAD" | sed -n -e 's/.*Device Enabled ([0-9][0-9]*):\t\(.*\)/\1/p' `
|
||||
if [ $A -eq 1 ]; then
|
||||
xinput set-int-prop "$PAD" "Device Enabled" 8 0
|
||||
notify-send -t 5000 'touchpad disabled'
|
||||
notify-send -t 5000 'touchpad disabled' -i /usr/share/icons/Papirus-Dark/24x24/devices/input-touchpad.svg
|
||||
else
|
||||
xinput set-int-prop "$PAD" "Device Enabled" 8 1
|
||||
notify-send -t 5000 'touchpad enabled'
|
||||
notify-send -t 5000 'touchpad enabled' -i /usr/share/icons/Papirus-Dark/24x24/devices/input-touchpad.svg
|
||||
fi
|
||||
|
|
Reference in New Issue