Compare commits

..

2 commits

Author SHA256 Message Date
6619f49847
Merge pull request 'updated LOTS' (#7) from dev into main
Reviewed-on: #7
2025-10-03 22:21:04 -04:00
70ebe5e789
updated LOTS 2025-10-03 22:04:28 -04:00
98 changed files with 3435 additions and 20210 deletions

View file

@ -6,16 +6,18 @@
sshCommand = ssh -F ~/.config/ssh/config -o UserKnownHostsFile='/home/moo/.config/ssh/known_hosts'
quotePath = false
commitGraph = true
autocrlf = input
[user]
email = the7772howaboutyou@protonmail.com
email = alister@kamikishi.net
name = riomoo
signingkey = /home/moo/.config/ssh/gpg/the7772/id_ed25519.pub
#signingkey = FEC86E49B4437D4D
signingkey = /home/moo/.config/ssh/gpg/alisteratkamikishi/id_ed25519.pub
#signingkey = 554AF2CEAE26AC80
#email = the7772howaboutyou@protonmail.com
[alias]
resign = "!re() { git rebase --exec 'git commit --amend --no-edit -n -S' -i $1; }; re"
gwtm = worktree add master
gwtd = worktree add -b dev dev master
gwtd = worktree add -b dev dev master
gwtf = worktree add -b feat feat dev
gwtrf = worktree remove feat
gbrf = branch -D feat
@ -30,6 +32,7 @@
lg2-specific = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(auto)%d%C(reset)%n'' %C(white)%s%C(reset) %C(dim white)- %an%C(reset)'
lg3-specific = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset) %C(bold cyan)(committed: %cD)%C(reset) %C(auto)%d%C(reset)%n'' %C(white)%s%C(reset)%n'' %C(dim white)- %an <%ae> %C(reset) %C(dim white)(committer: %cn <%ce>)%C(reset)'
lg4-specific = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset) %C(bold cyan)(committed: %cD)%C(reset) %C(auto)%d%C(reset)%n'' %C(white)%s%C(reset)%n'' %C(dim white)- %an <%ae> %C(reset) %C(dim white)(committer: %cn <%ce>)%C(reset)'
ll = log --graph --format=\"%C(yellow)%h%C(red)%d%C(reset) - %C(bold green)(%ar)%C(reset) %s %C(blue)<%an>%C(reset)\"
[push]
@ -61,5 +64,3 @@
allowedSignersFile = /home/moo/.config/ssh/allowed_signers
[commit]
gpgsign = true
[init]
defaultBranch = main

View file

@ -0,0 +1 @@
192.168.0.100 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICNFyL6rb/ksObeVeDkUeh2e+g9eAYfD6SRT5hHMjNa8

View file

@ -1,67 +1,36 @@
" vim-plug: Vim plugin manager
" ============================
"
" Download plug.vim and put it in ~/.vim/autoload
" 1. Download plug.vim and put it in 'autoload' directory
"
" # Vim
" curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
" https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
"
" Edit your .vimrc
" # Neovim
" sh -c 'curl -fLo "${XDG_DATA_HOME:-$HOME/.local/share}"/nvim/site/autoload/plug.vim --create-dirs \
" https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
"
" call plug#begin('~/.vim/plugged')
" 2. Add a vim-plug section to your ~/.vimrc (or ~/.config/nvim/init.vim for Neovim)
"
" " Make sure you use single quotes
" call plug#begin()
"
" " Shorthand notation; fetches https://github.com/junegunn/vim-easy-align
" Plug 'junegunn/vim-easy-align'
" " List your plugins here
" Plug 'tpope/vim-sensible'
"
" " Any valid git URL is allowed
" Plug 'https://github.com/junegunn/vim-github-dashboard.git'
"
" " Multiple Plug commands can be written in a single line using | separators
" Plug 'SirVer/ultisnips' | Plug 'honza/vim-snippets'
"
" " On-demand loading
" Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
" Plug 'tpope/vim-fireplace', { 'for': 'clojure' }
"
" " Using a non-default branch
" Plug 'rdnetto/YCM-Generator', { 'branch': 'stable' }
"
" " Using a tagged release; wildcard allowed (requires git 1.9.2 or above)
" Plug 'fatih/vim-go', { 'tag': '*' }
"
" " Plugin options
" Plug 'nsf/gocode', { 'tag': 'v.20150303', 'rtp': 'vim' }
"
" " Plugin outside ~/.vim/plugged with post-update hook
" Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
"
" " Unmanaged plugin (manually installed and updated)
" Plug '~/my-prototype-plugin'
"
" " Initialize plugin system
" call plug#end()
"
" Then reload .vimrc and :PlugInstall to install plugins.
" 3. Reload the file or restart Vim, then you can,
"
" Plug options:
" :PlugInstall to install plugins
" :PlugUpdate to update plugins
" :PlugDiff to review the changes from the last update
" :PlugClean to remove plugins no longer in the list
"
"| Option | Description |
"| ----------------------- | ------------------------------------------------ |
"| `branch`/`tag`/`commit` | Branch/tag/commit of the repository to use |
"| `rtp` | Subdirectory that contains Vim plugin |
"| `dir` | Custom directory for the plugin |
"| `as` | Use different name for the plugin |
"| `do` | Post-update hook (string or funcref) |
"| `on` | On-demand loading: Commands or `<Plug>`-mappings |
"| `for` | On-demand loading: File types |
"| `frozen` | Do not update unless explicitly specified |
"
" More information: https://github.com/junegunn/vim-plug
" For more information, see https://github.com/junegunn/vim-plug
"
"
" Copyright (c) 2017 Junegunn Choi
" Copyright (c) 2024 Junegunn Choi
"
" MIT License
"
@ -238,10 +207,11 @@ endfunction
function! plug#begin(...)
if a:0 > 0
let s:plug_home_org = a:1
let home = s:path(s:plug_fnamemodify(s:plug_expand(a:1), ':p'))
elseif exists('g:plug_home')
let home = s:path(g:plug_home)
elseif has('nvim')
let home = stdpath('data') . '/plugged'
elseif !empty(&rtp)
let home = s:path(split(&rtp, ',')[0]) . '/plugged'
else
@ -350,7 +320,7 @@ function! plug#end()
endif
let lod = { 'ft': {}, 'map': {}, 'cmd': {} }
if exists('g:did_load_filetypes')
if get(g:, 'did_load_filetypes', 0)
filetype off
endif
for name in g:plugs_order
@ -389,6 +359,9 @@ function! plug#end()
if !empty(types)
augroup filetypedetect
call s:source(s:rtp(plug), 'ftdetect/**/*.vim', 'after/ftdetect/**/*.vim')
if has('nvim-0.5.0')
call s:source(s:rtp(plug), 'ftdetect/**/*.lua', 'after/ftdetect/**/*.lua')
endif
augroup END
endif
for type in types
@ -399,13 +372,15 @@ function! plug#end()
for [cmd, names] in items(lod.cmd)
execute printf(
\ 'command! -nargs=* -range -bang -complete=file %s call s:lod_cmd(%s, "<bang>", <line1>, <line2>, <q-args>, %s)',
\ cmd, string(cmd), string(names))
\ has('patch-7.4.1898')
\ ? 'command! -nargs=* -range -bang -complete=file %s call s:lod_cmd(%s, "<bang>", <line1>, <line2>, <q-args>, <q-mods> ,%s)'
\ : 'command! -nargs=* -range -bang -complete=file %s call s:lod_cmd(%s, "<bang>", <line1>, <line2>, <q-args>, %s)'
\ , cmd, string(cmd), string(names))
endfor
for [map, names] in items(lod.map)
for [mode, map_prefix, key_prefix] in
\ [['i', '<C-O>', ''], ['n', '', ''], ['v', '', 'gv'], ['o', '', '']]
\ [['i', '<C-\><C-O>', ''], ['n', '', ''], ['v', '', 'gv'], ['o', '', '']]
execute printf(
\ '%snoremap <silent> %s %s:<C-U>call <SID>lod_map(%s, %s, %s, "%s")<CR>',
\ mode, map, map_prefix, string(map), string(names), mode != 'i', key_prefix)
@ -436,6 +411,9 @@ endfunction
function! s:load_plugin(spec)
call s:source(s:rtp(a:spec), 'plugin/**/*.vim', 'after/plugin/**/*.vim')
if has('nvim-0.5.0')
call s:source(s:rtp(a:spec), 'plugin/**/*.lua', 'after/plugin/**/*.lua')
endif
endfunction
function! s:reload_plugins()
@ -653,6 +631,9 @@ function! s:lod(names, types, ...)
let rtp = s:rtp(g:plugs[name])
for dir in a:types
call s:source(rtp, dir.'/**/*.vim')
if has('nvim-0.5.0') " see neovim#14686
call s:source(rtp, dir.'/**/*.lua')
endif
endfor
if a:0
if !s:source(rtp, a:1) && !empty(s:glob(rtp, a:2))
@ -672,11 +653,19 @@ function! s:lod_ft(pat, names)
call s:doautocmd('filetypeindent', 'FileType')
endfunction
function! s:lod_cmd(cmd, bang, l1, l2, args, names)
call s:lod(a:names, ['ftdetect', 'after/ftdetect', 'plugin', 'after/plugin'])
call s:dobufread(a:names)
execute printf('%s%s%s %s', (a:l1 == a:l2 ? '' : (a:l1.','.a:l2)), a:cmd, a:bang, a:args)
endfunction
if has('patch-7.4.1898')
function! s:lod_cmd(cmd, bang, l1, l2, args, mods, names)
call s:lod(a:names, ['ftdetect', 'after/ftdetect', 'plugin', 'after/plugin'])
call s:dobufread(a:names)
execute printf('%s %s%s%s %s', a:mods, (a:l1 == a:l2 ? '' : (a:l1.','.a:l2)), a:cmd, a:bang, a:args)
endfunction
else
function! s:lod_cmd(cmd, bang, l1, l2, args, names)
call s:lod(a:names, ['ftdetect', 'after/ftdetect', 'plugin', 'after/plugin'])
call s:dobufread(a:names)
execute printf('%s%s%s %s', (a:l1 == a:l2 ? '' : (a:l1.','.a:l2)), a:cmd, a:bang, a:args)
endfunction
endif
function! s:lod_map(map, names, with_prefix, prefix)
call s:lod(a:names, ['ftdetect', 'after/ftdetect', 'plugin', 'after/plugin'])
@ -804,10 +793,11 @@ endfunction
function! s:syntax()
syntax clear
syntax region plug1 start=/\%1l/ end=/\%2l/ contains=plugNumber
syntax region plug2 start=/\%2l/ end=/\%3l/ contains=plugBracket,plugX
syntax region plug2 start=/\%2l/ end=/\%3l/ contains=plugBracket,plugX,plugAbort
syn match plugNumber /[0-9]\+[0-9.]*/ contained
syn match plugBracket /[[\]]/ contained
syn match plugX /x/ contained
syn match plugAbort /\~/ contained
syn match plugDash /^-\{1}\ /
syn match plugPlus /^+/
syn match plugStar /^*/
@ -832,6 +822,7 @@ function! s:syntax()
hi def link plug2 Repeat
hi def link plugH2 Type
hi def link plugX Exception
hi def link plugAbort Ignore
hi def link plugBracket Structure
hi def link plugNumber Number
@ -867,7 +858,7 @@ function! s:lastline(msg)
endfunction
function! s:new_window()
execute get(g:, 'plug_window', 'vertical topleft new')
execute get(g:, 'plug_window', '-tabnew')
endfunction
function! s:plug_window_exists()
@ -929,7 +920,7 @@ function! s:prepare(...)
endif
endfor
call s:job_abort()
call s:job_abort(0)
if s:switch_in()
if b:plug_preview == 1
pc
@ -965,6 +956,8 @@ function! s:close_pane()
if b:plug_preview == 1
pc
let b:plug_preview = -1
elseif exists('s:jobs') && !empty(s:jobs)
call s:job_abort(1)
else
bd
endif
@ -1029,6 +1022,11 @@ function! s:is_updated(dir)
endfunction
function! s:do(pull, force, todo)
if has('nvim')
" Reset &rtp to invalidate Neovim cache of loaded Lua modules
" See https://github.com/junegunn/vim-plug/pull/1157#issuecomment-1809226110
let &rtp = &rtp
endif
for [name, spec] in items(a:todo)
if !isdirectory(spec.dir)
continue
@ -1087,15 +1085,21 @@ function! s:hash_match(a, b)
return stridx(a:a, a:b) == 0 || stridx(a:b, a:a) == 0
endfunction
function! s:disable_credential_helper()
return s:git_version_requirement(2) && get(g:, 'plug_disable_credential_helper', 1)
endfunction
function! s:checkout(spec)
let sha = a:spec.commit
let output = s:git_revision(a:spec.dir)
let error = 0
if !empty(output) && !s:hash_match(sha, s:lines(output)[0])
let credential_helper = s:git_version_requirement(2) ? '-c credential.helper= ' : ''
let credential_helper = s:disable_credential_helper() ? '-c credential.helper= ' : ''
let output = s:system(
\ 'git '.credential_helper.'fetch --depth 999999 && git checkout '.plug#shellescape(sha).' --', a:spec.dir)
let error = v:shell_error
endif
return output
return [output, error]
endfunction
function! s:finish(pull)
@ -1156,7 +1160,7 @@ function! s:update_impl(pull, force, args) abort
let threads = (len(args) > 0 && args[-1] =~ '^[1-9][0-9]*$') ?
\ remove(args, -1) : get(g:, 'plug_threads', 16)
let managed = filter(copy(g:plugs), 's:is_managed(v:key)')
let managed = filter(deepcopy(g:plugs), 's:is_managed(v:key)')
let todo = empty(args) ? filter(managed, '!v:val.frozen || !isdirectory(v:val.dir)') :
\ filter(managed, 'index(args, v:key) >= 0')
@ -1290,9 +1294,11 @@ function! s:update_finish()
if !pos
continue
endif
let out = ''
let error = 0
if has_key(spec, 'commit')
call s:log4(name, 'Checking out '.spec.commit)
let out = s:checkout(spec)
let [out, error] = s:checkout(spec)
elseif has_key(spec, 'tag')
let tag = spec.tag
if tag =~ '\*'
@ -1305,19 +1311,16 @@ function! s:update_finish()
endif
call s:log4(name, 'Checking out '.tag)
let out = s:system('git checkout -q '.plug#shellescape(tag).' -- 2>&1', spec.dir)
else
let branch = s:git_origin_branch(spec)
call s:log4(name, 'Merging origin/'.s:esc(branch))
let out = s:system('git checkout -q '.plug#shellescape(branch).' -- 2>&1'
\. (has_key(s:update.new, name) ? '' : ('&& git merge --ff-only '.plug#shellescape('origin/'.branch).' 2>&1')), spec.dir)
let error = v:shell_error
endif
if !v:shell_error && filereadable(spec.dir.'/.gitmodules') &&
if !error && filereadable(spec.dir.'/.gitmodules') &&
\ (s:update.force || has_key(s:update.new, name) || s:is_updated(spec.dir))
call s:log4(name, 'Updating submodules. This may take a while.')
let out .= s:bang('git submodule update --init --recursive'.s:submodule_opt.' 2>&1', spec.dir)
let error = v:shell_error
endif
let msg = s:format_message(v:shell_error ? 'x': '-', name, out)
if v:shell_error
if error
call add(s:update.errors, name)
call s:regress_bar()
silent execute pos 'd _'
@ -1341,7 +1344,12 @@ function! s:update_finish()
endif
endfunction
function! s:job_abort()
function! s:mark_aborted(name, message)
let attrs = { 'running': 0, 'error': 1, 'abort': 1, 'lines': [a:message] }
let s:jobs[a:name] = extend(get(s:jobs, a:name, {}), attrs)
endfunction
function! s:job_abort(cancel)
if (!s:nvim && !s:vim8) || !exists('s:jobs')
return
endif
@ -1355,8 +1363,18 @@ function! s:job_abort()
if j.new
call s:rm_rf(g:plugs[name].dir)
endif
if a:cancel
call s:mark_aborted(name, 'Aborted')
endif
endfor
let s:jobs = {}
if a:cancel
for todo in values(s:update.todo)
let todo.abort = 1
endfor
else
let s:jobs = {}
endif
endfunction
function! s:last_non_empty_line(lines)
@ -1370,6 +1388,16 @@ function! s:last_non_empty_line(lines)
return ''
endfunction
function! s:bullet_for(job, ...)
if a:job.running
return a:job.new ? '+' : '*'
endif
if get(a:job, 'abort', 0)
return '~'
endif
return a:job.error ? 'x' : get(a:000, 0, '-')
endfunction
function! s:job_out_cb(self, data) abort
let self = a:self
let data = remove(self.lines, -1) . a:data
@ -1378,9 +1406,10 @@ function! s:job_out_cb(self, data) abort
" To reduce the number of buffer updates
let self.tick = get(self, 'tick', -1) + 1
if !self.running || self.tick % len(s:jobs) == 0
let bullet = self.running ? (self.new ? '+' : '*') : (self.error ? 'x' : '-')
let result = self.error ? join(self.lines, "\n") : s:last_non_empty_line(self.lines)
call s:log(bullet, self.name, result)
if len(result)
call s:log(s:bullet_for(self), self.name, result)
endif
endif
endfunction
@ -1393,7 +1422,7 @@ endfunction
function! s:job_cb(fn, job, ch, data)
if !s:plug_window_exists() " plug window closed
return s:job_abort()
return s:job_abort(0)
endif
call call(a:fn, [a:job, a:data])
endfunction
@ -1404,16 +1433,17 @@ function! s:nvim_cb(job_id, data, event) dict abort
\ s:job_cb('s:job_exit_cb', self, 0, a:data)
endfunction
function! s:spawn(name, cmd, opts)
let job = { 'name': a:name, 'running': 1, 'error': 0, 'lines': [''],
\ 'new': get(a:opts, 'new', 0) }
function! s:spawn(name, spec, queue, opts)
let job = { 'name': a:name, 'spec': a:spec, 'running': 1, 'error': 0, 'lines': [''],
\ 'new': get(a:opts, 'new', 0), 'queue': copy(a:queue) }
let Item = remove(job.queue, 0)
let argv = type(Item) == s:TYPE.funcref ? call(Item, [a:spec]) : Item
let s:jobs[a:name] = job
if s:nvim
if has_key(a:opts, 'dir')
let job.cwd = a:opts.dir
endif
let argv = a:cmd
call extend(job, {
\ 'on_stdout': function('s:nvim_cb'),
\ 'on_stderr': function('s:nvim_cb'),
@ -1429,7 +1459,7 @@ function! s:spawn(name, cmd, opts)
\ 'Invalid arguments (or job table is full)']
endif
elseif s:vim8
let cmd = join(map(copy(a:cmd), 'plug#shellescape(v:val, {"script": 0})'))
let cmd = join(map(copy(argv), 'plug#shellescape(v:val, {"script": 0})'))
if has_key(a:opts, 'dir')
let cmd = s:with_cd(cmd, a:opts.dir, 0)
endif
@ -1449,27 +1479,33 @@ function! s:spawn(name, cmd, opts)
let job.lines = ['Failed to start job']
endif
else
let job.lines = s:lines(call('s:system', has_key(a:opts, 'dir') ? [a:cmd, a:opts.dir] : [a:cmd]))
let job.lines = s:lines(call('s:system', has_key(a:opts, 'dir') ? [argv, a:opts.dir] : [argv]))
let job.error = v:shell_error != 0
let job.running = 0
endif
endfunction
function! s:reap(name)
let job = s:jobs[a:name]
let job = remove(s:jobs, a:name)
if job.error
call add(s:update.errors, a:name)
elseif get(job, 'new', 0)
let s:update.new[a:name] = 1
endif
let s:update.bar .= job.error ? 'x' : '='
let bullet = job.error ? 'x' : '-'
let more = len(get(job, 'queue', []))
let result = job.error ? join(job.lines, "\n") : s:last_non_empty_line(job.lines)
call s:log(bullet, a:name, empty(result) ? 'OK' : result)
call s:bar()
if len(result)
call s:log(s:bullet_for(job), a:name, result)
endif
call remove(s:jobs, a:name)
if !job.error && more
let job.spec.queue = job.queue
let s:update.todo[a:name] = job.spec
else
let s:update.bar .= s:bullet_for(job, '=')
call s:bar()
endif
endfunction
function! s:bar()
@ -1522,6 +1558,16 @@ function! s:update_vim()
call s:tick()
endfunction
function! s:checkout_command(spec)
let a:spec.branch = s:git_origin_branch(a:spec)
return ['git', 'checkout', '-q', a:spec.branch, '--']
endfunction
function! s:merge_command(spec)
let a:spec.branch = s:git_origin_branch(a:spec)
return ['git', 'merge', '--ff-only', 'origin/'.a:spec.branch]
endfunction
function! s:tick()
let pull = s:update.pull
let prog = s:progress_opt(s:nvim || s:vim8)
@ -1536,24 +1582,39 @@ while 1 " Without TCO, Vim stack is bound to explode
let name = keys(s:update.todo)[0]
let spec = remove(s:update.todo, name)
let new = empty(globpath(spec.dir, '.git', 1))
if get(spec, 'abort', 0)
call s:mark_aborted(name, 'Skipped')
call s:reap(name)
continue
endif
call s:log(new ? '+' : '*', name, pull ? 'Updating ...' : 'Installing ...')
redraw
let queue = get(spec, 'queue', [])
let new = empty(globpath(spec.dir, '.git', 1))
if empty(queue)
call s:log(new ? '+' : '*', name, pull ? 'Updating ...' : 'Installing ...')
redraw
endif
let has_tag = has_key(spec, 'tag')
if !new
if len(queue)
call s:spawn(name, spec, queue, { 'dir': spec.dir })
elseif !new
let [error, _] = s:git_validate(spec, 0)
if empty(error)
if pull
let cmd = s:git_version_requirement(2) ? ['git', '-c', 'credential.helper=', 'fetch'] : ['git', 'fetch']
let cmd = s:disable_credential_helper() ? ['git', '-c', 'credential.helper=', 'fetch'] : ['git', 'fetch']
if has_tag && !empty(globpath(spec.dir, '.git/shallow'))
call extend(cmd, ['--depth', '99999999'])
endif
if !empty(prog)
call add(cmd, prog)
endif
call s:spawn(name, cmd, { 'dir': spec.dir })
let queue = [cmd, split('git remote set-head origin -a')]
if !has_tag && !has_key(spec, 'commit')
call extend(queue, [function('s:checkout_command'), function('s:merge_command')])
endif
call s:spawn(name, spec, queue, { 'dir': spec.dir })
else
let s:jobs[name] = { 'running': 0, 'lines': ['Already installed'], 'error': 0 }
endif
@ -1568,7 +1629,7 @@ while 1 " Without TCO, Vim stack is bound to explode
if !empty(prog)
call add(cmd, prog)
endif
call s:spawn(name, extend(cmd, [spec.uri, s:trim(spec.dir)]), { 'new': 1 })
call s:spawn(name, spec, [extend(cmd, [spec.uri, s:trim(spec.dir)]), function('s:checkout_command'), function('s:merge_command')], { 'new': 1 })
endif
if !s:jobs[name].running
@ -2267,7 +2328,10 @@ endfunction
function! s:with_cd(cmd, dir, ...)
let script = a:0 > 0 ? a:1 : 1
return printf('cd%s %s && %s', s:is_win ? ' /d' : '', plug#shellescape(a:dir, {'script': script}), a:cmd)
let pwsh = s:is_powershell(&shell)
let cd = s:is_win && !pwsh ? 'cd /d' : 'cd'
let sep = pwsh ? ';' : '&&'
return printf('%s %s %s %s', cd, plug#shellescape(a:dir, {'script': script, 'shell': &shell}), sep, a:cmd)
endfunction
function! s:system(cmd, ...)
@ -2344,18 +2408,21 @@ function! s:git_validate(spec, check_branch)
\ current_branch, origin_branch)
endif
if empty(err)
let [ahead, behind] = split(s:lastline(s:system([
\ 'git', 'rev-list', '--count', '--left-right',
\ printf('HEAD...origin/%s', origin_branch)
\ ], a:spec.dir)), '\t')
if !v:shell_error && ahead
if behind
let ahead_behind = split(s:lastline(s:system([
\ 'git', 'rev-list', '--count', '--left-right',
\ printf('HEAD...origin/%s', origin_branch)
\ ], a:spec.dir)), '\t')
if v:shell_error || len(ahead_behind) != 2
let err = "Failed to compare with the origin. The default branch might have changed.\nPlugClean required."
else
let [ahead, behind] = ahead_behind
if ahead && behind
" Only mention PlugClean if diverged, otherwise it's likely to be
" pushable (and probably not that messed up).
let err = printf(
\ "Diverged from origin/%s (%d commit(s) ahead and %d commit(s) behind!\n"
\ .'Backup local changes and run PlugClean and PlugUpdate to reinstall it.', origin_branch, ahead, behind)
else
elseif ahead
let err = printf("Ahead of origin/%s by %d commit(s).\n"
\ .'Cannot update until local changes are pushed.',
\ origin_branch, ahead)
@ -2387,7 +2454,7 @@ function! s:clean(force)
let errs = {}
let [cnt, total] = [0, len(g:plugs)]
for [name, spec] in items(g:plugs)
if !s:is_managed(name)
if !s:is_managed(name) || get(spec, 'frozen', 0)
call add(dirs, spec.dir)
else
let [err, clean] = s:git_validate(spec, 1)
@ -2619,26 +2686,34 @@ function! s:preview_commit()
let sha = matchstr(getline('.'), '^ \X*\zs[0-9a-f]\{7,9}')
if empty(sha)
return
let name = matchstr(getline('.'), '^- \zs[^:]*\ze:$')
if empty(name)
return
endif
let title = 'HEAD@{1}..'
let command = 'git diff --no-color HEAD@{1}'
else
let title = sha
let command = 'git show --no-color --pretty=medium '.sha
let name = s:find_name(line('.'))
endif
let name = s:find_name(line('.'))
if empty(name) || !has_key(g:plugs, name) || !isdirectory(g:plugs[name].dir)
return
endif
if exists('g:plug_pwindow') && !s:is_preview_window_open()
execute g:plug_pwindow
execute 'e' sha
if !s:is_preview_window_open()
execute get(g:, 'plug_pwindow', 'vertical rightbelow new')
execute 'e' title
else
execute 'pedit' sha
execute 'pedit' title
wincmd P
endif
setlocal previewwindow filetype=git buftype=nofile nobuflisted modifiable
setlocal previewwindow filetype=git buftype=nofile bufhidden=wipe nobuflisted modifiable
let batchfile = ''
try
let [sh, shellcmdflag, shrd] = s:chsh(1)
let cmd = 'cd '.plug#shellescape(g:plugs[name].dir).' && git show --no-color --pretty=medium '.sha
let cmd = 'cd '.plug#shellescape(g:plugs[name].dir).' && '.command
if s:is_win
let [batchfile, cmd] = s:batchfile(cmd)
endif
@ -2764,9 +2839,9 @@ function! s:snapshot(force, ...) abort
1
let anchor = line('$') - 3
let names = sort(keys(filter(copy(g:plugs),
\'has_key(v:val, "uri") && !has_key(v:val, "commit") && isdirectory(v:val.dir)')))
\'has_key(v:val, "uri") && isdirectory(v:val.dir)')))
for name in reverse(names)
let sha = s:git_revision(g:plugs[name].dir)
let sha = has_key(g:plugs[name], 'commit') ? g:plugs[name].commit : s:git_revision(g:plugs[name].dir)
if !empty(sha)
call append(anchor, printf("silent! let g:plugs['%s'].commit = '%s'", name, sha))
redraw

File diff suppressed because it is too large Load diff

View file

@ -1,54 +0,0 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
# C extensions
*.so
# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
lib/
lib64/
parts/
sdist/
var/
*.egg-info/
.installed.cfg
*.egg
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.cache
nosetests.xml
coverage.xml
# Translations
*.mo
*.pot
# Django stuff:
*.log
# Sphinx documentation
docs/_build/
# PyBuilder
target/

View file

@ -1,675 +0,0 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
{one line to give the program's name and a brief idea of what it does.}
Copyright (C) {year} {name of author}
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
{project} Copyright (C) {year} {fullname}
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.

View file

@ -1,72 +0,0 @@
# YCM-Generator
This is a script which generates a list of compiler flags from a project with an arbitrary build system. It can be used to:
* generate a ```.ycm_extra_conf.py``` file for use with [YouCompleteMe](https://github.com/Valloric/YouCompleteMe)
* generate a ```.color_coded``` file for use with [color_coded](https://github.com/jeaye/color_coded)
It works by building the project with a fake toolchain, which simply and filters compiler flags to be stored in the resulting file.
It is reasonably fast, taking ~10 seconds to generate a configuration file for the Linux kernel.
## Status
This plugin is in maintenance mode. I am happy to merge PRs and triage bug reports, but am not actively working on it.
## Installation
Add ```NeoBundle 'rdnetto/YCM-Generator'``` to your vimrc (or the equivalent for your plugin manager).
For [vim-plug](https://github.com/junegunn/vim-plug) users, add ```Plug 'rdnetto/YCM-Generator', { 'branch': 'stable'}``` to your vimrc.
Alternatively, Arch Linux users can install YCM-Generator using the (unofficial) [AUR package](https://aur4.archlinux.org/packages/ycm-generator-git/).
## Usage
Run ```./config_gen.py PROJECT_DIRECTORY```, where ```PROJECT_DIRECTORY``` is the root directory of your project's build system (i.e. the one containing the root Makefile, etc.)
You can also invoke it from within Vim using the ```:YcmGenerateConfig``` or ```:CCGenerateConfig``` commands to generate a config file for the current directory. These commands accept the same arguments as ```./config_gen.py```, but do not require the project directory to be specified (it defaults to the current working directory).
## Requirements and Limitations
* Requirements:
+ Python 2
+ Clang
* Supported build systems:
+ make
+ cmake
+ qmake
+ autotools
Your build system should support specifying the compiler through the ```CC```/```CXX``` environment variables, or not use an absolute path to the compiler.
Some flags present in the resulting configuration file may be mutually exclusive with each other - reading the generated file prior to use is recommended.
The script assumes that executables with the names `clang` and `clang++` exist in your `PATH`. This has been known to cause issues under Ubuntu, where the C++ compiler may be called `clang++-3.6` (see #50).
## Documentation & Support
* run ```./config_gen.py --help``` to see the complete list of supported options.
* if you receive the error message ```ERROR: No commands were logged to the build logs```, try using the ```--verbose``` flag to see any error messages
+ some build systems require certain environment variables to be set. Note that these will *not* be used by YCM-Generator by default, unless `--preserve-environment` is used
+ if you open an issue regarding this error message, please include the output when running with ```--verbose``` and a link to the project repo (if possible)
## Development
Patches are welcome. Please submit pull requests against the ```develop``` branch.
### Windows support
The script is currently supported under Unices (Linux, NixOS<sup>[1]</sup>, BSD, OS X) only.
Implementing Windows support consists of porting the contents of ```fake-toolchain/Unix```.
If you are interested in implementing/testing this, please open a pull request.
<sup>[1]</sup> May require `--preserve-environment` - see [#19](https://github.com/rdnetto/YCM-Generator/issues/19)
### Test Cases
The following projects are used for testing:
| Project | Build system | Notes |
| ------------------------------------------------------------------------- | ----------------- | ------ |
| [Linux kernel](https://git.kernel.org) | Kbuild (Make) | |
| [Vim-qt](https://bitbucket.org/equalsraf/vim-qt.git) | Autotools | |
| [Clementine](https://github.com/clementine-player/Clementine.git) | Cmake | |
| [ExtPlane](https://github.com/vranki/ExtPlane.git) | Qmake | Should be tested with both versions of Qt. |
| [OpenFOAM](https://github.com/OpenFOAM/OpenFOAM-3.0.x.git) | wmake | |
## License
YCM-Generator is published under the GNU GPLv3.

View file

@ -1,502 +0,0 @@
#!/usr/bin/env python2
import sys
import os
import os.path
import re
import argparse
import datetime
import multiprocessing
import shlex
import shutil
import tempfile
import time
import subprocess
import glob
# Default flags for make
default_make_flags = ["-i", "-j" + str(multiprocessing.cpu_count())]
# Set YCM-Generator directory
# Always obtain the real path to the directory where 'config_gen.py' lives as,
# in some cases, it will be a symlink placed in '/usr/bin' (as is the case
# with the Arch Linux AUR package) and it won't
# be able to find the plugin directory.
ycm_generator_dir = os.path.dirname(os.path.realpath(__file__))
def main():
# parse command-line args
parser = argparse.ArgumentParser(description="Automatically generates config files for YouCompleteMe")
parser.add_argument("-v", "--verbose", action="store_true", help="Show output from build process")
parser.add_argument("-f", "--force", action="store_true", help="Overwrite the file if it exists.")
parser.add_argument("-m", "--make", default="make", help="Use the specified executable for make.")
parser.add_argument("-b", "--build-system", choices=["cmake", "autotools", "qmake", "make"], help="Force use of the specified build system rather than trying to autodetect.")
parser.add_argument("-c", "--compiler", help="Use the specified executable for clang. It should be the same version as the libclang used by YCM. The executable for clang++ will be inferred from this.")
parser.add_argument("-C", "--configure_opts", default="", help="Additional flags to pass to configure/cmake/etc. e.g. --configure_opts=\"--enable-FEATURE\"")
parser.add_argument("-F", "--format", choices=["ycm", "cc"], default="ycm", help="Format of output file (YouCompleteMe or color_coded). Default: ycm")
parser.add_argument("-M", "--make-flags", help="Flags to pass to make when fake-building. Default: -M=\"{}\"".format(" ".join(default_make_flags)))
parser.add_argument("-o", "--output", help="Save the config file as OUTPUT. Default: .ycm_extra_conf.py, or .color_coded if --format=cc.")
parser.add_argument("-x", "--language", choices=["c", "c++"], help="Only output flags for the given language. This defaults to whichever language has its compiler invoked the most.")
parser.add_argument("--out-of-tree", action="store_true", help="Build autotools projects out-of-tree. This is a no-op for other project types.")
parser.add_argument("--qt-version", choices=["4", "5"], default="5", help="Use the given Qt version for qmake. (Default: 5)")
parser.add_argument("-e", "--preserve-environment", action="store_true", help="Pass environment variables to build processes.")
parser.add_argument("PROJECT_DIR", help="The root directory of the project.")
args = vars(parser.parse_args())
project_dir = os.path.abspath(args["PROJECT_DIR"])
# verify that project_dir exists
if(not os.path.exists(project_dir)):
print("ERROR: '{}' does not exist".format(project_dir))
return 1
# verify the clang is installed, and infer the correct name for both the C and C++ compilers
try:
cc = args["compiler"] or "clang"
args["cc"] = subprocess.check_output(["which", cc]).strip()
except subprocess.CalledProcessError:
print("ERROR: Could not find clang at '{}'. Please make sure it is installed and is either in your path, or specified with --compiler.".format(cc))
return 1
try:
h, t = os.path.split(args["compiler"] or "clang")
cxx = os.path.join(h, t.replace("clang", "clang++"))
args["cxx"] = subprocess.check_output(["which", cxx]).strip()
except subprocess.CalledProcessError:
print("ERROR: Could not find clang++ at '{}'. Please make sure it is installed and specified appropriately.".format(cxx))
return 1
# sanity check - remove this after we add Windows support
if(sys.platform.startswith("win32")):
print("ERROR: Windows is not supported")
# prompt user to overwrite existing file (if necessary)
config_file = {
None: args["output"],
"cc": os.path.join(project_dir, ".color_coded"),
"ycm": os.path.join(project_dir, ".ycm_extra_conf.py"),
}[args["format"] if args["output"] is None else None]
if(os.path.exists(config_file) and not args["force"]):
print("'{}' already exists. Overwrite? [y/N] ".format(config_file)),
response = sys.stdin.readline().strip().lower()
if(response != "y" and response != "yes"):
return 1
# command-line args to pass to fake_build() using kwargs
args["make_cmd"] = args.pop("make")
args["configure_opts"] = shlex.split(args["configure_opts"])
args["make_flags"] = default_make_flags if args["make_flags"] is None else shlex.split(args["make_flags"])
force_lang = args.pop("language")
output_format = args.pop("format")
del args["compiler"]
del args["force"]
del args["output"]
del args["PROJECT_DIR"]
generate_conf = {
"ycm": generate_ycm_conf,
"cc": generate_cc_conf,
}[output_format]
# temporary files to hold build logs
with tempfile.NamedTemporaryFile(mode="rw") as c_build_log:
with tempfile.NamedTemporaryFile(mode="rw") as cxx_build_log:
# perform the actual compilation of flags
fake_build(project_dir, c_build_log.name, cxx_build_log.name, **args)
(c_count, c_skip, c_flags) = parse_flags(c_build_log)
(cxx_count, cxx_skip, cxx_flags) = parse_flags(cxx_build_log)
print("Collected {} relevant entries for C compilation ({} discarded).".format(c_count, c_skip))
print("Collected {} relevant entries for C++ compilation ({} discarded).".format(cxx_count, cxx_skip))
# select the language to compile for. If -x was used, zero all other options (so we don't need to repeat the error code)
if(force_lang == "c"):
cxx_count = 0
elif(force_lang == "c++"):
c_count = 0
if(c_count == 0 and cxx_count == 0):
print("")
print("ERROR: No commands were logged to the build logs (C: {}, C++: {}).".format(c_build_log.name, cxx_build_log.name))
print("Your build system may not be compatible.")
if(not args["verbose"]):
print("")
print("Try running with the --verbose flag to see build system output - the most common cause of this is a hardcoded compiler path.")
c_build_log.delete = False
cxx_build_log.delete = False
return 3
elif(c_count > cxx_count):
lang, flags = ("c", c_flags)
else:
lang, flags = ("c++", cxx_flags)
generate_conf(["-x", lang] + flags, config_file)
print("Created {} config file with {} {} flags".format(output_format.upper(), len(flags), lang.upper()))
def fake_build(project_dir, c_build_log_path, cxx_build_log_path, verbose, make_cmd, build_system, cc, cxx, out_of_tree, configure_opts, make_flags, preserve_environment, qt_version):
'''Builds the project using the fake toolchain, to collect the compiler flags.
project_dir: the directory containing the source files
build_log_path: the file to log commands to
verbose: show the build process output
make_cmd: the path of the make executable
cc: the path of the clang executable
cxx: the path of the clang++ executable
out_of_tree: perform an out-of-tree build (autotools only)
configure_opts: additional flags for configure stage
make_flags: additional flags for make
preserve_environment: pass environment variables to build processes
qt_version: The Qt version to use when building with qmake.
'''
# TODO: add Windows support
assert(not sys.platform.startswith("win32"))
fake_path = os.path.join(ycm_generator_dir, "fake-toolchain", "Unix")
# environment variables and arguments for build process
started = time.time()
FNULL = open(os.devnull, "w")
proc_opts = {} if verbose else {
"stdin": FNULL,
"stdout": FNULL,
"stderr": FNULL
}
proc_opts["cwd"] = project_dir
if(preserve_environment):
env = os.environ
else:
# Preserve HOME, since Cmake needs it to find some packages and it's
# normally there anyway. See #26.
env = dict(map(lambda x: (x, os.environ[x]), ["HOME"]))
env["PATH"] = "{}:{}".format(fake_path, os.environ["PATH"])
env["CC"] = "clang"
env["CXX"] = "clang++"
env["YCM_CONFIG_GEN_CC_LOG"] = c_build_log_path
env["YCM_CONFIG_GEN_CXX_LOG"] = cxx_build_log_path
# used during configuration stage, so that cmake, etc. can verify what the compiler supports
env_config = env.copy()
env_config["YCM_CONFIG_GEN_CC_PASSTHROUGH"] = cc
env_config["YCM_CONFIG_GEN_CXX_PASSTHROUGH"] = cxx
# use -i (ignore errors), since the makefile may include scripts which
# depend upon the existence of various output files
make_args = [make_cmd] + make_flags
# Used for the qmake build system below
pro_files = glob.glob(os.path.join(project_dir, "*.pro"))
# sanity check - make sure the toolchain is available
assert os.path.exists(fake_path), "Could not find toolchain at '{}'".format(fake_path)
# helper function to display exact commands used
def run(cmd, *args, **kwargs):
print("$ " + " ".join(cmd))
subprocess.call(cmd, *args, **kwargs)
if build_system is None:
if os.path.exists(os.path.join(project_dir, "CMakeLists.txt")):
build_system = "cmake"
elif os.path.exists(os.path.join(project_dir, "configure")):
build_system = "autotools"
elif pro_files:
build_system = "qmake"
elif any([os.path.exists(os.path.join(project_dir, x)) for x in ["GNUmakefile", "makefile", "Makefile"]]):
build_system = "make"
# execute the build system
if build_system == "cmake":
# cmake
# run cmake in a temporary directory, then compile the project as usual
build_dir = tempfile.mkdtemp()
proc_opts["cwd"] = build_dir
# if the project was built in-tree, we need to hide the cache file so that cmake
# populates the build dir instead of just re-generating the existing files
cache_path = os.path.join(project_dir, "CMakeCache.txt")
if(os.path.exists(cache_path)):
fd, cache_tmp = tempfile.mkstemp()
os.close(fd)
shutil.move(cache_path, cache_tmp)
else:
cache_tmp = None
print("Running cmake in '{}'...".format(build_dir))
sys.stdout.flush()
run(["cmake", project_dir] + configure_opts, env=env_config, **proc_opts)
print("\nRunning make...")
sys.stdout.flush()
run(make_args, env=env, **proc_opts)
print("\nCleaning up...")
print("")
sys.stdout.flush()
shutil.rmtree(build_dir)
if(cache_tmp):
shutil.move(cache_tmp, cache_path)
elif build_system == "autotools":
# autotools
# perform build in-tree, since not all projects handle out-of-tree builds correctly
if(out_of_tree):
build_dir = tempfile.mkdtemp()
proc_opts["cwd"] = build_dir
print("Configuring autotools in '{}'...".format(build_dir))
else:
print("Configuring autotools...")
run([os.path.join(project_dir, "configure")] + configure_opts, env=env_config, **proc_opts)
print("\nRunning make...")
run(make_args, env=env, **proc_opts)
print("\nCleaning up...")
if(out_of_tree):
print("")
shutil.rmtree(build_dir)
else:
run([make_cmd, "maintainer-clean"], env=env, **proc_opts)
elif build_system == "qmake":
# qmake
# make sure there is only one .pro file
if len(pro_files) != 1:
print("ERROR: Found {} .pro files (expected one): {}.".format(
len(pro_files), ', '.join(pro_files)))
sys.exit(1)
# run qmake in a temporary directory, then compile the project as usual
build_dir = tempfile.mkdtemp()
proc_opts["cwd"] = build_dir
env_config["QT_SELECT"] = qt_version
# QMAKESPEC is platform dependent - valid mkspecs are in
# /usr/share/qt4/mkspecs, /usr/lib64/qt5/mkspecs
env_config["QMAKESPEC"] = {
("Linux", True): "unsupported/linux-clang",
("Linux", False): "linux-clang",
("Darwin", True): "unsupported/macx-clang",
("Darwin", False): "macx-clang",
("FreeBSD", False): "unsupported/freebsd-clang",
}[(os.uname()[0], qt_version == "4")]
print("Running qmake in '{}' with Qt {}...".format(build_dir, qt_version))
run(["qmake"] + configure_opts + [pro_files[0]], env=env_config,
**proc_opts)
print("\nRunning make...")
run(make_args, env=env, **proc_opts)
print("\nCleaning up...")
print("")
shutil.rmtree(build_dir)
elif build_system == "make":
# make
# needs to be handled last, since other build systems can generate Makefiles
print("Preparing build directory...")
run([make_cmd, "clean"], env=env, **proc_opts)
print("\nRunning make...")
run(make_args, env=env, **proc_opts)
elif(os.path.exists(os.path.join(project_dir, "Make/options"))):
print("Found OpenFOAM Make/options")
# OpenFOAM build system
make_args = ["wmake"]
# Since icpc could not find directory in which g++ resides,
# set environmental variables to gcc to make fake_build operate normally.
env['WM_COMPILER']='Gcc'
env['WM_CC']='gcc'
env['WM_CXX']='g++'
print("\nRunning wmake...")
run(make_args, env=env, **proc_opts)
else:
print("ERROR: Unknown build system")
sys.exit(2)
print("Build completed in {} sec".format(round(time.time() - started, 2)))
print("")
def parse_flags(build_log):
'''Creates a list of compiler flags from the build log.
build_log: an iterator of lines
Returns: (line_count, skip_count, flags)
flags is a list, and the counts are integers
'''
# Used to ignore entries which result in temporary files, or don't fully
# compile the file
temp_output = re.compile("(-x assembler)|(-o ([a-zA-Z0-9._].tmp))|(/dev/null)")
skip_count = 0
# Flags we want:
# -includes (-i, -I)
# -defines (-D)
# -warnings (-Werror), but no assembler, etc. flags (-Wa,-option)
# -language (-std=gnu99) and standard library (-nostdlib)
# -word size (-m64)
flags_whitelist = ["-[iIDF].*", "-W[^,]*", "-std=[a-z0-9+]+", "-(no)?std(lib|inc)", "-m[0-9]+"]
flags_whitelist = re.compile("|".join(map("^{}$".format, flags_whitelist)))
flags = set()
line_count = 0
# macro definitions should be handled separately, so we can resolve duplicates
define_flags = dict()
define_regex = re.compile("-D([a-zA-Z0-9_]+)=(.*)")
# Used to only bundle filenames with applicable arguments
filename_flags = ["-o", "-I", "-isystem", "-iquote", "-include", "-imacros", "-isysroot"]
# Process build log
for line in build_log:
if(temp_output.search(line)):
skip_count += 1
continue
line_count += 1
words = split_flags(line)
for (i, word) in enumerate(words):
if(word[0] != '-' or not flags_whitelist.match(word)):
continue
# handle macro definitions
m = define_regex.match(word)
if(m):
if(m.group(1) not in define_flags):
define_flags[m.group(1)] = [m.group(2)]
elif(m.group(2) not in define_flags[m.group(1)]):
define_flags[m.group(1)].append(m.group(2))
continue
# include arguments for this option, if there are any, as a tuple
if(i != len(words) - 1 and word in filename_flags and words[i + 1][0] != '-'):
flags.add((word, words[i + 1]))
else:
flags.add(word)
# Only specify one word size (the largest)
# (Different sizes are used for different files in the linux kernel.)
mRegex = re.compile("^-m[0-9]+$")
word_flags = list([f for f in flags if isinstance(f, basestring) and mRegex.match(f)])
if(len(word_flags) > 1):
for flag in word_flags:
flags.remove(flag)
flags.add(max(word_flags))
# Resolve duplicate macro definitions (always choose the last value for consistency)
for name, values in define_flags.iteritems():
if(len(values) > 1):
print("WARNING: {} distinct definitions of macro {} found".format(len(values), name))
values.sort()
flags.add("-D{}={}".format(name, values[0]))
return (line_count, skip_count, sorted(flags))
def generate_cc_conf(flags, config_file):
'''Generates the .color_coded file
flags: the list of flags
config_file: the path to save the configuration file at'''
with open(config_file, "w") as output:
for flag in flags:
if(isinstance(flag, basestring)):
output.write(flag + "\n")
else: # is tuple
for f in flag:
output.write(f + "\n")
def generate_ycm_conf(flags, config_file):
'''Generates the .ycm_extra_conf.py.
flags: the list of flags
config_file: the path to save the configuration file at'''
template_file = os.path.join(ycm_generator_dir, "template.py")
with open(template_file, "r") as template:
with open(config_file, "w") as output:
output.write("# Generated by YCM Generator at {}\n\n".format(str(datetime.datetime.today())))
for line in template:
if(line == " # INSERT FLAGS HERE\n"):
# insert generated code
for flag in flags:
if(isinstance(flag, basestring)):
output.write(" '{}',\n".format(flag))
else: # is tuple
output.write(" '{}', '{}',\n".format(*flag))
else:
# copy template
output.write(line)
def split_flags(line):
'''Helper method that splits a string into flags.
Flags are space-seperated, except for spaces enclosed in quotes.
Returns a list of flags'''
# Pass 1: split line using whitespace
words = line.strip().split()
# Pass 2: merge words so that the no. of quotes is balanced
res = []
for w in words:
if(len(res) > 0 and unbalanced_quotes(res[-1])):
res[-1] += " " + w
else:
res.append(w)
return res
def unbalanced_quotes(s):
'''Helper method that returns True if the no. of single or double quotes in s is odd.'''
single = 0
double = 0
for c in s:
if(c == "'"):
single += 1
elif(c == '"'):
double += 1
return (single % 2 == 1 or double % 2 == 1)
if(__name__ == "__main__"):
# Note that sys.exit() lets us use None and 0 interchangably
sys.exit(main())

View file

@ -1,4 +0,0 @@
#!/bin/sh
# This script is needed because /bin/true does not exist on non-FHS-compliant distros. e.g. NixOS
exit 0

View file

@ -1,4 +0,0 @@
#!/bin/sh
# This script is needed because /bin/true does not exist on non-FHS-compliant distros. e.g. NixOS
exit 0

View file

@ -1,14 +0,0 @@
#!/bin/sh
if [ ! -z "$YCM_CONFIG_GEN_CC_PASSTHROUGH" ]; then
# Cmake determines compiler properties by compiling a test file, so call clang for this case
$YCM_CONFIG_GEN_CC_PASSTHROUGH $@
elif [ "$1" = "-v" ] || [ "$1" = "--version" ]; then
# Needed to enable clang-specific options for certain build systems (e.g. linux)
$YCM_CONFIG_GEN_CC_PASSTHROUGH $@
else
echo "$@" >> $YCM_CONFIG_GEN_CC_LOG
fi

View file

@ -1,14 +0,0 @@
#!/bin/sh
if [ ! -z "$YCM_CONFIG_GEN_CC_PASSTHROUGH" ]; then
# Cmake determines compiler properties by compiling a test file, so call clang for this case
$YCM_CONFIG_GEN_CC_PASSTHROUGH $@
elif [ "$1" = "-v" ] || [ "$1" = "--version" ]; then
# Needed to enable clang-specific options for certain build systems (e.g. linux)
$YCM_CONFIG_GEN_CC_PASSTHROUGH $@
else
echo "$@" >> $YCM_CONFIG_GEN_CC_LOG
fi

View file

@ -1,14 +0,0 @@
#!/bin/sh
if [ ! -z "$YCM_CONFIG_GEN_CC_PASSTHROUGH" ]; then
# Cmake determines compiler properties by compiling a test file, so call clang for this case
$YCM_CONFIG_GEN_CXX_PASSTHROUGH $@
elif [ "$1" = "-v" ] || [ "$1" = "--version" ]; then
# Needed to enable clang-specific options for certain build systems (e.g. linux)
$YCM_CONFIG_GEN_CXX_PASSTHROUGH $@
else
echo "$@" >> $YCM_CONFIG_GEN_CXX_LOG
fi

View file

@ -1,14 +0,0 @@
#!/bin/sh
if [ ! -z "$YCM_CONFIG_GEN_CC_PASSTHROUGH" ]; then
# Cmake determines compiler properties by compiling a test file, so call clang for this case
$YCM_CONFIG_GEN_CXX_PASSTHROUGH $@
elif [ "$1" = "-v" ] || [ "$1" = "--version" ]; then
# Needed to enable clang-specific options for certain build systems (e.g. linux)
$YCM_CONFIG_GEN_CXX_PASSTHROUGH $@
else
echo "$@" >> $YCM_CONFIG_GEN_CXX_LOG
fi

View file

@ -1,14 +0,0 @@
#!/bin/sh
if [ ! -z "$YCM_CONFIG_GEN_CC_PASSTHROUGH" ]; then
# Cmake determines compiler properties by compiling a test file, so call clang for this case
$YCM_CONFIG_GEN_CXX_PASSTHROUGH $@
elif [ "$1" = "-v" ] || [ "$1" = "--version" ]; then
# Needed to enable clang-specific options for certain build systems (e.g. linux)
$YCM_CONFIG_GEN_CXX_PASSTHROUGH $@
else
echo "$@" >> $YCM_CONFIG_GEN_CXX_LOG
fi

View file

@ -1,14 +0,0 @@
#!/bin/sh
if [ ! -z "$YCM_CONFIG_GEN_CC_PASSTHROUGH" ]; then
# Cmake determines compiler properties by compiling a test file, so call clang for this case
$YCM_CONFIG_GEN_CC_PASSTHROUGH $@
elif [ "$1" = "-v" ] || [ "$1" = "--version" ]; then
# Needed to enable clang-specific options for certain build systems (e.g. linux)
$YCM_CONFIG_GEN_CC_PASSTHROUGH $@
else
echo "$@" >> $YCM_CONFIG_GEN_CC_LOG
fi

View file

@ -1,14 +0,0 @@
#!/bin/sh
if [ ! -z "$YCM_CONFIG_GEN_CC_PASSTHROUGH" ]; then
# Cmake determines compiler properties by compiling a test file, so call clang for this case
$YCM_CONFIG_GEN_CXX_PASSTHROUGH $@
elif [ "$1" = "-v" ] || [ "$1" = "--version" ]; then
# Needed to enable clang-specific options for certain build systems (e.g. linux)
$YCM_CONFIG_GEN_CXX_PASSTHROUGH $@
else
echo "$@" >> $YCM_CONFIG_GEN_CXX_LOG
fi

View file

@ -1,4 +0,0 @@
#!/bin/sh
# This script is needed because /bin/true does not exist on non-FHS-compliant distros. e.g. NixOS
exit 0

View file

@ -1,4 +0,0 @@
#!/bin/sh
# This script is needed because /bin/true does not exist on non-FHS-compliant distros. e.g. NixOS
exit 0

View file

@ -1,4 +0,0 @@
#!/bin/sh
# This script is needed because /bin/true does not exist on non-FHS-compliant distros. e.g. NixOS
exit 0

View file

@ -1,23 +0,0 @@
let s:config_gen = expand("<sfile>:p:h:h") . "/config_gen.py"
command! -nargs=? -complete=file_in_path -bang CCGenerateConfig call s:GenerateConfig("cc", <bang>0, "<args>")
command! -nargs=? -complete=file_in_path -bang YcmGenerateConfig call s:GenerateConfig("ycm", <bang>0, "<args>")
function! s:GenerateConfig(fmt, overwrite, flags)
let l:cmd = "! " . s:config_gen . " -F " . a:fmt . " " . a:flags
if a:overwrite
let l:cmd = l:cmd . " -f"
endif
" Only append the working directory if the last option is a flag
let l:split_flags = split(a:flags)
if len(l:split_flags) == 0 || l:split_flags[-1] =~ "^-"
let l:cmd = l:cmd . " " . shellescape(getcwd())
endif
" Disable interactive prompts for consistency with Neovim
execute l:cmd . " </dev/null"
endfunction

View file

@ -1,142 +0,0 @@
# This file is NOT licensed under the GPLv3, which is the license for the rest
# of YouCompleteMe.
#
# Here's the license text for this file:
#
# This is free and unencumbered software released into the public domain.
#
# Anyone is free to copy, modify, publish, use, compile, sell, or
# distribute this software, either in source code form or as a compiled
# binary, for any purpose, commercial or non-commercial, and by any
# means.
#
# In jurisdictions that recognize copyright laws, the author or authors
# of this software dedicate any and all copyright interest in the
# software to the public domain. We make this dedication for the benefit
# of the public at large and to the detriment of our heirs and
# successors. We intend this dedication to be an overt act of
# relinquishment in perpetuity of all present and future rights to this
# software under copyright law.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
# IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.
#
# For more information, please refer to <http://unlicense.org/>
import os
import ycm_core
flags = [
# INSERT FLAGS HERE
]
# Set this to the absolute path to the folder (NOT the file!) containing the
# compile_commands.json file to use that instead of 'flags'. See here for
# more details: http://clang.llvm.org/docs/JSONCompilationDatabase.html
#
# You can get CMake to generate this file for you by adding:
# set( CMAKE_EXPORT_COMPILE_COMMANDS 1 )
# to your CMakeLists.txt file.
#
# Most projects will NOT need to set this to anything; you can just change the
# 'flags' list of compilation flags. Notice that YCM itself uses that approach.
compilation_database_folder = ''
if os.path.exists( compilation_database_folder ):
database = ycm_core.CompilationDatabase( compilation_database_folder )
else:
database = None
SOURCE_EXTENSIONS = [ '.C', '.cpp', '.cxx', '.cc', '.c', '.m', '.mm' ]
def DirectoryOfThisScript():
return os.path.dirname( os.path.abspath( __file__ ) )
def MakeRelativePathsInFlagsAbsolute( flags, working_directory ):
if not working_directory:
return list( flags )
new_flags = []
make_next_absolute = False
path_flags = [ '-isystem', '-I', '-iquote', '--sysroot=' ]
for flag in flags:
new_flag = flag
if make_next_absolute:
make_next_absolute = False
if not flag.startswith( '/' ):
new_flag = os.path.join( working_directory, flag )
for path_flag in path_flags:
if flag == path_flag:
make_next_absolute = True
break
if flag.startswith( path_flag ):
path = flag[ len( path_flag ): ]
new_flag = path_flag + os.path.join( working_directory, path )
break
if new_flag:
new_flags.append( new_flag )
return new_flags
def IsHeaderFile( filename ):
extension = os.path.splitext( filename )[ 1 ]
return extension in [ '.H', '.h', '.hxx', '.hpp', '.hh' ]
def GetCompilationInfoForFile( filename ):
# The compilation_commands.json file generated by CMake does not have entries
# for header files. So we do our best by asking the db for flags for a
# corresponding source file, if any. If one exists, the flags for that file
# should be good enough.
if IsHeaderFile( filename ):
basename = os.path.splitext( filename )[ 0 ]
for extension in SOURCE_EXTENSIONS:
replacement_file = basename + extension
if os.path.exists( replacement_file ):
compilation_info = database.GetCompilationInfoForFile(
replacement_file )
if compilation_info.compiler_flags_:
return compilation_info
return None
return database.GetCompilationInfoForFile( filename )
def FlagsForFile( filename, **kwargs ):
if database:
# Bear in mind that compilation_info.compiler_flags_ does NOT return a
# python list, but a "list-like" StringVec object
compilation_info = GetCompilationInfoForFile( filename )
if not compilation_info:
return None
final_flags = MakeRelativePathsInFlagsAbsolute(
compilation_info.compiler_flags_,
compilation_info.compiler_working_dir_ )
else:
relative_to = DirectoryOfThisScript()
final_flags = MakeRelativePathsInFlagsAbsolute( flags, relative_to )
return {
'flags': final_flags,
'do_cache': True
}
def Settings( **kwargs ):
language = kwargs[ 'language' ]
if language == 'cfamily':
return {
'flags': flags
}
return {}

View file

@ -1,27 +0,0 @@
# Copyright (c) 2016-present Sven Greb <development@svengreb.de>
# This source code is licensed under the MIT license found in the license file.
# Configurations for EditorConfig.
# See https://editorconfig.org/#file-format-details for more details.
# +--------------------+
# + Base Configuration +
# +--------------------+
root = true
[*]
charset = utf-8
end_of_line = lf
indent_size = 2
indent_style = space
insert_final_newline = true
max_line_length = 160
trim_trailing_whitespace = true
# +-----------+
# + Languages +
# +-----------+
# +--- Markdown ---+
[*.{md}]
max_line_length = off
trim_trailing_whitespace = false

View file

@ -1,12 +0,0 @@
# Copyright (c) 2016-present Sven Greb <development@svengreb.de>
# This source code is licensed under the MIT license found in the license file.
# Configuration to define attributes per path.
#
# References:
# 1. https://git-scm.com/docs/gitattributes
# 2. https://git-scm.com/book/en/v2/Customizing-Git-Git-Attributes#Keyword-Expansion
# Automatically perform line feed (LF) normalization for files detected as text and
# leave all files detected as binary untouched.
* text=auto eol=lf

View file

@ -1,14 +0,0 @@
# Copyright (c) 2016-present Sven Greb <development@svengreb.de>
# This source code is licensed under the MIT license found in the license file.
# Configuration for the GitHub feature to automatically request reviews from the code owners
# when a pull request changes any owned files.
#
# References:
# 1. https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners#codeowners-file-location
# 2. https://github.com/blog/2392-introducing-code-owners
# +----------------------+
# + Core Team Code Owner +
# +----------------------+
* @svengreb

View file

@ -1,10 +0,0 @@
# Copyright (c) 2016-present Sven Greb <development@svengreb.de>
# This source code is licensed under the MIT license found in the license file.
# Path match pattern to intentionally ignore untracked files and directories.
# See https://git-scm.com/docs/gitignore for more details.
# +---------+
# + Node.js +
# +---------+
**/node_modules/

View file

@ -1,8 +0,0 @@
# Copyright (c) 2016-present Sven Greb <development@svengreb.de>
# This source code is licensed under the MIT license found in the license file.
# Configuration for the Git mail mapping feature to coalesce together commits by the same person in the shortlog,
# where their name and/or email address was spelled differently or has been changed.
# See https://git-scm.com/docs/git-shortlog#_mapping_authors for more details.
Sven Greb <development@svengreb.de>
Sven Greb <development@svengreb.de> <development@arcticicestudio.com>

View file

@ -1,18 +0,0 @@
# Copyright (c) 2016-present Sven Greb <development@svengreb.de>
# This source code is licensed under the MIT license found in the license file.
# Configurations for npm.
# See https://docs.npmjs.com/cli/v7/configuring-npm/npmrc for more details.
# Only use a lockfile for single-consumer projects, like applications, but not for multi-consumer projects like
# libraries.
# It helps to pin dependency versions, improves the security through integrity checksums, prevents possible errors
# caused by updated transitive dependencies and allows to get deterministic build results, but it can hide problems in
# multi-consumer projects when any later versions of a used dependency, or its transitive dependencies, is not
# compatible with the own project anymore.
package-lock=true
# Do not resolve to the latest minor and patch updates.
# Automatically pin dependencies to exact versions instead of resolving to latest minor and patch updates.
# This prevents possible errors caused by updated transitive dependencies.
save-exact=true

View file

@ -1,94 +0,0 @@
" Copyright (c) 2016-present Sven Greb <development@svengreb.de>
" This source code is licensed under the MIT license found in the license file.
let s:nord_vim_version="0.19.0"
let g:airline#themes#nord#palette = {}
let s:nord0_gui = "#2E3440"
let s:nord1_gui = "#3B4252"
let s:nord2_gui = "#434C5E"
let s:nord3_gui = "#4C566A"
let s:nord4_gui = "#D8DEE9"
let s:nord5_gui = "#E5E9F0"
let s:nord6_gui = "#ECEFF4"
let s:nord7_gui = "#8FBCBB"
let s:nord8_gui = "#88C0D0"
let s:nord9_gui = "#81A1C1"
let s:nord10_gui = "#5E81AC"
let s:nord11_gui = "#BF616A"
let s:nord12_gui = "#D08770"
let s:nord13_gui = "#EBCB8B"
let s:nord14_gui = "#A3BE8C"
let s:nord15_gui = "#B48EAD"
let s:nord0_term = "NONE"
let s:nord1_term = "0"
let s:nord2_term = "NONE"
let s:nord4_term = "NONE"
let s:nord11_term = "1"
let s:nord14_term = "2"
let s:nord13_term = "3"
let s:nord9_term = "4"
let s:nord15_term = "5"
let s:nord8_term = "6"
let s:nord5_term = "7"
let s:nord3_term = "8"
let s:nord12_term = "11"
let s:nord10_term = "12"
let s:nord7_term = "14"
let s:nord6_term = "15"
let s:NMain = [s:nord1_gui, s:nord8_gui, s:nord1_term, s:nord8_term]
let s:NRight = [s:nord1_gui, s:nord9_gui, s:nord1_term, s:nord9_term]
let s:NMiddle = [s:nord5_gui, s:nord3_gui, s:nord5_term, s:nord3_term]
let s:NWarn = [s:nord1_gui, s:nord13_gui, s:nord3_term, s:nord13_term]
let s:NError = [s:nord0_gui, s:nord11_gui, s:nord1_term, s:nord11_term]
let g:airline#themes#nord#palette.normal = airline#themes#generate_color_map(s:NMain, s:NRight, s:NMiddle)
let g:airline#themes#nord#palette.normal.airline_warning = s:NWarn
let g:airline#themes#nord#palette.normal.airline_error = s:NError
let s:IMain = [s:nord1_gui, s:nord14_gui, s:nord1_term, s:nord6_term]
let s:IRight = [s:nord1_gui, s:nord9_gui, s:nord1_term, s:nord9_term]
let s:IMiddle = [s:nord5_gui, s:nord3_gui, s:nord5_term, s:nord3_term]
let s:IWarn = [s:nord1_gui, s:nord13_gui, s:nord3_term, s:nord13_term]
let s:IError = [s:nord0_gui, s:nord11_gui, s:nord1_term, s:nord11_term]
let g:airline#themes#nord#palette.insert = airline#themes#generate_color_map(s:IMain, s:IRight, s:IMiddle)
let g:airline#themes#nord#palette.insert.airline_warning = s:IWarn
let g:airline#themes#nord#palette.insert.airline_error = s:IError
let s:RMain = [s:nord1_gui, s:nord14_gui, s:nord1_term, s:nord14_term]
let s:RRight = [s:nord1_gui, s:nord9_gui, s:nord1_term, s:nord9_term]
let s:RMiddle = [s:nord5_gui, s:nord3_gui, s:nord5_term, s:nord3_term]
let s:RWarn = [s:nord1_gui, s:nord13_gui, s:nord3_term, s:nord13_term]
let s:RError = [s:nord0_gui, s:nord11_gui, s:nord1_term, s:nord11_term]
let g:airline#themes#nord#palette.replace = airline#themes#generate_color_map(s:RMain, s:RRight, s:RMiddle)
let g:airline#themes#nord#palette.replace.airline_warning = s:RWarn
let g:airline#themes#nord#palette.replace.airline_error = s:RError
let s:VMain = [s:nord1_gui, s:nord7_gui, s:nord1_term, s:nord7_term]
let s:VRight = [s:nord1_gui, s:nord9_gui, s:nord1_term, s:nord9_term]
let s:VMiddle = [s:nord5_gui, s:nord3_gui, s:nord5_term, s:nord3_term]
let s:VWarn = [s:nord1_gui, s:nord13_gui, s:nord3_term, s:nord13_term]
let s:VError = [s:nord0_gui, s:nord11_gui, s:nord1_term, s:nord11_term]
let g:airline#themes#nord#palette.visual = airline#themes#generate_color_map(s:VMain, s:VRight, s:VMiddle)
let g:airline#themes#nord#palette.visual.airline_warning = s:VWarn
let g:airline#themes#nord#palette.visual.airline_error = s:VError
let s:IAMain = [s:nord5_gui, s:nord3_gui, s:nord5_term, s:nord3_term]
let s:IARight = [s:nord5_gui, s:nord3_gui, s:nord5_term, s:nord3_term]
if g:nord_uniform_status_lines == 0
let s:IAMiddle = [s:nord5_gui, s:nord1_gui, s:nord5_term, s:nord1_term]
else
let s:IAMiddle = [s:nord5_gui, s:nord3_gui, s:nord5_term, s:nord3_term]
endif
let s:IAWarn = [s:nord1_gui, s:nord13_gui, s:nord3_term, s:nord13_term]
let s:IAError = [s:nord0_gui, s:nord11_gui, s:nord1_term, s:nord11_term]
let g:airline#themes#nord#palette.inactive = airline#themes#generate_color_map(s:IAMain, s:IARight, s:IAMiddle)
let g:airline#themes#nord#palette.inactive.airline_warning = s:IAWarn
let g:airline#themes#nord#palette.inactive.airline_error = s:IAError
let g:airline#themes#nord#palette.normal.airline_term = s:NMiddle
let g:airline#themes#nord#palette.insert.airline_term = s:IMiddle
let g:airline#themes#nord#palette.replace.airline_term = s:RMiddle
let g:airline#themes#nord#palette.visual.airline_term = s:VMiddle
let g:airline#themes#nord#palette.inactive.airline_term = s:IAMiddle

View file

@ -1,43 +0,0 @@
" Copyright (c) 2016-present Sven Greb <development@svengreb.de>
" This source code is licensed under the MIT license found in the license file.
let s:nord_vim_version="0.19.0"
let s:p = {'normal': {}, 'inactive': {}, 'insert': {}, 'replace': {}, 'visual': {}, 'tabline': {}}
let s:nord0 = ["#2E3440", "NONE"]
let s:nord1 = ["#3B4252", 0]
let s:nord2 = ["#434C5E", "NONE"]
let s:nord3 = ["#4C566A", 8]
let s:nord4 = ["#D8DEE9", "NONE"]
let s:nord5 = ["#E5E9F0", 7]
let s:nord6 = ["#ECEFF4", 15]
let s:nord7 = ["#8FBCBB", 14]
let s:nord8 = ["#88C0D0", 6]
let s:nord9 = ["#81A1C1", 4]
let s:nord10 = ["#5E81AC", 12]
let s:nord11 = ["#BF616A", 1]
let s:nord12 = ["#D08770", 11]
let s:nord13 = ["#EBCB8B", 3]
let s:nord14 = ["#A3BE8C", 2]
let s:nord15 = ["#B48EAD", 5]
let s:p.normal.left = [ [ s:nord1, s:nord8 ], [ s:nord5, s:nord1 ] ]
let s:p.normal.middle = [ [ s:nord5, s:nord3 ] ]
let s:p.normal.right = [ [ s:nord5, s:nord1 ], [ s:nord5, s:nord1 ] ]
let s:p.normal.warning = [ [ s:nord1, s:nord13 ] ]
let s:p.normal.error = [ [ s:nord1, s:nord11 ] ]
let s:p.inactive.left = [ [ s:nord1, s:nord8 ], [ s:nord5, s:nord1 ] ]
let s:p.inactive.middle = g:nord_uniform_status_lines == 0 ? [ [ s:nord5, s:nord1 ] ] : [ [ s:nord5, s:nord3 ] ]
let s:p.inactive.right = [ [ s:nord5, s:nord1 ], [ s:nord5, s:nord1 ] ]
let s:p.insert.left = [ [ s:nord1, s:nord6 ], [ s:nord5, s:nord1 ] ]
let s:p.replace.left = [ [ s:nord1, s:nord13 ], [ s:nord5, s:nord1 ] ]
let s:p.visual.left = [ [ s:nord1, s:nord7 ], [ s:nord5, s:nord1 ] ]
let s:p.tabline.left = [ [ s:nord5, s:nord3 ] ]
let s:p.tabline.middle = [ [ s:nord5, s:nord3 ] ]
let s:p.tabline.right = [ [ s:nord5, s:nord3 ] ]
let s:p.tabline.tabsel = [ [ s:nord1, s:nord8 ] ]
let g:lightline#colorscheme#nord#palette = lightline#colorscheme#flatten(s:p)

File diff suppressed because it is too large Load diff

View file

@ -1,838 +0,0 @@
" Copyright (c) 2016-present Sven Greb <development@svengreb.de>
" This source code is licensed under the MIT license found in the license file.
if version > 580
hi clear
if exists("syntax_on")
syntax reset
endif
endif
let g:colors_name = "nord"
let s:nord_vim_version="0.19.0"
set background=dark
let s:nord0_gui = "#2E3440"
let s:nord1_gui = "#3B4252"
let s:nord2_gui = "#434C5E"
let s:nord3_gui = "#4C566A"
let s:nord3_gui_bright = "#616E88"
let s:nord4_gui = "#D8DEE9"
let s:nord5_gui = "#E5E9F0"
let s:nord6_gui = "#ECEFF4"
let s:nord7_gui = "#8FBCBB"
let s:nord8_gui = "#88C0D0"
let s:nord9_gui = "#81A1C1"
let s:nord10_gui = "#5E81AC"
let s:nord11_gui = "#BF616A"
let s:nord12_gui = "#D08770"
let s:nord13_gui = "#EBCB8B"
let s:nord14_gui = "#A3BE8C"
let s:nord15_gui = "#B48EAD"
let s:nord1_term = "0"
let s:nord3_term = "8"
let s:nord5_term = "7"
let s:nord6_term = "15"
let s:nord7_term = "14"
let s:nord8_term = "6"
let s:nord9_term = "4"
let s:nord10_term = "12"
let s:nord11_term = "1"
let s:nord12_term = "11"
let s:nord13_term = "3"
let s:nord14_term = "2"
let s:nord15_term = "5"
let s:nord3_gui_brightened = [
\ s:nord3_gui,
\ "#4e586d",
\ "#505b70",
\ "#525d73",
\ "#556076",
\ "#576279",
\ "#59647c",
\ "#5b677f",
\ "#5d6982",
\ "#5f6c85",
\ "#616e88",
\ "#63718b",
\ "#66738e",
\ "#687591",
\ "#6a7894",
\ "#6d7a96",
\ "#6f7d98",
\ "#72809a",
\ "#75829c",
\ "#78859e",
\ "#7b88a1",
\ ]
let g:nord_bold = get(g:, "nord_bold", 1)
let s:bold = (g:nord_bold == 0) ? "" : "bold,"
let g:nord_underline = get(g:, "nord_underline", 1)
let s:underline = (g:nord_underline == 0) ? "NONE," : "underline,"
let g:nord_italic = get(g:, "nord_italic", (has("gui_running") || $TERM_ITALICS == "true"))
let s:italic = (g:nord_italic == 0) ? "" : "italic,"
let g:nord_italic_comments = get(g:, "nord_italic_comments", 0)
let s:italicize_comments = (g:nord_italic_comments == 0) ? "" : get(s:, "italic")
let g:nord_uniform_status_lines = get(g:, "nord_uniform_status_lines", 0)
let g:nord_bold_vertical_split_line = get(g:, "nord_bold_vertical_split_line", 0)
if exists("g:nord_comment_brightness")
echohl WarningMsg
echomsg 'nord: warning: Variable g:nord_comment_brightness has been deprecated and will be removed in version 1.0.0!' .
\' The comment color brightness has been increased by 10% by default.' .
\' Please see https://github.com/nordtheme/vim/issues/145 for more details.'
echohl None
let g:nord_comment_brightness = 10
endif
let g:nord_cursor_line_number_background = get(g:, "nord_cursor_line_number_background", 0)
let g:nord_uniform_diff_background = get(g:, "nord_uniform_diff_background", 0)
function! s:hi(group, guifg, guibg, ctermfg, ctermbg, attr, guisp)
let cmd = ""
if a:guifg != ""
let cmd = cmd . " guifg=" . a:guifg
endif
if a:guibg != ""
let cmd = cmd . " guibg=" . a:guibg
endif
if a:ctermfg != ""
let cmd = cmd . " ctermfg=" . a:ctermfg
endif
if a:ctermbg != ""
let cmd = cmd . " ctermbg=" . a:ctermbg
endif
if a:attr != ""
let cmd = cmd . " gui=" . a:attr . " cterm=" . substitute(a:attr, "undercurl", s:underline, "")
endif
if a:guisp != ""
let cmd = cmd . " guisp=" . a:guisp
endif
if cmd != ""
exec "hi " . a:group . cmd
endif
endfunction
"+---------------+
"+ UI Components +
"+---------------+
"+--- Attributes ---+
call s:hi("Bold", "", "", "", "", s:bold, "")
call s:hi("Italic", "", "", "", "", s:italic, "")
call s:hi("Underline", "", "", "", "", s:underline, "")
"+--- Editor ---+
call s:hi("ColorColumn", "", s:nord1_gui, "NONE", s:nord1_term, "", "")
call s:hi("Cursor", s:nord0_gui, s:nord4_gui, "", "NONE", "", "")
call s:hi("CursorLine", "", s:nord1_gui, "NONE", s:nord1_term, "NONE", "")
call s:hi("Error", s:nord4_gui, s:nord11_gui, "", s:nord11_term, "", "")
call s:hi("iCursor", s:nord0_gui, s:nord4_gui, "", "NONE", "", "")
call s:hi("LineNr", s:nord3_gui, "NONE", s:nord3_term, "NONE", "", "")
call s:hi("MatchParen", s:nord8_gui, s:nord3_gui, s:nord8_term, s:nord3_term, "", "")
call s:hi("NonText", s:nord2_gui, "", s:nord3_term, "", "", "")
call s:hi("Normal", s:nord4_gui, s:nord0_gui, "NONE", "NONE", "", "")
call s:hi("Pmenu", s:nord4_gui, s:nord2_gui, "NONE", s:nord1_term, "NONE", "")
call s:hi("PmenuSbar", s:nord4_gui, s:nord2_gui, "NONE", s:nord1_term, "", "")
call s:hi("PmenuSel", s:nord8_gui, s:nord3_gui, s:nord8_term, s:nord3_term, "", "")
call s:hi("PmenuThumb", s:nord8_gui, s:nord3_gui, "NONE", s:nord3_term, "", "")
call s:hi("SpecialKey", s:nord3_gui, "", s:nord3_term, "", "", "")
call s:hi("SpellBad", s:nord11_gui, s:nord0_gui, s:nord11_term, "NONE", "undercurl", s:nord11_gui)
call s:hi("SpellCap", s:nord13_gui, s:nord0_gui, s:nord13_term, "NONE", "undercurl", s:nord13_gui)
call s:hi("SpellLocal", s:nord5_gui, s:nord0_gui, s:nord5_term, "NONE", "undercurl", s:nord5_gui)
call s:hi("SpellRare", s:nord6_gui, s:nord0_gui, s:nord6_term, "NONE", "undercurl", s:nord6_gui)
call s:hi("Visual", "", s:nord2_gui, "", s:nord1_term, "", "")
call s:hi("VisualNOS", "", s:nord2_gui, "", s:nord1_term, "", "")
"+- Vim 8 Terminal Colors -+
if has('terminal')
let g:terminal_ansi_colors = [s:nord1_gui, s:nord11_gui, s:nord14_gui, s:nord13_gui, s:nord9_gui, s:nord15_gui, s:nord8_gui, s:nord5_gui, s:nord3_gui, s:nord11_gui, s:nord14_gui, s:nord13_gui, s:nord9_gui, s:nord15_gui, s:nord7_gui, s:nord6_gui]
endif
if has('nvim')
"+- Neovim Terminal Colors -+
let g:terminal_color_0 = s:nord1_gui
let g:terminal_color_1 = s:nord11_gui
let g:terminal_color_2 = s:nord14_gui
let g:terminal_color_3 = s:nord13_gui
let g:terminal_color_4 = s:nord9_gui
let g:terminal_color_5 = s:nord15_gui
let g:terminal_color_6 = s:nord8_gui
let g:terminal_color_7 = s:nord5_gui
let g:terminal_color_8 = s:nord3_gui
let g:terminal_color_9 = s:nord11_gui
let g:terminal_color_10 = s:nord14_gui
let g:terminal_color_11 = s:nord13_gui
let g:terminal_color_12 = s:nord9_gui
let g:terminal_color_13 = s:nord15_gui
let g:terminal_color_14 = s:nord7_gui
let g:terminal_color_15 = s:nord6_gui
"+- Neovim Support -+
call s:hi("healthError", s:nord11_gui, s:nord1_gui, s:nord11_term, s:nord1_term, "", "")
call s:hi("healthSuccess", s:nord14_gui, s:nord1_gui, s:nord14_term, s:nord1_term, "", "")
call s:hi("healthWarning", s:nord13_gui, s:nord1_gui, s:nord13_term, s:nord1_term, "", "")
call s:hi("TermCursorNC", "", s:nord1_gui, "", s:nord1_term, "", "")
"+- Neovim Diagnostics API -+
call s:hi("DiagnosticWarn", s:nord13_gui, "", s:nord13_term, "", "", "")
call s:hi("DiagnosticError" , s:nord11_gui, "", s:nord11_term, "", "", "")
call s:hi("DiagnosticInfo" , s:nord8_gui, "", s:nord8_term, "", "", "")
call s:hi("DiagnosticHint" , s:nord10_gui, "", s:nord10_term, "", "", "")
call s:hi("DiagnosticUnderlineWarn" , s:nord13_gui, "", s:nord13_term, "", "undercurl", "")
call s:hi("DiagnosticUnderlineError" , s:nord11_gui, "", s:nord11_term, "", "undercurl", "")
call s:hi("DiagnosticUnderlineInfo" , s:nord8_gui, "", s:nord8_term, "", "undercurl", "")
call s:hi("DiagnosticUnderlineHint" , s:nord10_gui, "", s:nord10_term, "", "undercurl", "")
"+- Neovim DocumentHighlight -+
call s:hi("LspReferenceText", "", s:nord3_gui, "", s:nord3_term, "", "")
call s:hi("LspReferenceRead", "", s:nord3_gui, "", s:nord3_term, "", "")
call s:hi("LspReferenceWrite", "", s:nord3_gui, "", s:nord3_term, "", "")
"+- Neovim LspSignatureHelp -+
call s:hi("LspSignatureActiveParameter", s:nord8_gui, "", s:nord8_term, "", s:underline, "")
endif
"+--- Gutter ---+
call s:hi("CursorColumn", "", s:nord1_gui, "NONE", s:nord1_term, "", "")
if g:nord_cursor_line_number_background == 0
call s:hi("CursorLineNr", s:nord4_gui, "", "NONE", "", "NONE", "")
else
call s:hi("CursorLineNr", s:nord4_gui, s:nord1_gui, "NONE", s:nord1_term, "NONE", "")
endif
call s:hi("Folded", s:nord3_gui, s:nord1_gui, s:nord3_term, s:nord1_term, s:bold, "")
call s:hi("FoldColumn", s:nord3_gui, s:nord0_gui, s:nord3_term, "NONE", "", "")
call s:hi("SignColumn", s:nord1_gui, s:nord0_gui, s:nord1_term, "NONE", "", "")
"+--- Navigation ---+
call s:hi("Directory", s:nord8_gui, "", s:nord8_term, "NONE", "", "")
"+--- Prompt/Status ---+
call s:hi("EndOfBuffer", s:nord1_gui, "", s:nord1_term, "NONE", "", "")
call s:hi("ErrorMsg", s:nord4_gui, s:nord11_gui, "NONE", s:nord11_term, "", "")
call s:hi("ModeMsg", s:nord4_gui, "", "", "", "", "")
call s:hi("MoreMsg", s:nord8_gui, "", s:nord8_term, "", "", "")
call s:hi("Question", s:nord4_gui, "", "NONE", "", "", "")
if g:nord_uniform_status_lines == 0
call s:hi("StatusLine", s:nord8_gui, s:nord3_gui, s:nord8_term, s:nord3_term, "NONE", "")
call s:hi("StatusLineNC", s:nord4_gui, s:nord1_gui, "NONE", s:nord1_term, "NONE", "")
call s:hi("StatusLineTerm", s:nord8_gui, s:nord3_gui, s:nord8_term, s:nord3_term, "NONE", "")
call s:hi("StatusLineTermNC", s:nord4_gui, s:nord1_gui, "NONE", s:nord1_term, "NONE", "")
else
call s:hi("StatusLine", s:nord8_gui, s:nord3_gui, s:nord8_term, s:nord3_term, "NONE", "")
call s:hi("StatusLineNC", s:nord4_gui, s:nord3_gui, "NONE", s:nord3_term, "NONE", "")
call s:hi("StatusLineTerm", s:nord8_gui, s:nord3_gui, s:nord8_term, s:nord3_term, "NONE", "")
call s:hi("StatusLineTermNC", s:nord4_gui, s:nord3_gui, "NONE", s:nord3_term, "NONE", "")
endif
call s:hi("WarningMsg", s:nord0_gui, s:nord13_gui, s:nord1_term, s:nord13_term, "", "")
call s:hi("WildMenu", s:nord8_gui, s:nord1_gui, s:nord8_term, s:nord1_term, "", "")
"+--- Search ---+
call s:hi("IncSearch", s:nord6_gui, s:nord10_gui, s:nord6_term, s:nord10_term, s:underline, "")
call s:hi("Search", s:nord1_gui, s:nord8_gui, s:nord1_term, s:nord8_term, "NONE", "")
"+--- Tabs ---+
call s:hi("TabLine", s:nord4_gui, s:nord1_gui, "NONE", s:nord1_term, "NONE", "")
call s:hi("TabLineFill", s:nord4_gui, s:nord1_gui, "NONE", s:nord1_term, "NONE", "")
call s:hi("TabLineSel", s:nord8_gui, s:nord3_gui, s:nord8_term, s:nord3_term, "NONE", "")
"+--- Window ---+
call s:hi("Title", s:nord4_gui, "", "NONE", "", "NONE", "")
if g:nord_bold_vertical_split_line == 0
call s:hi("VertSplit", s:nord2_gui, s:nord0_gui, s:nord3_term, "NONE", "NONE", "")
else
call s:hi("VertSplit", s:nord2_gui, s:nord1_gui, s:nord3_term, s:nord1_term, "NONE", "")
endif
"+----------------------+
"+ Language Base Groups +
"+----------------------+
call s:hi("Boolean", s:nord9_gui, "", s:nord9_term, "", "", "")
call s:hi("Character", s:nord14_gui, "", s:nord14_term, "", "", "")
call s:hi("Comment", s:nord3_gui_bright, "", s:nord3_term, "", s:italicize_comments, "")
call s:hi("Conceal", "", "NONE", "", "NONE", "", "")
call s:hi("Conditional", s:nord9_gui, "", s:nord9_term, "", "", "")
call s:hi("Constant", s:nord4_gui, "", "NONE", "", "", "")
call s:hi("Decorator", s:nord12_gui, "", s:nord12_term, "", "", "")
call s:hi("Define", s:nord9_gui, "", s:nord9_term, "", "", "")
call s:hi("Delimiter", s:nord6_gui, "", s:nord6_term, "", "", "")
call s:hi("Exception", s:nord9_gui, "", s:nord9_term, "", "", "")
call s:hi("Float", s:nord15_gui, "", s:nord15_term, "", "", "")
call s:hi("Function", s:nord8_gui, "", s:nord8_term, "", "", "")
call s:hi("Identifier", s:nord4_gui, "", "NONE", "", "NONE", "")
call s:hi("Include", s:nord9_gui, "", s:nord9_term, "", "", "")
call s:hi("Keyword", s:nord9_gui, "", s:nord9_term, "", "", "")
call s:hi("Label", s:nord9_gui, "", s:nord9_term, "", "", "")
call s:hi("Number", s:nord15_gui, "", s:nord15_term, "", "", "")
call s:hi("Operator", s:nord9_gui, "", s:nord9_term, "", "NONE", "")
call s:hi("PreProc", s:nord9_gui, "", s:nord9_term, "", "NONE", "")
call s:hi("Repeat", s:nord9_gui, "", s:nord9_term, "", "", "")
call s:hi("Special", s:nord4_gui, "", "NONE", "", "", "")
call s:hi("SpecialChar", s:nord13_gui, "", s:nord13_term, "", "", "")
call s:hi("SpecialComment", s:nord8_gui, "", s:nord8_term, "", s:italicize_comments, "")
call s:hi("Statement", s:nord9_gui, "", s:nord9_term, "", "", "")
call s:hi("StorageClass", s:nord9_gui, "", s:nord9_term, "", "", "")
call s:hi("String", s:nord14_gui, "", s:nord14_term, "", "", "")
call s:hi("Structure", s:nord9_gui, "", s:nord9_term, "", "", "")
call s:hi("Tag", s:nord4_gui, "", "", "", "", "")
call s:hi("Todo", s:nord13_gui, "NONE", s:nord13_term, "NONE", "", "")
call s:hi("Type", s:nord9_gui, "", s:nord9_term, "", "NONE", "")
call s:hi("Typedef", s:nord9_gui, "", s:nord9_term, "", "", "")
hi! link Annotation Decorator
hi! link Macro Define
hi! link PreCondit PreProc
hi! link Variable Identifier
"+-----------+
"+ Languages +
"+-----------+
call s:hi("asciidocAttributeEntry", s:nord10_gui, "", s:nord10_term, "", "", "")
call s:hi("asciidocAttributeList", s:nord10_gui, "", s:nord10_term, "", "", "")
call s:hi("asciidocAttributeRef", s:nord10_gui, "", s:nord10_term, "", "", "")
call s:hi("asciidocHLabel", s:nord9_gui, "", s:nord9_term, "", "", "")
call s:hi("asciidocListingBlock", s:nord7_gui, "", s:nord7_term, "", "", "")
call s:hi("asciidocMacroAttributes", s:nord8_gui, "", s:nord8_term, "", "", "")
call s:hi("asciidocOneLineTitle", s:nord8_gui, "", s:nord8_term, "", "", "")
call s:hi("asciidocPassthroughBlock", s:nord9_gui, "", s:nord9_term, "", "", "")
call s:hi("asciidocQuotedMonospaced", s:nord7_gui, "", s:nord7_term, "", "", "")
call s:hi("asciidocTriplePlusPassthrough", s:nord7_gui, "", s:nord7_term, "", "", "")
hi! link asciidocAdmonition Keyword
hi! link asciidocAttributeRef markdownH1
hi! link asciidocBackslash Keyword
hi! link asciidocMacro Keyword
hi! link asciidocQuotedBold Bold
hi! link asciidocQuotedEmphasized Italic
hi! link asciidocQuotedMonospaced2 asciidocQuotedMonospaced
hi! link asciidocQuotedUnconstrainedBold asciidocQuotedBold
hi! link asciidocQuotedUnconstrainedEmphasized asciidocQuotedEmphasized
hi! link asciidocURL markdownLinkText
call s:hi("awkCharClass", s:nord7_gui, "", s:nord7_term, "", "", "")
call s:hi("awkPatterns", s:nord9_gui, "", s:nord9_term, "", s:bold, "")
hi! link awkArrayElement Identifier
hi! link awkBoolLogic Keyword
hi! link awkBrktRegExp SpecialChar
hi! link awkComma Delimiter
hi! link awkExpression Keyword
hi! link awkFieldVars Identifier
hi! link awkLineSkip Keyword
hi! link awkOperator Operator
hi! link awkRegExp SpecialChar
hi! link awkSearch Keyword
hi! link awkSemicolon Delimiter
hi! link awkSpecialCharacter SpecialChar
hi! link awkSpecialPrintf SpecialChar
hi! link awkVariables Identifier
call s:hi("cIncluded", s:nord7_gui, "", s:nord7_term, "", "", "")
hi! link cOperator Operator
hi! link cPreCondit PreCondit
hi! link cConstant Type
call s:hi("cmakeGeneratorExpression", s:nord10_gui, "", s:nord10_term, "", "", "")
hi! link csPreCondit PreCondit
hi! link csType Type
hi! link csXmlTag SpecialComment
call s:hi("cssAttributeSelector", s:nord7_gui, "", s:nord7_term, "", "", "")
call s:hi("cssDefinition", s:nord7_gui, "", s:nord7_term, "", "NONE", "")
call s:hi("cssIdentifier", s:nord7_gui, "", s:nord7_term, "", s:underline, "")
call s:hi("cssStringQ", s:nord7_gui, "", s:nord7_term, "", "", "")
hi! link cssAttr Keyword
hi! link cssBraces Delimiter
hi! link cssClassName cssDefinition
hi! link cssColor Number
hi! link cssProp cssDefinition
hi! link cssPseudoClass cssDefinition
hi! link cssPseudoClassId cssPseudoClass
hi! link cssVendor Keyword
call s:hi("dosiniHeader", s:nord8_gui, "", s:nord8_term, "", "", "")
hi! link dosiniLabel Type
call s:hi("dtBooleanKey", s:nord7_gui, "", s:nord7_term, "", "", "")
call s:hi("dtExecKey", s:nord7_gui, "", s:nord7_term, "", "", "")
call s:hi("dtLocaleKey", s:nord7_gui, "", s:nord7_term, "", "", "")
call s:hi("dtNumericKey", s:nord7_gui, "", s:nord7_term, "", "", "")
call s:hi("dtTypeKey", s:nord7_gui, "", s:nord7_term, "", "", "")
hi! link dtDelim Delimiter
hi! link dtLocaleValue Keyword
hi! link dtTypeValue Keyword
if g:nord_uniform_diff_background == 0
call s:hi("DiffAdd", s:nord14_gui, s:nord0_gui, s:nord14_term, "NONE", "inverse", "")
call s:hi("DiffChange", s:nord13_gui, s:nord0_gui, s:nord13_term, "NONE", "inverse", "")
call s:hi("DiffDelete", s:nord11_gui, s:nord0_gui, s:nord11_term, "NONE", "inverse", "")
call s:hi("DiffText", s:nord9_gui, s:nord0_gui, s:nord9_term, "NONE", "inverse", "")
else
call s:hi("DiffAdd", s:nord14_gui, s:nord1_gui, s:nord14_term, s:nord1_term, "", "")
call s:hi("DiffChange", s:nord13_gui, s:nord1_gui, s:nord13_term, s:nord1_term, "", "")
call s:hi("DiffDelete", s:nord11_gui, s:nord1_gui, s:nord11_term, s:nord1_term, "", "")
call s:hi("DiffText", s:nord9_gui, s:nord1_gui, s:nord9_term, s:nord1_term, "", "")
endif
" Legacy groups for official git.vim and diff.vim syntax
hi! link diffAdded DiffAdd
hi! link diffChanged DiffChange
hi! link diffRemoved DiffDelete
call s:hi("gitconfigVariable", s:nord7_gui, "", s:nord7_term, "", "", "")
call s:hi("goBuiltins", s:nord7_gui, "", s:nord7_term, "", "", "")
hi! link goConstants Keyword
call s:hi("helpBar", s:nord3_gui, "", s:nord3_term, "", "", "")
call s:hi("helpHyperTextJump", s:nord8_gui, "", s:nord8_term, "", s:underline, "")
call s:hi("htmlArg", s:nord7_gui, "", s:nord7_term, "", "", "")
call s:hi("htmlLink", s:nord4_gui, "", "", "", "NONE", "NONE")
hi! link htmlBold Bold
hi! link htmlEndTag htmlTag
hi! link htmlItalic Italic
hi! link htmlH1 markdownH1
hi! link htmlH2 markdownH1
hi! link htmlH3 markdownH1
hi! link htmlH4 markdownH1
hi! link htmlH5 markdownH1
hi! link htmlH6 markdownH1
hi! link htmlSpecialChar SpecialChar
hi! link htmlTag Keyword
hi! link htmlTagN htmlTag
call s:hi("javaDocTags", s:nord7_gui, "", s:nord7_term, "", "", "")
hi! link javaCommentTitle Comment
hi! link javaScriptBraces Delimiter
hi! link javaScriptIdentifier Keyword
hi! link javaScriptNumber Number
call s:hi("jsonKeyword", s:nord7_gui, "", s:nord7_term, "", "", "")
call s:hi("lessClass", s:nord7_gui, "", s:nord7_term, "", "", "")
hi! link lessAmpersand Keyword
hi! link lessCssAttribute Delimiter
hi! link lessFunction Function
hi! link cssSelectorOp Keyword
hi! link lispAtomBarSymbol SpecialChar
hi! link lispAtomList SpecialChar
hi! link lispAtomMark Keyword
hi! link lispBarSymbol SpecialChar
hi! link lispFunc Function
hi! link luaFunc Function
call s:hi("markdownBlockquote", s:nord7_gui, "", s:nord7_term, "", "", "")
call s:hi("markdownCode", s:nord7_gui, "", s:nord7_term, "", "", "")
call s:hi("markdownCodeDelimiter", s:nord7_gui, "", s:nord7_term, "", "", "")
call s:hi("markdownFootnote", s:nord7_gui, "", s:nord7_term, "", "", "")
call s:hi("markdownId", s:nord7_gui, "", s:nord7_term, "", "", "")
call s:hi("markdownIdDeclaration", s:nord7_gui, "", s:nord7_term, "", "", "")
call s:hi("markdownH1", s:nord8_gui, "", s:nord8_term, "", "", "")
call s:hi("markdownLinkText", s:nord8_gui, "", s:nord8_term, "", "", "")
call s:hi("markdownUrl", s:nord4_gui, "", "NONE", "", "NONE", "")
hi! link markdownBold Bold
hi! link markdownBoldDelimiter Keyword
hi! link markdownFootnoteDefinition markdownFootnote
hi! link markdownH2 markdownH1
hi! link markdownH3 markdownH1
hi! link markdownH4 markdownH1
hi! link markdownH5 markdownH1
hi! link markdownH6 markdownH1
hi! link markdownIdDelimiter Keyword
hi! link markdownItalic Italic
hi! link markdownItalicDelimiter Keyword
hi! link markdownLinkDelimiter Keyword
hi! link markdownLinkTextDelimiter Keyword
hi! link markdownListMarker Keyword
hi! link markdownRule Keyword
hi! link markdownHeadingDelimiter Keyword
call s:hi("perlPackageDecl", s:nord7_gui, "", s:nord7_term, "", "", "")
call s:hi("phpClasses", s:nord7_gui, "", s:nord7_term, "", "", "")
call s:hi("phpDocTags", s:nord7_gui, "", s:nord7_term, "", "", "")
hi! link phpDocCustomTags phpDocTags
hi! link phpMemberSelector Keyword
call s:hi("podCmdText", s:nord7_gui, "", s:nord7_term, "", "", "")
call s:hi("podVerbatimLine", s:nord4_gui, "", "NONE", "", "", "")
hi! link podFormat Keyword
hi! link pythonBuiltin Type
hi! link pythonEscape SpecialChar
call s:hi("rubyConstant", s:nord7_gui, "", s:nord7_term, "", "", "")
call s:hi("rubySymbol", s:nord6_gui, "", s:nord6_term, "", s:bold, "")
hi! link rubyAttribute Identifier
hi! link rubyBlockParameterList Operator
hi! link rubyInterpolationDelimiter Keyword
hi! link rubyKeywordAsMethod Function
hi! link rubyLocalVariableOrMethod Function
hi! link rubyPseudoVariable Keyword
hi! link rubyRegexp SpecialChar
call s:hi("rustAttribute", s:nord10_gui, "", s:nord10_term, "", "", "")
call s:hi("rustEnum", s:nord7_gui, "", s:nord7_term, "", s:bold, "")
call s:hi("rustMacro", s:nord8_gui, "", s:nord8_term, "", s:bold, "")
call s:hi("rustModPath", s:nord7_gui, "", s:nord7_term, "", "", "")
call s:hi("rustPanic", s:nord9_gui, "", s:nord9_term, "", s:bold, "")
call s:hi("rustTrait", s:nord7_gui, "", s:nord7_term, "", s:italic, "")
hi! link rustCommentLineDoc Comment
hi! link rustDerive rustAttribute
hi! link rustEnumVariant rustEnum
hi! link rustEscape SpecialChar
hi! link rustQuestionMark Keyword
call s:hi("sassClass", s:nord7_gui, "", s:nord7_term, "", "", "")
call s:hi("sassId", s:nord7_gui, "", s:nord7_term, "", s:underline, "")
hi! link sassAmpersand Keyword
hi! link sassClassChar Delimiter
hi! link sassControl Keyword
hi! link sassControlLine Keyword
hi! link sassExtend Keyword
hi! link sassFor Keyword
hi! link sassFunctionDecl Keyword
hi! link sassFunctionName Function
hi! link sassidChar sassId
hi! link sassInclude SpecialChar
hi! link sassMixinName Function
hi! link sassMixing SpecialChar
hi! link sassReturn Keyword
hi! link shCmdParenRegion Delimiter
hi! link shCmdSubRegion Delimiter
hi! link shDerefSimple Identifier
hi! link shDerefVar Identifier
hi! link sqlKeyword Keyword
hi! link sqlSpecial Keyword
call s:hi("vimAugroup", s:nord7_gui, "", s:nord7_term, "", "", "")
call s:hi("vimMapRhs", s:nord7_gui, "", s:nord7_term, "", "", "")
call s:hi("vimNotation", s:nord7_gui, "", s:nord7_term, "", "", "")
hi! link vimFunc Function
hi! link vimFunction Function
hi! link vimUserFunc Function
call s:hi("xmlAttrib", s:nord7_gui, "", s:nord7_term, "", "", "")
call s:hi("xmlCdataStart", s:nord3_gui_bright, "", s:nord3_term, "", s:bold, "")
call s:hi("xmlNamespace", s:nord7_gui, "", s:nord7_term, "", "", "")
hi! link xmlAttribPunct Delimiter
hi! link xmlCdata Comment
hi! link xmlCdataCdata xmlCdataStart
hi! link xmlCdataEnd xmlCdataStart
hi! link xmlEndTag xmlTagName
hi! link xmlProcessingDelim Keyword
hi! link xmlTagName Keyword
call s:hi("yamlBlockMappingKey", s:nord7_gui, "", s:nord7_term, "", "", "")
hi! link yamlBool Keyword
hi! link yamlDocumentStart Keyword
"+----------------+
"+ Plugin Support +
"+----------------+
"+--- UI ---+
" ALE
" > w0rp/ale
call s:hi("ALEWarningSign", s:nord13_gui, "", s:nord13_term, "", "", "")
call s:hi("ALEErrorSign" , s:nord11_gui, "", s:nord11_term, "", "", "")
call s:hi("ALEWarning" , s:nord13_gui, "", s:nord13_term, "", "undercurl", "")
call s:hi("ALEError" , s:nord11_gui, "", s:nord11_term, "", "undercurl", "")
" Coc
" > neoclide/coc.vim
call s:hi("CocWarningHighlight" , s:nord13_gui, "", s:nord13_term, "", "undercurl", "")
call s:hi("CocErrorHighlight" , s:nord11_gui, "", s:nord11_term, "", "undercurl", "")
call s:hi("CocWarningSign", s:nord13_gui, "", s:nord13_term, "", "", "")
call s:hi("CocErrorSign" , s:nord11_gui, "", s:nord11_term, "", "", "")
call s:hi("CocInfoSign" , s:nord8_gui, "", s:nord8_term, "", "", "")
call s:hi("CocHintSign" , s:nord10_gui, "", s:nord10_term, "", "", "")
if has('nvim')
" Neovim LSP
" > neovim/nvim-lspconfig
call s:hi("LspCodeLens", s:nord3_gui_bright, "", s:nord3_term, "", "", "")
if has("nvim-0.5")
call s:hi("LspDiagnosticsDefaultWarning", s:nord13_gui, "", s:nord13_term, "", "", "")
call s:hi("LspDiagnosticsDefaultError" , s:nord11_gui, "", s:nord11_term, "", "", "")
call s:hi("LspDiagnosticsDefaultInformation" , s:nord8_gui, "", s:nord8_term, "", "", "")
call s:hi("LspDiagnosticsDefaultHint" , s:nord10_gui, "", s:nord10_term, "", "", "")
call s:hi("LspDiagnosticsUnderlineWarning" , s:nord13_gui, "", s:nord13_term, "", "undercurl", "")
call s:hi("LspDiagnosticsUnderlineError" , s:nord11_gui, "", s:nord11_term, "", "undercurl", "")
call s:hi("LspDiagnosticsUnderlineInformation" , s:nord8_gui, "", s:nord8_term, "", "undercurl", "")
call s:hi("LspDiagnosticsUnderlineHint" , s:nord10_gui, "", s:nord10_term, "", "undercurl", "")
endif
" Gitsigns
" > lewis6991/gitsigns.nvim
hi! link GitSignsCurrentLineBlame Comment
endif
" GitGutter
" > airblade/vim-gitgutter
call s:hi("GitGutterAdd", s:nord14_gui, "", s:nord14_term, "", "", "")
call s:hi("GitGutterChange", s:nord13_gui, "", s:nord13_term, "", "", "")
call s:hi("GitGutterChangeDelete", s:nord11_gui, "", s:nord11_term, "", "", "")
call s:hi("GitGutterDelete", s:nord11_gui, "", s:nord11_term, "", "", "")
" Signify
" > mhinz/vim-signify
call s:hi("SignifySignAdd", s:nord14_gui, "", s:nord14_term, "", "", "")
call s:hi("SignifySignChange", s:nord13_gui, "", s:nord13_term, "", "", "")
call s:hi("SignifySignChangeDelete", s:nord11_gui, "", s:nord11_term, "", "", "")
call s:hi("SignifySignDelete", s:nord11_gui, "", s:nord11_term, "", "", "")
" Sneak
" > justinmk/vim-sneak
hi! link Sneak Search
" fugitive.vim
" > tpope/vim-fugitive
call s:hi("gitcommitDiscardedFile", s:nord11_gui, "", s:nord11_term, "", "", "")
call s:hi("gitcommitUntrackedFile", s:nord11_gui, "", s:nord11_term, "", "", "")
call s:hi("gitcommitSelectedFile", s:nord14_gui, "", s:nord14_term, "", "", "")
" davidhalter/jedi-vim
call s:hi("jediFunction", s:nord4_gui, s:nord3_gui, "", s:nord3_term, "", "")
call s:hi("jediFat", s:nord8_gui, s:nord3_gui, s:nord8_term, s:nord3_term, s:underline.s:bold, "")
" NERDTree
" > scrooloose/nerdtree
call s:hi("NERDTreeExecFile", s:nord7_gui, "", s:nord7_term, "", "", "")
hi! link NERDTreeDirSlash Keyword
hi! link NERDTreeHelp Comment
" CtrlP
" > ctrlpvim/ctrlp.vim
hi! link CtrlPMatch Keyword
hi! link CtrlPBufferHid Normal
" vim-clap
" > liuchengxu/vim-clap
call s:hi("ClapDir", s:nord4_gui, "", "", "", "", "")
call s:hi("ClapDisplay", s:nord4_gui, s:nord1_gui, "", s:nord1_term, "", "")
call s:hi("ClapFile", s:nord4_gui, "", "", "NONE", "", "")
call s:hi("ClapMatches", s:nord8_gui, "", s:nord8_term, "", "", "")
call s:hi("ClapNoMatchesFound", s:nord13_gui, "", s:nord13_term, "", "", "")
call s:hi("ClapSelected", s:nord7_gui, "", s:nord7_term, "", s:bold, "")
call s:hi("ClapSelectedSign", s:nord9_gui, "", s:nord9_term, "", "", "")
let s:clap_matches = [
\ [s:nord8_gui, s:nord8_term] ,
\ [s:nord9_gui, s:nord9_term] ,
\ [s:nord10_gui, s:nord10_term] ,
\ ]
for s:nord_clap_match_i in range(1,12)
let clap_match_color = s:clap_matches[s:nord_clap_match_i % len(s:clap_matches) - 1]
call s:hi("ClapMatches" . s:nord_clap_match_i, clap_match_color[0], "", clap_match_color[1], "", "", "")
call s:hi("ClapFuzzyMatches" . s:nord_clap_match_i, clap_match_color[0], "", clap_match_color[1], "", "", "")
endfor
unlet s:nord_clap_match_i
hi! link ClapCurrentSelection PmenuSel
hi! link ClapCurrentSelectionSign ClapSelectedSign
hi! link ClapInput Pmenu
hi! link ClapPreview Pmenu
hi! link ClapProviderAbout ClapDisplay
hi! link ClapProviderColon Type
hi! link ClapProviderId Type
" vim-indent-guides
" > nathanaelkane/vim-indent-guides
call s:hi("IndentGuidesEven", "", s:nord1_gui, "", s:nord1_term, "", "")
call s:hi("IndentGuidesOdd", "", s:nord2_gui, "", s:nord3_term, "", "")
" vim-plug
" > junegunn/vim-plug
call s:hi("plugDeleted", s:nord11_gui, "", "", s:nord11_term, "", "")
" vim-signature
" > kshenoy/vim-signature
call s:hi("SignatureMarkText", s:nord8_gui, "", s:nord8_term, "", "", "")
" vim-startify
" > mhinz/vim-startify
call s:hi("StartifyFile", s:nord6_gui, "", s:nord6_term, "", "", "")
call s:hi("StartifyFooter", s:nord7_gui, "", s:nord7_term, "", "", "")
call s:hi("StartifyHeader", s:nord8_gui, "", s:nord8_term, "", "", "")
call s:hi("StartifyNumber", s:nord7_gui, "", s:nord7_term, "", "", "")
call s:hi("StartifyPath", s:nord8_gui, "", s:nord8_term, "", "", "")
hi! link StartifyBracket Delimiter
hi! link StartifySlash Normal
hi! link StartifySpecial Comment
"+--- Languages ---+
" Haskell
" > neovimhaskell/haskell-vim
call s:hi("haskellPreProc", s:nord10_gui, "", s:nord10_term, "", "", "")
call s:hi("haskellType", s:nord7_gui, "", s:nord7_term, "", "", "")
hi! link haskellPragma haskellPreProc
" JavaScript
" > pangloss/vim-javascript
call s:hi("jsGlobalNodeObjects", s:nord8_gui, "", s:nord8_term, "", s:italic, "")
hi! link jsBrackets Delimiter
hi! link jsFuncCall Function
hi! link jsFuncParens Delimiter
hi! link jsThis Keyword
hi! link jsNoise Delimiter
hi! link jsPrototype Keyword
hi! link jsRegexpString SpecialChar
" Pandoc
" > vim-pandoc/vim-pandoc-syntax
call s:hi("pandocDefinitionBlockTerm", s:nord7_gui, "", s:nord7_term, "", s:italic, "")
call s:hi("pandocTableDelims", s:nord3_gui, "", s:nord3_term, "", "", "")
hi! link pandocAtxHeader markdownH1
hi! link pandocBlockQuote markdownBlockquote
hi! link pandocCiteAnchor Operator
hi! link pandocCiteKey pandocReferenceLabel
hi! link pandocDefinitionBlockMark Operator
hi! link pandocEmphasis markdownItalic
hi! link pandocFootnoteID pandocReferenceLabel
hi! link pandocFootnoteIDHead markdownLinkDelimiter
hi! link pandocFootnoteIDTail pandocFootnoteIDHead
hi! link pandocGridTableDelims pandocTableDelims
hi! link pandocGridTableHeader pandocTableDelims
hi! link pandocOperator Operator
hi! link pandocPipeTableDelims pandocTableDelims
hi! link pandocReferenceDefinition pandocReferenceLabel
hi! link pandocReferenceLabel markdownLinkText
hi! link pandocReferenceURL markdownUrl
hi! link pandocSimpleTableHeader pandocAtxHeader
hi! link pandocStrong markdownBold
hi! link pandocTableHeaderWord pandocAtxHeader
hi! link pandocUListItemBullet Operator
if has('nvim')
" tree-sitter
" > nvim-treesitter/nvim-treesitter
hi! link TSAnnotation Annotation
hi! link TSConstBuiltin Constant
hi! link TSConstructor Function
hi! link TSEmphasis Italic
hi! link TSFuncBuiltin Function
hi! link TSFuncMacro Function
hi! link TSStringRegex SpecialChar
hi! link TSStrong Bold
hi! link TSStructure Structure
hi! link TSTagDelimiter TSTag
hi! link TSUnderline Underline
hi! link TSVariable Variable
hi! link TSVariableBuiltin Keyword
endif
" TypeScript
" > HerringtonDarkholme/yats.vim
call s:hi("typescriptBOMWindowMethod", s:nord8_gui, "", s:nord8_term, "", s:italic, "")
call s:hi("typescriptClassName", s:nord7_gui, "", s:nord7_term, "", "", "")
call s:hi("typescriptDecorator", s:nord12_gui, "", s:nord12_term, "", "", "")
call s:hi("typescriptInterfaceName", s:nord7_gui, "", s:nord7_term, "", s:bold, "")
call s:hi("typescriptRegexpString", s:nord13_gui, "", s:nord13_term, "", "", "")
" TypeScript JSX
call s:hi("tsxAttrib", s:nord7_gui, "", s:nord7_term, "", "", "")
hi! link typescriptOperator Operator
hi! link typescriptBinaryOp Operator
hi! link typescriptAssign Operator
hi! link typescriptMember Identifier
hi! link typescriptDOMStorageMethod Identifier
hi! link typescriptArrowFuncArg Identifier
hi! link typescriptGlobal typescriptClassName
hi! link typescriptBOMWindowProp Function
hi! link typescriptArrowFuncDef Function
hi! link typescriptAliasDeclaration Function
hi! link typescriptPredefinedType Type
hi! link typescriptTypeReference typescriptClassName
hi! link typescriptTypeAnnotation Structure
hi! link typescriptDocNamedParamType SpecialComment
hi! link typescriptDocNotation Keyword
hi! link typescriptDocTags Keyword
hi! link typescriptImport Keyword
hi! link typescriptExport Keyword
hi! link typescriptTry Keyword
hi! link typescriptVariable Keyword
hi! link typescriptBraces Normal
hi! link typescriptObjectLabel Normal
hi! link typescriptCall Normal
hi! link typescriptClassHeritage typescriptClassName
hi! link typescriptFuncTypeArrow Structure
hi! link typescriptMemberOptionality Structure
hi! link typescriptNodeGlobal typescriptGlobal
hi! link typescriptTypeBrackets Structure
hi! link tsxEqual Operator
hi! link tsxIntrinsicTagName htmlTag
hi! link tsxTagName tsxIntrinsicTagName
" Markdown
" > plasticboy/vim-markdown
call s:hi("mkdCode", s:nord7_gui, "", s:nord7_term, "", "", "")
call s:hi("mkdFootnote", s:nord8_gui, "", s:nord8_term, "", "", "")
call s:hi("mkdRule", s:nord10_gui, "", s:nord10_term, "", "", "")
call s:hi("mkdLineBreak", s:nord9_gui, "", s:nord9_term, "", "", "")
hi! link mkdBold Bold
hi! link mkdItalic Italic
hi! link mkdString Keyword
hi! link mkdCodeStart mkdCode
hi! link mkdCodeEnd mkdCode
hi! link mkdBlockquote Comment
hi! link mkdListItem Keyword
hi! link mkdListItemLine Normal
hi! link mkdFootnotes mkdFootnote
hi! link mkdLink markdownLinkText
hi! link mkdURL markdownUrl
hi! link mkdInlineURL mkdURL
hi! link mkdID Identifier
hi! link mkdLinkDef mkdLink
hi! link mkdLinkDefTarget mkdURL
hi! link mkdLinkTitle mkdInlineURL
hi! link mkdDelimiter Keyword
" PHP
" > StanAngeloff/php.vim
call s:hi("phpClass", s:nord7_gui, "", s:nord7_term, "", "", "")
call s:hi("phpClassImplements", s:nord7_gui, "", s:nord7_term, "", s:bold, "")
hi! link phpClassExtends phpClass
hi! link phpFunction Function
hi! link phpMethod Function
hi! link phpUseClass phpClass
" Vimwiki
" > vimwiki/vimwiki
if !exists("g:vimwiki_hl_headers") || g:vimwiki_hl_headers == 0
for s:i in range(1,6)
call s:hi("VimwikiHeader".s:i, s:nord8_gui, "", s:nord8_term, "", s:bold, "")
endfor
else
let s:vimwiki_hcolor_guifg = [s:nord7_gui, s:nord8_gui, s:nord9_gui, s:nord10_gui, s:nord14_gui, s:nord15_gui]
let s:vimwiki_hcolor_ctermfg = [s:nord7_term, s:nord8_term, s:nord9_term, s:nord10_term, s:nord14_term, s:nord15_term]
for s:i in range(1,6)
call s:hi("VimwikiHeader".s:i, s:vimwiki_hcolor_guifg[s:i-1] , "", s:vimwiki_hcolor_ctermfg[s:i-1], "", s:bold, "")
endfor
endif
call s:hi("VimwikiLink", s:nord8_gui, "", s:nord8_term, "", s:underline, "")
hi! link VimwikiHeaderChar markdownHeadingDelimiter
hi! link VimwikiHR Keyword
hi! link VimwikiList markdownListMarker
" YAML
" > stephpy/vim-yaml
call s:hi("yamlKey", s:nord7_gui, "", s:nord7_term, "", "", "")
"+------------+
"+ Public API +
"+------------+
"+--- Functions ---+
function! NordPalette() abort
let ret = {}
for color in range(16)
execute 'let ret["nord'.color.'"] = s:nord'.color.'_gui'
endfor
let ret["nord3_bright"] = s:nord3_gui_bright
return ret
endfunction

View file

@ -1,21 +0,0 @@
MIT License (MIT)
Copyright (c) 2016-present Sven Greb <development@svengreb.de> (https://www.svengreb.de)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

File diff suppressed because it is too large Load diff

View file

@ -1,39 +0,0 @@
{
"name": "@nordtheme/vim",
"version": "0.19.0",
"description": "An arctic, north-bluish clean and elegant Vim theme",
"author": "Sven Greb <development@svengreb.de> (https://www.svengreb.de)",
"homepage": "https://www.nordtheme.com/ports/vim",
"repository": {
"type": "git",
"url": "git+https://github.com/nordtheme/vim.git"
},
"bugs": {
"url": "https://github.com/nordtheme/vim/issues"
},
"license": "MIT",
"private": true,
"engines": {
"node": ">=15.13",
"npm": ">=7.7"
},
"scripts": {
"format": "run-s format:pretty",
"format:pretty": "prettier --write .",
"lint": "run-s lint:md lint:pretty",
"lint:ci": "run-s lint:md lint:ci:*",
"lint:ci:pretty": "prettier --loglevel silent --check .",
"lint:md": "remark --no-stdout .",
"lint:pretty": "prettier --check .",
"prepare:husky": "husky install",
"prepare": "run-s prepare:*"
},
"devDependencies": {
"@arcticicestudio/remark-preset-lint": ">=0.4.0 <1.0.0",
"husky": "8.0.3",
"lint-staged": "13.1.2",
"npm-run-all": "4.1.5",
"prettier": "^2.8.4",
"remark-cli": "11.0.0"
}
}

View file

@ -1,150 +0,0 @@
<p align="center">
<a href="https://www.nordtheme.com/ports/vim" target="_blank">
<picture>
<source srcset="https://raw.githubusercontent.com/arcticicestudio/nord-docs/main/assets/images/ports/vim/repository-hero.svg?sanitize=true" width="100%" media="(prefers-color-scheme: light), (prefers-color-scheme: no-preference)" />
<img src="https://raw.githubusercontent.com/arcticicestudio/nord-docs/main/assets/images/ports/vim/repository-hero.svg?sanitize=true" width="100%" />
</picture>
</a>
</p>
<p align="center">
<a href="https://github.com/nordtheme/vim/releases/latest" target="_blank">
<img src="https://img.shields.io/github/release/nordtheme/vim.svg?style=flat-square&label=Release&logo=github&logoColor=eceff4&colorA=4c566a&colorB=88c0d0"/>
</a>
<a href="https://www.nordtheme.com/docs/ports/vim" target="_blank">
<img src="https://img.shields.io/github/release/nordtheme/vim.svg?style=flat-square&label=Docs&colorA=4c566a&colorB=88c0d0&logo=data%3Aimage%2Fsvg%2Bxml%3Bbase64%2CPHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiI%2BCiAgICA8cGF0aCBmaWxsPSIjZDhkZWU5IiBkPSJNMTMuNzQ2IDIuODEzYS42Ny42NyAwIDAgMC0uNTU5LS4xMzNMOCAzLjg0OGwtNS4xODgtMS4xOGEuNjY5LjY2OSAwIDAgMC0uNTcuMTMzLjY3Ny42NzcgMCAwIDAtLjI0Mi41MzF2OC4xMzNjLS4wMDguMzIuMjEuNTk4LjUyLjY2OGw1LjMzMiAxLjE5OWguMjk2bDUuMzMyLTEuMmEuNjY4LjY2OCAwIDAgMCAuNTItLjY2N1YzLjMzMmEuNjU5LjY1OSAwIDAgMC0uMjU0LS41MnpNMy4zMzIgNC4xNjhsNCAuODk4djYuNzY2bC00LS44OTh6bTkuMzM2IDYuNzY2bC00IC44OThWNS4wNjZsNC0uODk4em0wIDAiLz4KPC9zdmc%2BCg%3D%3D"/>
</a>
<a href="https://github.com/nordtheme/vim/blob/main/changelog.md#050" target="_blank">
<img src="https://img.shields.io/github/release/nordtheme/vim.svg?style=flat-square&label=Changelog&logo=github&logoColor=eceff4&colorA=4c566a&colorB=88c0d0"/>
</a>
</p>
<p align="center">
<a href="https://github.com/arcticicestudio/styleguide-markdown/releases/latest" target="_blank">
<img src="https://img.shields.io/github/release/arcticicestudio/styleguide-markdown.svg?style=flat-square&label=Markdown%20Style%20Guide&colorA=4c566a&colorB=88c0d0&logo=data%3Aimage%2Fsvg%2Bxml%3Bbase64%2CPHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIzOSIgaGVpZ2h0PSIzOSIgdmlld0JveD0iMCAwIDM5IDM5Ij48cGF0aCBmaWxsPSJub25lIiBzdHJva2U9IiNEOERFRTkiIHN0cm9rZS13aWR0aD0iMyIgc3Ryb2tlLW1pdGVybGltaXQ9IjEwIiBkPSJNMS41IDEuNWgzNnYzNmgtMzZ6Ii8%2BPHBhdGggZmlsbD0iI0Q4REVFOSIgZD0iTTIwLjY4MyAyNS42NTVsNS44NzItMTMuNDhoLjU2Nmw1Ljg3MyAxMy40OGgtMS45OTZsLTQuMTU5LTEwLjA1Ni00LjE2MSAxMC4wNTZoLTEuOTk1em0tMi42OTYgMGwtMTMuNDgtNS44NzJ2LS41NjZsMTMuNDgtNS44NzJ2MS45OTVMNy45MzEgMTkuNWwxMC4wNTYgNC4xNnoiLz48L3N2Zz4%3D"/>
</a>
<a href="https://github.com/arcticicestudio/styleguide-git/releases/latest" target="_blank">
<img src="https://img.shields.io/github/release/arcticicestudio/styleguide-git.svg?style=flat-square&label=Git%20Style%20Guide&logoColor=eceff4&colorA=4c566a&colorB=88c0d0&logo=git"/>
</a>
</p>
<p align="center">An arctic, north-bluish clean and elegant <a href="https://www.vim.org">Vim</a> color theme.</p>
<p align="center">Designed for a fluent and clear workflow based on the <a href="https://www.nordtheme.com">Nord</a> color palette.</p>
<p align="center">
<a href="https://www.nordtheme.com/ports/vim" target="_blank">
<picture>
<img src="https://raw.githubusercontent.com/arcticicestudio/nord-docs/main/assets/images/ports/vim/overview-go.png"/>
</picture>
</a>
</p>
Build for Vim's terminal- and GUI mode with _true colors_ with support for many third-party syntax and UI plugins including bundled themes for [lightline.vim][1] and [vim-airline][4].
## Getting Started
Visit the [official website][23] to learn all about the [syntax highlighting][27] features, details and elements of [UI and editor elements][25], the [various theme configurations][24] and the [support for many plugins][26].
Learn about the [installation and activation][20], how to [configure][18] and [customize][19] the theme from the [official documentations][22].
### Quick Start
Thanks to existing plugin/_runtimepath_ managers for Vim, Nord Vim can be installed for all platforms and the various variants/forks of Vim in a uniform way within a few lines of codes. The recommended manager is [vim-plug][2], but any other manager like [pathogen][3] or [Vundle][5] can also be used.
To automatically download and activate Nord Vim, follow the install instructions for [vim-plug][2] and
1. add `Plug 'nordtheme/vim'` to your [`vimrc`][28] within _vim-plug_'s plugin loading function
2. run the `:PlugInstall` command in Vim
3. activate the theme by adding `colorscheme nord` to the [vimrc][28] or change it on-the-fly by running `:colorscheme nord`
<p align="center">
<picture>
<img src="https://raw.githubusercontent.com/arcticicestudio/nord-docs/main/assets/images/ports/vim/installation-vim-plug.png"/>
</picture>
</p>
See the Nord Vim's documentation for [more installation options][20] and how to [set it up manually][21].
## Features
<p align="center">
<strong>A unified UI and editor syntax element design provides a clutter-free and fluidly merging appearance.</strong><br />
<picture>
<img src="https://raw.githubusercontent.com/arcticicestudio/nord-docs/main/assets/images/ports/vim/overview-go-nerdtree.png"/>
</picture>
</p>
<p align="center">
<strong>Small details with unobtrusive styles for popular and common code editor features like search result marker and brace matching — designed to get out of your way with a visually attractive appearance.</strong><br />
<picture>
<img src="https://raw.githubusercontent.com/arcticicestudio/nord-docs/main/assets/images/ports/vim/editor-search-highlighting.png"/>
</picture>
</p>
<p align="center">
<strong>Support for a wide range of programming languages — from bundled plugins up to many popular syntax and UI third-party plugins.</strong><br />
<picture>
<img src="https://raw.githubusercontent.com/arcticicestudio/nord-docs/main/assets/images/ports/vim/syntax-javascript-react-hook.png"/>
</picture>
</p>
## Contributing
Nord is an open source project and we love to receive contributions from the [community][6]!
There are many ways to contribute, from [writing- and improving documentation and tutorials][9], [reporting bugs][8], [submitting enhancement suggestions][10] that can be added to Nord by [submitting pull requests][14].
Please take a moment to read Nord's full [contributing guide][17] to learn about the development process, the project's used [styleguides][15], [branch organization][7] and [versioning][16] model.
The guide also includes information about [minimal, complete, and verifiable examples][13] and other ways to contribute to the project like [improving existing issues][12] and [giving feedback on issues and pull requests][11].
<p align="center">
<picture>
<source srcset="https://raw.githubusercontent.com/nordtheme/assets/main/static/images/elements/separators/iceberg/footer/dark/spaced.svg?sanitize=true" width="100%" media="(prefers-color-scheme: light), (prefers-color-scheme: no-preference)" />
<source srcset="https://raw.githubusercontent.com/nordtheme/assets/main/static/images/elements/separators/iceberg/footer/light/spaced.svg?sanitize=true" width="100%" media="(prefers-color-scheme: dark)" />
<img src="https://raw.githubusercontent.com/nordtheme/assets/main/static/images/elements/separators/iceberg/footer/dark/spaced.svg?sanitize=true" width="100%" />
</picture>
</p>
<p align="center">
Copyright &copy; 2016-present <a href="https://www.svengreb.de" target="_blank">Sven Greb</a>
</p>
<p align="center">
<a href="https://github.com/nordtheme/vim/blob/main/license" target="_blank">
<img src="https://img.shields.io/static/v1.svg?style=flat-square&label=License&message=MIT&logoColor=eceff4&colorA=4c566a&colorB=88c0d0"/>
</a>
<a href="https://www.svengreb.de">
<img src="https://img.shields.io/static/v1.svg?style=flat-square&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABmJLR0QA/wD/AP+gvaeTAAABMklEQVQ4jcWQvUoDQRRGz52s5IfVIiDWPkGKFFaCIVaGdIagjcFAwICFb7DvIK6QQlNpY2UQLMQVBbEQ0SewFkGbKCQmOzaTJay7/lR+zTAf9xwuF/47Mv45rdezqWEq72v/RWZnHgqOMwDwHMfSj085JSqb6Pu38we7r18E3nqzhmYbsE11rxKsAvhDfQiSM30XYbOw57YDwfnaRl6U3ABWaMNn806H+oGPzBX3d+4UgChZiYBHYBgGsBLoKoAyhR0x9G20Zmpc4P1ZoMQDcwMNclFrdhBKv6M5WWi7ZQGtjEUn35IV4OwnVjSX/WGmKqCDDUa5rmyle3bvGFiMg3WGUsF1u0EXHoqTRMGRgkAy2eugKZrqijRLYThWANBpNDL2h3UE0J0YLJdbrfe42f/NJ0wqY7/KcXKPAAAAAElFTkSuQmCC&label=lovely%20crafted%20in&message=Germany&colorA=4c566a&colorB=88c0d0"/>
</a>
</p>
[1]: https://github.com/itchyny/lightline.vim
[2]: https://github.com/junegunn/vim-plug
[3]: https://github.com/tpope/vim-pathogen
[4]: https://github.com/vim-airline/vim-airline
[5]: https://github.com/tpope/vim-pathogen
[6]: https://www.nordtheme.com/community
[7]: https://github.com/nordtheme/.github/blob/main/contributing.md#branch-organization
[8]: https://github.com/nordtheme/.github/blob/main/contributing.md#bug-reports
[9]: https://github.com/nordtheme/.github/blob/main/contributing.md#documentations
[10]: https://github.com/nordtheme/.github/blob/main/contributing.md#enhancement-suggestions
[11]: https://github.com/nordtheme/.github/blob/main/contributing.md#feedback
[12]: https://github.com/nordtheme/.github/blob/main/contributing.md#improve-issues
[13]: https://github.com/nordtheme/.github/blob/main/contributing.md#mcve
[14]: https://github.com/nordtheme/.github/blob/main/contributing.md#pull-requests
[15]: https://github.com/nordtheme/.github/blob/main/contributing.md#style-guides
[16]: https://github.com/nordtheme/.github/blob/main/contributing.md#versioning
[17]: https://github.com/nordtheme/.github/blob/main/contributing.md
[18]: https://www.nordtheme.com/docs/ports/vim/configuration
[19]: https://www.nordtheme.com/docs/ports/vim/customization
[20]: https://www.nordtheme.com/docs/ports/vim/installation
[21]: https://www.nordtheme.com/docs/ports/vim/installation#manual
[22]: https://www.nordtheme.com/docs/ports/vim
[23]: https://www.nordtheme.com/ports/vim
[24]: https://www.nordtheme.com/ports/vim#configurations
[25]: https://www.nordtheme.com/ports/vim#editor-details
[26]: https://www.nordtheme.com/ports/vim#plugin-support
[27]: https://www.nordtheme.com/ports/vim#syntax
[28]: https://vimhelp.org/starting.txt.html#vimrc

@ -1 +0,0 @@
Subproject commit 64456adf09b406734f00fe1dd7f9d0f9424d7aa7000000000000000000000000

@ -1 +1 @@
Subproject commit 3a7fd9ff50fabafe61df12522ed2f275c8e2f45e000000000000000000000000
Subproject commit 78004d2ec1d68f9d1d8b54c1803a52feb2f938f3000000000000000000000000

@ -1 +1 @@
Subproject commit ff7352e4bff02eb600a136b6fd741404f3195371000000000000000000000000
Subproject commit 159573187e9996d06cf26e49a533f424f4d70b43000000000000000000000000

@ -1 +0,0 @@
Subproject commit a9aa25ce323b2dd04a52706f4d1b044f4feb7617000000000000000000000000

View file

@ -0,0 +1 @@
call css_color#init('hex', 'basic', 'confComment,confString')

View file

@ -1,4 +1,4 @@
syn match cshCommentColor contained '\(#[^#]*\)\@<=\zs#\x\{3}\%(\x\{3}\)\?\>' containedin=cshComment
call css_color#init( 'hex', 'none'
\, 'cshDblQuote,cshSnglQuote,cshHereDoc,'
\. 'cshCommentColor' )
call css_color#init('hex', 'none',
\ 'cshCommentColor,' .
\ 'cshDblQuote,cshSnglQuote,cshHereDoc')

View file

@ -1 +1 @@
call css_color#init('css', 'extended', 'cssMediaBlock,cssFunction,cssDefinition,cssAttrRegion,cssComment')
call css_color#init('css', 'extended', 'cssComment,cssMediaBlock,cssFunction,cssDefinition,cssAttrRegion')

View file

@ -1,3 +1,3 @@
" https://github.com/dag/vim-fish (and presumably its various forks)
syn match fishCommentColor contained '\(#[^#]*\)\@<=\zs#\x\{3}\%(\x\{3}\)\?\>' containedin=fishComment
call css_color#init( 'hex', 'none', 'fishString,fishCommentColor' )
call css_color#init( 'hex', 'none', 'fishCommentColor,fishString' )

View file

@ -0,0 +1 @@
call css_color#init('hex', 'none', 'gitConfigString,gitConfigComment')

View file

@ -0,0 +1 @@
call css_color#init('hex', 'none', 'haskellLineComment,haskellBlockComment,haskellString')

View file

@ -1,2 +1,2 @@
" default html syntax should already be including the css syntax
call css_color#init('none', 'none', 'htmlString,htmlCommentPart')
call css_color#init('none', 'none', 'htmlCommentPart,htmlString')

View file

@ -7,8 +7,7 @@ if &syntax =~# '\(^\|\.\)coffee\($\|\.\)' | finish | endif
" javaScriptX = default Vim syntax
" jsX = https://github.com/pangloss/vim-javascript
" javascriptX = https://github.com/othree/yajs.vim
call css_color#init('hex', 'extended'
\, 'javaScriptComment,javaScriptLineComment,javaScriptStringS,javaScriptStringD,javaScriptStringT'
\. ',jsComment,jsString,jsTemplateString,jsObjectKeyString,jsObjectStringKey,jsClassStringKey'
\. ',javascriptComment,javascriptLineComment,javascriptLineComment,javascriptString,javascriptTemplate'
\)
call css_color#init('hex', 'extended',
\ 'javaScriptComment,javaScriptLineComment,javaScriptStringS,javaScriptStringD,javaScriptStringT,' .
\ 'jsComment,jsString,jsTemplateString,jsObjectKeyString,jsObjectStringKey,jsClassStringKey,' .
\ 'javascriptComment,javascriptLineComment,javascriptLineComment,javascriptString,javascriptTemplate')

View file

@ -1 +1 @@
call css_color#init('hex', 'none', 'kittyColor,kittyComment')
call css_color#init('hex', 'none', 'kittyComment,kittyColor')

View file

@ -5,4 +5,4 @@
" lessVariableValue | lessDefinition | cssComment | lessComment | https://github.com/groenewege/vim-less
" lessVariableDefinition | cssDefinition | cssComment | lessComment | https://github.com/lunaru/vim-less
call css_color#init('css', 'extended', 'lessVariableValue,lessVariableDefinition,lessDefinition,lessCssAttribute,lessAttribute,cssDefinition,cssComment,lessCssComment,lessComment')
call css_color#init('css', 'extended', 'lessComment,lessCssComment,cssComment,lessVariableValue,lessVariableDefinition,lessDefinition,lessCssAttribute,lessAttribute,cssDefinition')

View file

@ -1,4 +1,4 @@
" https://github.com/Fymyte/rasi.vim
call css_color#init('css', 'extended'
\, 'rasiHexColor,rasiRGBColor,rasiRGBAColor,rasiHSLColor,rasiHSLAColor,rasiNamedColor'
\. ',rasiPropertyVal,rasiComment,rasiCommentL,rasiEnvVar,rasiVarReference')
call css_color#init('css', 'extended',
\ 'rasiComment,rasiCommentL,rasiPropertyVal,rasiEnvVar,rasiVarReference,' .
\ 'rasiHexColor,rasiRGBColor,rasiRGBAColor,rasiHSLColor,rasiHSLAColor,rasiNamedColor')

View file

@ -1 +1 @@
call css_color#init('css', 'extended', 'sassCssAttribute,sassComment,sassCssComment')
call css_color#init('css', 'extended', 'sassComment,sassCssComment,sassCssAttribute')

View file

@ -1 +1 @@
call css_color#init('css', 'extended', 'scssAttribute,scssComment,scssVariableValue,scssMap,scssMapValue,sassCssAttribute,cssComment')
call css_color#init('css', 'extended', 'scssComment,cssComment,scssAttribute,scssVariableValue,scssMap,scssMapValue,sassCssAttribute')

View file

@ -1,6 +1,6 @@
syn match shCommentColor contained '\(#[^#]*\)\@<=\zs#\x\{3}\%(\x\{3}\)\?\>' containedin=shQuickComment,shBQComment,shComment
call css_color#init( 'hex', 'none'
\, 'shSingleQuote,shDoubleQuote,shHereDoc,'
\. 'shTestSingleQuote,shTestDoubleQuote,'
\. 'shEchoQuote,shEmbeddedEcho,shEcho,'
\. 'shCommentColor' )
call css_color#init('hex', 'none',
\ 'shCommentColor,' .
\ 'shEchoQuote,shEmbeddedEcho,shEcho,' .
\ 'shTestSingleQuote,shTestDoubleQuote,' .
\ 'shSingleQuote,shDoubleQuote,shHereDoc')

View file

@ -1 +1 @@
call css_color#init('css', 'extended', 'stylusCssAttribute,stylusComment,cssComment')
call css_color#init('css', 'extended', 'stylusComment,cssComment,stylusCssAttribute')

View file

@ -0,0 +1 @@
call css_color#init('rgba', 'basic', 'xmlComment,xmlCommentPart,xmlString')

View file

@ -1,4 +1,4 @@
syn match tcshCommentColor contained '\(#[^#]*\)\@<=\zs#\x\{3}\%(\x\{3}\)\?\>' containedin=tcshComment
call css_color#init( 'hex', 'none'
\, 'tcshSQuote,tcshDQuote,tcshHereDoc,'
\. 'tcshCommentColor' )
call css_color#init('hex', 'none',
\ 'tcshCommentColor,' .
\ 'tcshSQuote,tcshDQuote,tcshHereDoc' )

View file

@ -1 +1 @@
call css_color#init('css', 'none', 'tmuxString,tmuxComment')
call css_color#init('css', 'none', 'tmuxComment,tmuxString')

View file

@ -0,0 +1 @@
call css_color#init('hex', 'basic', 'tomlComment,tomlCommentPart,tomlString')

View file

@ -1,6 +1,5 @@
" https://github.com/HerringtonDarkholme/yats.vim (stock Vim syntax)
" https://github.com/leafgarland/typescript-vim
call css_color#init('css', 'extended'
\, 'typescriptString,typescriptStringProperty,typescriptStringS,typescriptStringD,typescriptStringB,'
\. 'typescriptComment,typescriptLineComment,typescriptCommentSkip,typescriptDocComment'
\)
call css_color#init('css', 'extended',
\ 'typescriptComment,typescriptLineComment,typescriptCommentSkip,typescriptDocComment,' .
\ 'typescriptString,typescriptStringProperty,typescriptStringS,typescriptStringD,typescriptStringB')

View file

@ -1 +1 @@
call css_color#init('hex', 'none', 'vimHiGuiRgb,vimString,vimComment,vimLineComment')
call css_color#init('hex', 'none', 'vimComment,vimLineComment,vimString,vimHiGuiRgb')

View file

@ -1,4 +1,4 @@
syn match zshCommentColor contained '\(#[^#]*\)\@<=\zs#\x\{3}\%(\x\{3}\)\?\>' containedin=zshComment
call css_color#init( 'hex', 'none'
\, 'zshString,zshPOSIXString,zshHereDoc,'
\. 'zshCommentColor' )
call css_color#init('hex', 'none',
\ 'zshCommentColor,' .
\ 'zshString,zshPOSIXString,zshHereDoc')

View file

@ -3,7 +3,7 @@
" Commit: $Format:%H$
" Licence: The MIT License (MIT)
if ! ( v:version >= 700 && has('syntax') && ( has('gui_running') || has('nvim') || &t_Co == 256 ) )
if ! ( v:version >= 700 && has('syntax') && ( has('gui_running') || has('nvim') || &t_Co >= 256 ) )
function! css_color#init(type, keywords, groups)
endfunction
function! css_color#extend(groups)
@ -231,7 +231,7 @@ let s:_hexcolor = '#\(\x\{3}\%(\>\|\x\{3}\>\)\)' " submatch 1
let s:_rgbacolor = '#\(\x\{3}\%(\>\|\x\%(\>\|\x\{2}\%(\>\|\x\{2}\>\)\)\)\)' " submatch 1
let s:_funcname = '\(rgb\|hsl\)a\?' " submatch 2
let s:_ws_ = '\s*'
let s:_numval = s:_ws_ . '\(\d\{1,3}%\?\)' " submatch 3,4,5
let s:_numval = s:_ws_ . '\(\d\{1,3}\%(%\|deg\)\?\)' " submatch 3,4,5
let s:_listsep = s:_ws_ . ','
let s:_otherargs_ = '\%(,[^)]*\)\?'
let s:_funcexpr = s:_funcname . '[(]' . s:_numval . s:_listsep . s:_numval . s:_listsep . s:_numval . s:_ws_ . s:_otherargs_ . '[)]'

View file

@ -1,7 +0,0 @@
.travis.yml export-ignore
.gitattributes export-ignore
.gitignore export-ignore
doc/tags export-ignore
*.md export-ignore
zip export-ignore
test/* export-ignore

View file

@ -1,2 +0,0 @@
doc/tags
*.zip

View file

@ -1,15 +0,0 @@
language: vim
before_script: |
git clone https://github.com/junegunn/vader.vim.git
git clone https://github.com/tpope/vim-repeat
script: |
vim -Nu <(cat << VIMRC
filetype off
set rtp+=vader.vim
set rtp+=vim-repeat
set rtp+=.
filetype plugin indent on
syntax enable
VIMRC) -c 'Vader! test/*' > /dev/null

View file

@ -1,416 +0,0 @@
easy-align examples
===================
Open this document in your Vim and try it yourself.
This document assumes that you have the following mappings in your .vimrc.
```vim
" Start interactive EasyAlign in visual mode (e.g. vipga)
xmap ga <Plug>(EasyAlign)
" Start interactive EasyAlign for a motion/text object (e.g. gaip)
nmap ga <Plug>(EasyAlign)
```
You can use either of the maps. Place the cursor on the paragraph and press
- `gaip` "(ga) start easy-align on (i)nner (p)aragraph"
- or `vipga` "(v)isual-select (i)nner (p)aragraph and (ga) start easy-align"
To enable syntax highlighting in the code blocks, define and call the following
function.
```vim
function! GFM()
let langs = ['ruby', 'yaml', 'vim', 'c']
for lang in langs
unlet b:current_syntax
silent! exec printf("syntax include @%s syntax/%s.vim", lang, lang)
exec printf("syntax region %sSnip matchgroup=Snip start='```%s' end='```' contains=@%s",
\ lang, lang, lang)
endfor
let b:current_syntax='mkd'
syntax sync fromstart
endfunction
```
Alignment around whitespaces
----------------------------
You can align text around whitespaces with `<space>` delimiter key.
Start the interactive mode as described above (`gaip` or `vipga`) and try
these commands:
- `<space>`
- `2<space>`
- `*<space>`
- `-<space>`
- `-2<space>`
- `<Enter><space>`
- `<Enter>*<space>`
- `<Enter><Enter>*<space>`
### Example
```
Paul McCartney 1942
George Harrison 1943
Ringo Starr 1940
Pete Best 1941
```
Formatting table
----------------
Again, start the interactive mode and try these commands:
- `*|`
- `**|`
- `<Enter>*|`
- `<Enter>**|`
- `<Enter><Enter>*|`
### Example
```
| Option| Type | Default | Description |
|--|--|--|--|
| threads | Fixnum | 1 | number of threads in the thread pool |
|queues |Fixnum | 1 | number of concurrent queues |
|queue_size | Fixnum | 1000 | size of each queue |
| interval | Numeric | 0 | dispatcher interval for batch processing |
|batch | Boolean | false | enables batch processing mode |
|batch_size | Fixnum | nil | number of maximum items to be assigned at once |
|logger | Logger | nil | logger instance for debug logs |
```
Alignment around =
------------------
The default rule for delimiter key `=` aligns around a whole family of
operators containing `=` character.
Try these commands in the interactive mode.
- `=`
- `*=`
- `**=`
- `<Enter>**=`
- `<Enter><Enter>*=`
### Example
```ruby
a =
a = 1
bbbb = 2
ccccccc = 3
ccccccccccccccc
ddd = 4
eeee === eee = eee = eee=f
fff = ggg += gg &&= gg
g != hhhhhhhh == 888
i := 5
i %= 5
i *= 5
j =~ 5
j >= 5
aa => 123
aa <<= 123
aa >>= 123
bbb => 123
c => 1233123
d => 123
dddddd &&= 123
dddddd ||= 123
dddddd /= 123
gg <=> ee
```
Formatting YAML (or JSON)
-------------------------
You can use `:`-rule here to align text around only the first occurrences of
colons. In this case, you don't want to align around all the colons: `*:`.
```yaml
mysql:
# JDBC driver for MySQL database:
driver: com.mysql.jdbc.Driver
# JDBC URL for the connection (jdbc:mysql://HOSTNAME/DATABASE)
url: jdbc:mysql://localhost/test
database: test
"user:pass":r00t:pa55
```
Formatting multi-line method chaining
-------------------------------------
Try `.` or `*.` on the following lines.
```ruby
my_object
.method1().chain()
.second_method().call()
.third().call()
.method_4().execute()
```
Notice that the indentation is adjusted to match the shortest one among those of
the lines starting with the delimiter.
```ruby
my_object
.method1() .chain()
.second_method().call()
.third() .call()
.method_4() .execute()
```
Using blockwise-visual mode or negative N-th parameter
------------------------------------------------------
You can try either:
- select text around `=>` in blockwise-visual mode (`CTRL-V`) and `ga=`
- or `gaip-=`
```ruby
options = { :caching => nil,
:versions => 3,
"cache=blocks" => false }.merge(options)
```
Commas
------
There is also a predefined rule for commas, try `*,`.
```
aaa, bb,c
d,eeeeeee
fffff, gggggggggg,
h, , ii
j,,k
```
Ignoring delimiters in comments or strings
------------------------------------------
Delimiters highlighted as comments or strings are ignored by default, try
`gaip*=` on the following lines.
```c
/* a */ b = c
aa >= bb
// aaa = bbb = cccc
/* aaaa = */ bbbb === cccc " = dddd = " = eeee
aaaaa /* bbbbb */ == ccccc /* != eeeee = */ === fffff
```
This only works when syntax highlighting is enabled.
Aligning in-line comments
-------------------------
*Note: Since the current version provides '#'-rule as one of the default rules,
you can ignore this section.*
```ruby
apple = 1 # comment not aligned
banana = 'Gros Michel' # comment 2
```
So, how do we align the trailing comments in the above lines? Simply try
`-<space>`. The spaces in the comments are ignored, so the trailing comment in
each line is considered to be a single chunk.
But that doesn't work in the following case.
```ruby
apple = 1 # comment not aligned
apricot = 'DAD' + 'F#AD'
banana = 'Gros Michel' # comment 2
```
That is because the second line doesn't have trailing comment, and
the last (`-`) space for that line is the one just before `'F#AD'`.
So, let's define a custom mapping for `#`.
```vim
if !exists('g:easy_align_delimiters')
let g:easy_align_delimiters = {}
endif
let g:easy_align_delimiters['#'] = { 'pattern': '#', 'ignore_groups': ['String'] }
```
Notice that the rule overrides `ignore_groups` attribute in order *not to ignore*
delimiters highlighted as comments.
Then on `#`, we get
```ruby
apple = 1 # comment not aligned
apricot = 'DAD' + 'F#AD'
banana = 'string' # comment 2
```
If you don't want to define the rule, you can do the same with the following
command:
```vim
" Using regular expression /#/
" - "ig" is a shorthand notation of "ignore_groups"
:EasyAlign/#/{'ig':['String']}
" Or more concisely with the shorthand notation;
:EasyAlign/#/ig['String']
```
In this case, the second line is ignored as it doesn't contain a `#` (The one
in `'F#AD'` is ignored as it's highlighted as String). If you don't want the
second line to be ignored, there are three options:
1. Set global `g:easy_align_ignore_unmatched` flag to 0
2. Use `:EasyAlign` command with `ignore_unmatched` option
3. Update the alignment rule with `ignore_unmatched` option
```vim
" 1. Set global g:easy_align_ignore_unmatched to zero
let g:easy_align_ignore_unmatched = 0
" 2. Using :EasyAlign command with ignore_unmatched option
" 2-1. Using predefined rule with delimiter key #
" - "iu" is expanded to "*i*gnore_*u*nmatched"
:EasyAlign#{'iu':0}
" or
:EasyAlign#iu0
" 2-2. Using regular expression /#/
:EasyAlign/#/ig['String']iu0
" 3. Update the alignment rule with ignore_unmatched option
let g:easy_align_delimiters['#'] = {
\ 'pattern': '#', 'ignore_groups': ['String'], 'ignore_unmatched': 0 }
```
Then we get,
```ruby
apple = 1 # comment not aligned
apricot = 'DAD' + 'F#AD'
banana = 'string' # comment 2
```
Aligning C-style variable definition
------------------------------------
Take the following example:
```c
const char* str = "Hello";
int64_t count = 1 + 2;
static double pi = 3.14;
```
We can align these lines with the predefined `=` rule. Select the lines and
press `ga=`
```c
const char* str = "Hello";
int64_t count = 1 + 2;
static double pi = 3.14;
```
Not bad. However, the names of the variables, `str`, `count`, and `pi` are not
aligned with each other. Can we do better? We can clearly see that simple
`<space>`-rule won't properly align those names.
So let's define an alignment rule than can handle this case.
```vim
let g:easy_align_delimiters['d'] = {
\ 'pattern': '\(const\|static\)\@<! ',
\ 'left_margin': 0, 'right_margin': 0
\ }
```
This new rule aligns text around spaces that are *not* preceded by
`const` or `static`. Let's select the lines and try `gad`.
```c
const char* str = "Hello";
int64_t count = 1 + 2;
static double pi = 3.14;
```
Okay, the names are now aligned. We select the lines again with `gv`, and then
press `ga=` to finish our alignment.
```c
const char* str = "Hello";
int64_t count = 1 + 2;
static double pi = 3.14;
```
So far, so good. However, this rule is not sufficient to handle more complex
cases involving C++ templates or Java generics. Take the following example:
```c
const char* str = "Hello";
int64_t count = 1 + 2;
static double pi = 3.14;
static std::map<std::string, float>* scores = pointer;
```
We see that our rule above doesn't work anymore.
```c
const char* str = "Hello";
int64_t count = 1 + 2;
static double pi = 3.14;
static std::map<std::string, float>* scores = pointer;
```
So what do we do? Let's try to improve our alignment rule.
```vim
let g:easy_align_delimiters['d'] = {
\ 'pattern': ' \ze\S\+\s*[;=]',
\ 'left_margin': 0, 'right_margin': 0
\ }
```
Now the new rule has changed to align text around spaces that are followed
by some non-whitespace characters and then an equals sign or a semi-colon.
Try `vipgad`
```c
const char* str = "Hello";
int64_t count = 1 + 2;
static double pi = 3.14;
static std::map<std::string, float>* scores = pointer;
```
We're right on track, now press `gvga=` and voila!
```c
const char* str = "Hello";
int64_t count = 1 + 2;
static double pi = 3.14;
static std::map<std::string, float>* scores = pointer;
```

View file

@ -1,763 +0,0 @@
vim-easy-align ![travis-ci](https://travis-ci.org/junegunn/vim-easy-align.svg?branch=master)
==============
A simple, easy-to-use Vim alignment plugin.
![](https://raw.githubusercontent.com/junegunn/i/master/easy-align/equals.gif)
Installation
------------
Use your favorite plugin manager.
Using [vim-plug](https://github.com/junegunn/vim-plug):
```vim
Plug 'junegunn/vim-easy-align'
```
Quick start guide
-----------------
Add the following mappings to your .vimrc.
```vim
" Start interactive EasyAlign in visual mode (e.g. vipga)
xmap ga <Plug>(EasyAlign)
" Start interactive EasyAlign for a motion/text object (e.g. gaip)
nmap ga <Plug>(EasyAlign)
```
Then with the following lines of text,
```
apple =red
grass+=green
sky-= blue
```
try these commands:
- `vipga=`
- `v`isual-select `i`nner `p`aragraph
- Start EasyAlign command (`ga`)
- Align around `=`
- `gaip=`
- Start EasyAlign command (`ga`) for `i`nner `p`aragraph
- Align around `=`
Demo
----
*Click on each image to see from the beginning.*
### Using predefined alignment rules
An *alignment rule* is a predefined set of options for common alignment tasks,
which is identified by a single character, such as `<Space>`, `=`, `:`, `.`,
`|`, `&`, `#`, and `,`.
#### `=`
![](https://raw.githubusercontent.com/junegunn/i/master/easy-align/equals.gif)
- `=` Around the 1st occurrences
- `2=` Around the 2nd occurrences
- `*=` Around all occurrences
- `**=` Left/Right alternating alignment around all occurrences
- `<Enter>` Switching between left/right/center alignment modes
#### `<Space>`
![](https://raw.githubusercontent.com/junegunn/i/master/easy-align/spaces.gif)
- `<Space>` Around the 1st occurrences of whitespaces
- `2<Space>` Around the 2nd occurrences
- `-<Space>` Around the last occurrences
- `<Enter><Enter>2<Space>` Center-alignment around the 2nd occurrences
#### `,`
![](https://raw.githubusercontent.com/junegunn/i/master/easy-align/commas.gif)
- The predefined comma-rule places a comma right next to the preceding token
without margin (`{'stick_to_left': 1, 'left_margin': 0}`)
- You can change it with `<Right>` arrow
### Using regular expression
![](https://raw.githubusercontent.com/junegunn/i/master/easy-align/regex.gif)
You can use an arbitrary regular expression by
- pressing `<Ctrl-X>` in interactive mode
- or using `:EasyAlign /REGEX/` command in visual mode or in normal mode with
a range (e.g. `:%`)
### Different ways to start
![](https://raw.githubusercontent.com/junegunn/i/master/easy-align/modes.gif)
This demo shows how you can start interactive mode with visual selection or use
non-interactive `:EasyAlign` command.
### Aligning table cells
![](https://raw.githubusercontent.com/junegunn/i/master/easy-align/tables.gif)
Check out various alignment options and "live interactive mode".
### Syntax-aware alignment
![](https://raw.githubusercontent.com/junegunn/i/master/easy-align/yaml.gif)
Delimiters in strings and comments are ignored by default.
### Using blockwise-visual mode
![](https://raw.githubusercontent.com/junegunn/i/master/easy-align/blockwise-visual.gif)
You can limit the scope with blockwise-visual mode.
Usage
-----
### Flow of execution
<img src="https://raw.githubusercontent.com/junegunn/i/master/easy-align/usage.png" width="469">
There are two ways to use easy-align.
#### 1. `<Plug>` mappings (interactive mode)
The recommended method is to use `<Plug>(EasyAlign)` mapping in normal and
visual mode. They are usually mapped to `ga`, but you can choose any key
sequences.
```vim
nmap ga <Plug>(EasyAlign)
xmap ga <Plug>(EasyAlign)
```
1. `ga` key in visual mode, or `ga` followed by a motion or a text
object to start interactive mode
1. (Optional) Enter keys to cycle between alignment mode (left, right, or center)
1. (Optional) N-th delimiter (default: 1)
- `1` Around the 1st occurrences of delimiters
- `2` Around the 2nd occurrences of delimiters
- ...
- `*` Around all occurrences of delimiters
- `**` Left-right alternating alignment around all delimiters
- `-` Around the last occurrences of delimiters (`-1`)
- `-2` Around the second to last occurrences of delimiters
- ...
1. Delimiter key (a single keystroke; `<Space>`, `=`, `:`, `.`, `|`, `&`, `#`, `,`) or an arbitrary regular expression followed by `<CTRL-X>`
#### 2. Using `:EasyAlign` command
If you prefer command-line, use `:EasyAlign` command instead.
```vim
" Using predefined rules
:EasyAlign[!] [N-th] DELIMITER_KEY [OPTIONS]
" Using regular expression
:EasyAlign[!] [N-th] /REGEXP/ [OPTIONS]
```
### Regular expression vs. predefined rules
You can use regular expressions but it's usually much easier to use predefined
alignment rules that you can trigger with a single keystroke.
| Key | Description/Use cases |
| --------- | -------------------------------------------------------------------- |
| `<Space>` | General alignment around whitespaces |
| `=` | Operators containing equals sign (`=`, `==,` `!=`, `+=`, `&&=`, ...) |
| `:` | Suitable for formatting JSON or YAML |
| `.` | Multi-line method chaining |
| `,` | Multi-line method arguments |
| `&` | LaTeX tables (matches `&` and `\\`) |
| `#` | Ruby/Python comments |
| `"` | Vim comments |
| `<Bar>` | Table markdown |
You can also define your own rules with `g:easy_align_delimiters` which will
be described in [the later section](#extending-alignment-rules).
----
### Interactive mode
Interactive mode is started either with `<Plug>(EasyAlign)` mapping or with
`:EasyAlign` command with no argument.
#### Examples using predefined rules
| Keystrokes | Description | Equivalent command |
| ------------ | ---------------------------------- | --------------------- |
| `<Space>` | Around 1st whitespaces | `:'<,'>EasyAlign\ ` |
| `2<Space>` | Around 2nd whitespaces | `:'<,'>EasyAlign2\ ` |
| `-<Space>` | Around the last whitespaces | `:'<,'>EasyAlign-\ ` |
| `-2<Space>` | Around the 2nd to last whitespaces | `:'<,'>EasyAlign-2\ ` |
| `:` | Around 1st colon (`key: value`) | `:'<,'>EasyAlign:` |
| `<Right>:` | Around 1st colon (`key : value`) | `:'<,'>EasyAlign:>l1` |
| `=` | Around 1st operators with = | `:'<,'>EasyAlign=` |
| `3=` | Around 3rd operators with = | `:'<,'>EasyAlign3=` |
| `*=` | Around all operators with = | `:'<,'>EasyAlign*=` |
| `**=` | Left-right alternating around = | `:'<,'>EasyAlign**=` |
| `<Enter>=` | Right alignment around 1st = | `:'<,'>EasyAlign!=` |
| `<Enter>**=` | Right-left alternating around = | `:'<,'>EasyAlign!**=` |
Instead of finishing the alignment with a delimiter key, you can type in
a regular expression if you press `<CTRL-/>` or `<CTRL-X>`.
#### Alignment options in interactive mode
While in interactive mode, you can set alignment options using special shortcut
keys listed below. The meaning of each option will be described in
[the following sections](#alignment-options).
| Key | Option | Values |
| --------- | ------------------ | -------------------------------------------------- |
| `CTRL-F` | `filter` | Input string (`[gv]/.*/?`) |
| `CTRL-I` | `indentation` | shallow, deep, none, keep |
| `CTRL-L` | `left_margin` | Input number or string |
| `CTRL-R` | `right_margin` | Input number or string |
| `CTRL-D` | `delimiter_align` | left, center, right |
| `CTRL-U` | `ignore_unmatched` | 0, 1 |
| `CTRL-G` | `ignore_groups` | `[]`, `['String']`, `['Comment']`, `['String', 'Comment']` |
| `CTRL-A` | `align` | Input string (`/[lrc]+\*{0,2}/`) |
| `<Left>` | `stick_to_left` | `{ 'stick_to_left': 1, 'left_margin': 0 }` |
| `<Right>` | `stick_to_left` | `{ 'stick_to_left': 0, 'left_margin': 1 }` |
| `<Down>` | `*_margin` | `{ 'left_margin': 0, 'right_margin': 0 }` |
#### Live interactive mode
If you're performing a complex alignment where multiple options should be
carefully adjusted, try "live interactive mode" where you can preview the result
of the alignment on-the-fly as you type in.
Live interactive mode can be started with either `<Plug>(LiveEasyAlign)` map
or `:LiveEasyAlign` command. Or you can switch to live interactive mode while
in ordinary interactive mode by pressing `<CTRL-P>`. (P for Preview)
In live interactive mode, you have to type in the same delimiter (or
`<CTRL-X>` on regular expression) again to finalize the alignment. This allows
you to preview the result of the alignment and freely change the delimiter
using backspace key without leaving the interactive mode.
### :EasyAlign command
Instead of starting interactive mode, you can use non-interactive `:EasyAlign`
command.
```vim
" Using predefined alignment rules
" :EasyAlign[!] [N-th] DELIMITER_KEY [OPTIONS]
:EasyAlign :
:EasyAlign =
:EasyAlign *=
:EasyAlign 3\
" Using arbitrary regular expressions
" :EasyAlign[!] [N-th] /REGEXP/ [OPTIONS]
:EasyAlign /[:;]\+/
:EasyAlign 2/[:;]\+/
:EasyAlign */[:;]\+/
:EasyAlign **/[:;]\+/
```
A command can end with alignment options, [each of which will be discussed in
detail later](#alignment-options), in Vim dictionary format.
- `:EasyAlign * /[:;]\+/ { 'stick_to_left': 1, 'left_margin': 0 }`
`stick_to_left` of 1 means that the matched delimiter should be positioned right
next to the preceding token, and `left_margin` of 0 removes the margin on the
left. So we get:
apple;: banana:: cake
data;; exchange:; format
You don't have to write complete names as long as they're distinguishable.
- `:EasyAlign * /[:;]\+/ { 'stl': 1, 'l': 0 }`
You can even omit spaces between the arguments.
- `:EasyAlign*/[:;]\+/{'s':1,'l':0}`
Nice. But let's make it even shorter. Option values can be written in shorthand
notation.
- `:EasyAlign*/[:;]\+/<l0`
The following table summarizes the shorthand notation.
| Option | Expression |
| ------------------ | -------------- |
| `filter` | `[gv]/.*/` |
| `left_margin` | `l[0-9]+` |
| `right_margin` | `r[0-9]+` |
| `stick_to_left` | `<` or `>` |
| `ignore_unmatched` | `iu[01]` |
| `ignore_groups` | `ig\[.*\]` |
| `align` | `a[lrc*]*` |
| `delimiter_align` | `d[lrc]` |
| `indentation` | `i[ksdn]` |
### Partial alignment in blockwise-visual mode
In blockwise-visual mode (`CTRL-V`), EasyAlign command aligns only the selected
text in the block, instead of the whole lines in the range.
Consider the following case where you want to align text around `=>` operators.
```ruby
my_hash = { :a => 1,
:aa => 2,
:aaa => 3 }
```
In non-blockwise visual mode (`v` / `V`), `<Enter>=` won't work since the
assignment operator in the first line gets in the way. So we instead enter
blockwise-visual mode (`CTRL-V`), and select the text *around*
`=>` operators, then press `<Enter>=`.
```ruby
my_hash = { :a => 1,
:aa => 2,
:aaa => 3 }
```
However, in this case, we don't really need blockwise visual mode
since the same can be easily done using the negative N-th parameter: `<Enter>-=`
Alignment options
-----------------
### List of options
| Option | Type | Default | Description |
| ------------------ | ------- | --------------------- | ------------------------------------------------------- |
| `filter` | string | | Line filtering expression: `g/../` or `v/../` |
| `left_margin` | number | 1 | Number of spaces to attach before delimiter |
| `left_margin` | string | `' '` | String to attach before delimiter |
| `right_margin` | number | 1 | Number of spaces to attach after delimiter |
| `right_margin` | string | `' '` | String to attach after delimiter |
| `stick_to_left` | boolean | 0 | Whether to position delimiter on the left-side |
| `ignore_groups` | list | ['String', 'Comment'] | Delimiters in these syntax highlight groups are ignored |
| `ignore_unmatched` | boolean | 1 | Whether to ignore lines without matching delimiter |
| `indentation` | string | `k` | Indentation method (*k*eep, *d*eep, *s*hallow, *n*one) |
| `delimiter_align` | string | `r` | Determines how to align delimiters of different lengths |
| `align` | string | `l` | Alignment modes for multiple occurrences of delimiters |
There are 4 ways to set alignment options (from lowest precedence to highest):
1. Some option values can be set with corresponding global variables
2. Option values can be specified in the definition of each alignment rule
3. Option values can be given as arguments to `:EasyAlign` command
4. Option values can be set in interactive mode using special shortcut keys
| Option name | Shortcut key | Abbreviated | Global variable |
| ------------------ | ------------------- | -------------- | ------------------------------- |
| `filter` | `CTRL-F` | `[gv]/.*/` | |
| `left_margin` | `CTRL-L` | `l[0-9]+` | |
| `right_margin` | `CTRL-R` | `r[0-9]+` | |
| `stick_to_left` | `<Left>`, `<Right>` | `<` or `>` | |
| `ignore_groups` | `CTRL-G` | `ig\[.*\]` | `g:easy_align_ignore_groups` |
| `ignore_unmatched` | `CTRL-U` | `iu[01]` | `g:easy_align_ignore_unmatched` |
| `indentation` | `CTRL-I` | `i[ksdn]` | `g:easy_align_indentation` |
| `delimiter_align` | `CTRL-D` | `d[lrc]` | `g:easy_align_delimiter_align` |
| `align` | `CTRL-A` | `a[lrc*]*` | |
### Filtering lines
With `filter` option, you can align lines that only match or do not match a
given pattern. There are several ways to set the pattern.
1. Press `CTRL-F` in interactive mode and type in `g/pat/` or `v/pat/`
2. In command-line, it can be written in dictionary format: `{'filter': 'g/pat/'}`
3. Or in shorthand notation: `g/pat/` or `v/pat/`
(You don't need to escape '/'s in the regular expression)
#### Examples
```vim
" Start interactive mode with filter option set to g/hello/
EasyAlign g/hello/
" Start live interactive mode with filter option set to v/goodbye/
LiveEasyAlign v/goodbye/
" Align the lines with 'hi' around the first colons
EasyAlign:g/hi/
```
### Ignoring delimiters in comments or strings
EasyAlign can be configured to ignore delimiters in certain syntax highlight
groups, such as code comments or strings. By default, delimiters that are
highlighted as code comments or strings are ignored.
```vim
" Default:
" If a delimiter is in a highlight group whose name matches
" any of the followings, it will be ignored.
let g:easy_align_ignore_groups = ['Comment', 'String']
```
For example, the following paragraph
```ruby
{
# Quantity of apples: 1
apple: 1,
# Quantity of bananas: 2
bananas: 2,
# Quantity of grape:fruits: 3
'grape:fruits': 3
}
```
becomes as follows on `<Enter>:` (or `:EasyAlign:`)
```ruby
{
# Quantity of apples: 1
apple: 1,
# Quantity of bananas: 2
bananas: 2,
# Quantity of grape:fruits: 3
'grape:fruits': 3
}
```
Naturally, this feature only works when syntax highlighting is enabled.
You can change the default rule by using one of these 4 methods.
1. Press `CTRL-G` in interactive mode to switch groups
2. Define global `g:easy_align_ignore_groups` list
3. Define a custom rule in `g:easy_align_delimiters` with `ignore_groups` option
4. Provide `ignore_groups` option to `:EasyAlign` command.
e.g. `:EasyAlign:ig[]`
For example if you set `ignore_groups` option to be an empty list, you get
```ruby
{
# Quantity of apples: 1
apple: 1,
# Quantity of bananas: 2
bananas: 2,
# Quantity of grape: fruits: 3
'grape: fruits': 3
}
```
If a pattern in `ignore_groups` is prepended by a `!`, it will have the opposite
meaning. For instance, if `ignore_groups` is given as `['!Comment']`, delimiters
that are *not* highlighted as Comment will be ignored during the alignment.
### Ignoring unmatched lines
`ignore_unmatched` option determines how EasyAlign command processes lines that
do not have N-th delimiter.
1. In left-alignment mode, they are ignored
2. In right or center-alignment mode, they are *not* ignored, and the last
tokens from those lines are aligned as well as if there is an invisible
trailing delimiter at the end of each line
3. If `ignore_unmatched` is 1, they are ignored regardless of the alignment mode
4. If `ignore_unmatched` is 0, they are *not* ignored regardless of the mode
Let's take an example.
When we align the following code block around the (1st) colons,
```ruby
{
apple: proc {
this_line_does_not_have_a_colon
},
bananas: 2,
grapefruits: 3
}
```
this is usually what we want.
```ruby
{
apple: proc {
this_line_does_not_have_a_colon
},
bananas: 2,
grapefruits: 3
}
```
However, we can override this default behavior by setting `ignore_unmatched`
option to zero using one of the following methods.
1. Press `CTRL-U` in interactive mode to toggle `ignore_unmatched` option
2. Set the global `g:easy_align_ignore_unmatched` variable to 0
3. Define a custom alignment rule with `ignore_unmatched` option set to 0
4. Provide `ignore_unmatched` option to `:EasyAlign` command. e.g. `:EasyAlign:iu0`
Then we get,
```ruby
{
apple: proc {
this_line_does_not_have_a_colon
},
bananas: 2,
grapefruits: 3
}
```
### Aligning delimiters of different lengths
Global `g:easy_align_delimiter_align` option and rule-wise/command-wise
`delimiter_align` option determines how matched delimiters of different lengths
are aligned.
```ruby
apple = 1
banana += apple
cake ||= banana
```
By default, delimiters are right-aligned as follows.
```ruby
apple = 1
banana += apple
cake ||= banana
```
However, with `:EasyAlign=dl`, delimiters are left-aligned.
```ruby
apple = 1
banana += apple
cake ||= banana
```
And on `:EasyAlign=dc`, center-aligned.
```ruby
apple = 1
banana += apple
cake ||= banana
```
In interactive mode, you can change the option value with `CTRL-D` key.
### Adjusting indentation
By default :EasyAlign command keeps the original indentation of the lines. But
then again we have `indentation` option. See the following example.
```ruby
# Lines with different indentation
apple = 1
banana = 2
cake = 3
daisy = 4
eggplant = 5
# Default: _k_eep the original indentation
# :EasyAlign=
apple = 1
banana = 2
cake = 3
daisy = 4
eggplant = 5
# Use the _s_hallowest indentation among the lines
# :EasyAlign=is
apple = 1
banana = 2
cake = 3
daisy = 4
eggplant = 5
# Use the _d_eepest indentation among the lines
# :EasyAlign=id
apple = 1
banana = 2
cake = 3
daisy = 4
eggplant = 5
# Indentation: _n_one
# :EasyAlign=in
apple = 1
banana = 2
cake = 3
daisy = 4
eggplant = 5
```
In interactive mode, you can change the option value with `CTRL-I` key.
### Alignments over multiple occurrences of delimiters
As stated above, "N-th" parameter is used to target specific occurrences of
the delimiter when it appears multiple times in each line.
To recap:
```vim
" Left-alignment around the FIRST occurrences of delimiters
:EasyAlign =
" Left-alignment around the SECOND occurrences of delimiters
:EasyAlign 2=
" Left-alignment around the LAST occurrences of delimiters
:EasyAlign -=
" Left-alignment around ALL occurrences of delimiters
:EasyAlign *=
" Left-right ALTERNATING alignment around all occurrences of delimiters
:EasyAlign **=
" Right-left ALTERNATING alignment around all occurrences of delimiters
:EasyAlign! **=
```
In addition to these, you can fine-tune alignments over multiple occurrences
of the delimiters with 'align' option. (The option can also be set in
interactive mode with the special key `CTRL-A`)
```vim
" Left alignment over the first two occurrences of delimiters
:EasyAlign = { 'align': 'll' }
" Right, left, center alignment over the 1st to 3rd occurrences of delimiters
:EasyAlign = { 'a': 'rlc' }
" Using shorthand notation
:EasyAlign = arlc
" Right, left, center alignment over the 2nd to 4th occurrences of delimiters
:EasyAlign 2=arlc
" (*) Repeating alignments (default: l, r, or c)
" Right, left, center, center, center, center, ...
:EasyAlign *=arlc
" (**) Alternating alignments (default: lr or rl)
" Right, left, center, right, left, center, ...
:EasyAlign **=arlc
" Right, left, center, center, center, ... repeating alignment
" over the 3rd to the last occurrences of delimiters
:EasyAlign 3=arlc*
" Right, left, center, right, left, center, ... alternating alignment
" over the 3rd to the last occurrences of delimiters
:EasyAlign 3=arlc**
```
### Extending alignment rules
Although the default rules should cover the most of the use cases,
you can extend the rules by setting a dictionary named `g:easy_align_delimiters`.
You may refer to the definitions of the default alignment rules
[here](https://github.com/junegunn/vim-easy-align/blob/2.9.6/autoload/easy_align.vim#L32-L46).
#### Examples
```vim
let g:easy_align_delimiters = {
\ '>': { 'pattern': '>>\|=>\|>' },
\ '/': {
\ 'pattern': '//\+\|/\*\|\*/',
\ 'delimiter_align': 'l',
\ 'ignore_groups': ['!Comment'] },
\ ']': {
\ 'pattern': '[[\]]',
\ 'left_margin': 0,
\ 'right_margin': 0,
\ 'stick_to_left': 0
\ },
\ ')': {
\ 'pattern': '[()]',
\ 'left_margin': 0,
\ 'right_margin': 0,
\ 'stick_to_left': 0
\ },
\ 'd': {
\ 'pattern': ' \(\S\+\s*[;=]\)\@=',
\ 'left_margin': 0,
\ 'right_margin': 0
\ }
\ }
```
Other options
-------------
### Disabling &foldmethod during alignment
[It is reported](https://github.com/junegunn/vim-easy-align/issues/14) that
`&foldmethod` value of `expr` or `syntax` can significantly slow down the
alignment when editing a large, complex file with many folds. To alleviate this
issue, EasyAlign provides an option to temporarily set `&foldmethod` to `manual`
during the alignment task. In order to enable this feature, set
`g:easy_align_bypass_fold` switch to 1.
```vim
let g:easy_align_bypass_fold = 1
```
### Left/right/center mode switch in interactive mode
In interactive mode, you can choose the alignment mode you want by pressing
enter keys. The non-bang command, `:EasyAlign` starts in left-alignment mode
and changes to right and center mode as you press enter keys, while the bang
version first starts in right-alignment mode.
- `:EasyAlign`
- Left, Right, Center
- `:EasyAlign!`
- Right, Left, Center
If you do not prefer this default mode transition, you can define your own
settings as follows.
```vim
let g:easy_align_interactive_modes = ['l', 'r']
let g:easy_align_bang_interactive_modes = ['c', 'r']
```
Advanced examples and use cases
-------------------------------
See [EXAMPLES.md](https://github.com/junegunn/vim-easy-align/blob/master/EXAMPLES.md)
for more examples.
Related work
------------
- [DrChip's Alignment Tool for Vim](http://www.drchip.org/astronaut/vim/align.html)
- [Tabular](https://github.com/godlygeek/tabular)
Author
------
[Junegunn Choi](https://github.com/junegunn)
License
-------
MIT

File diff suppressed because it is too large Load diff

View file

@ -1,891 +0,0 @@
*easy-align.txt* easy-align Last change: December 14 2014
EASY-ALIGN - TABLE OF CONTENTS *easyalign* *easy-align* *easy-align-toc*
==============================================================================
vim-easy-align
Demo |easy-align-1|
Features |easy-align-2|
Installation |easy-align-3|
TLDR - One-minute guide |easy-align-4|
Usage |easy-align-5|
Concept of alignment rule |easy-align-5-1|
Execution models |easy-align-5-2|
1. Using <Plug> mappings |easy-align-5-2-1|
2. Using :EasyAlign command |easy-align-5-2-2|
Interactive mode |easy-align-5-3|
Predefined alignment rules |easy-align-5-3-1|
Examples |easy-align-5-3-2|
Using regular expressions |easy-align-5-3-3|
Alignment options in interactive mode |easy-align-5-3-4|
Live interactive mode |easy-align-5-4|
Non-interactive mode |easy-align-5-5|
Partial alignment in blockwise-visual mode |easy-align-5-6|
Alignment options |easy-align-6|
List of options |easy-align-6-1|
Filtering lines |easy-align-6-2|
Examples |easy-align-6-2-1|
Ignoring delimiters in comments or strings |easy-align-6-3|
Ignoring unmatched lines |easy-align-6-4|
Aligning delimiters of different lengths |easy-align-6-5|
Adjusting indentation |easy-align-6-6|
Alignments over multiple occurrences of delimiters |easy-align-6-7|
Extending alignment rules |easy-align-6-8|
Examples |easy-align-6-8-1|
Other options |easy-align-7|
Disabling &foldmethod during alignment |easy-align-7-1|
Left/right/center mode switch in interactive mode |easy-align-7-2|
Advanced examples and use cases |easy-align-8|
Related work |easy-align-9|
Author |easy-align-10|
License |easy-align-11|
VIM-EASY-ALIGN *vim-easy-align*
==============================================================================
A simple, easy-to-use Vim alignment plugin.
*easy-align-1*
DEMO *easy-align-demo*
==============================================================================
Screencast:
https://raw.githubusercontent.com/junegunn/i/master/vim-easy-align.gif
(Too fast? Slower GIF is {here}{1})
{1} https://raw.githubusercontent.com/junegunn/i/master/vim-easy-align-slow.gif
*easy-align-2*
FEATURES *easy-align-features*
==============================================================================
- Easy to use
- Comes with a predefined set of alignment rules
- Provides a fast and intuitive interface
- Extensible
- You can define your own rules
- Supports arbitrary regular expressions
- Optimized for code editing
- Takes advantage of syntax highlighting feature to avoid unwanted
alignments
*easy-align-3*
INSTALLATION *easy-align-installation*
==============================================================================
Use your favorite plugin manager.
Using {vim-plug}{2}:
>
Plug 'junegunn/vim-easy-align'
<
{2} https://github.com/junegunn/vim-plug
*easy-align-4*
TLDR - ONE-MINUTE GUIDE *easy-align-tldr-one-minute-guide*
==============================================================================
Add the following mappings to your .vimrc.
*<Plug>(EasyAlign)*
>
" Start interactive EasyAlign in visual mode (e.g. vip<Enter>)
vmap <Enter> <Plug>(EasyAlign)
" Start interactive EasyAlign for a motion/text object (e.g. gaip)
nmap ga <Plug>(EasyAlign)
<
And with the following lines of text,
>
apple =red
grass+=green
sky-= blue
<
try these commands:
- vip<Enter>=
- `v`isual-select `i`nner `p`aragraph
- Start EasyAlign command (<Enter>)
- Align around `=`
- `gaip=`
- Start EasyAlign command (`ga`) for `i`nner `p`aragraph
- Align around `=`
Notice that the commands are repeatable with `.` key if you have installed
{repeat.vim}{3}. Install {visualrepeat}{4} as well if you want to repeat in
visual mode.
{3} https://github.com/tpope/vim-repeat
{4} https://github.com/vim-scripts/visualrepeat
*easy-align-5*
USAGE *easy-align-usage*
==============================================================================
< Concept of alignment rule >_________________________________________________~
*easy-align-concept-of-alignment-rule*
*easy-align-5-1*
Though easy-align can align lines of text around any delimiter, it provides
shortcuts for the most common use cases with the concept of "alignment rule".
An alignment rule is a predefined set of options for common alignment tasks,
which is identified by a single character, DELIMITER KEY, such as <Space>,
`=`, `:`, `.`, `|`, `&`, `#`, and `,`.
Think of it as a shortcut. Instead of writing regular expression and setting
several options, you can just type in a single character.
< Execution models >__________________________________________________________~
*easy-align-execution-models*
*easy-align-5-2*
There are two ways to use easy-align.
1. Using <Plug> mappings~
*easy-align-1-using-plug-mappings*
*easy-align-5-2-1*
The recommended method is to use <Plug> mappings as described earlier.
*<Plug>(LiveEasyAlign)*
----------------------+--------+-----------------------------------------------------
Mapping | Mode | Description ~
----------------------+--------+-----------------------------------------------------
<Plug>(EasyAlign) | normal | Start interactive mode for a motion/text object
<Plug>(EasyAlign) | visual | Start interactive mode for the selection
<Plug>(LiveEasyAlign) | normal | Start live-interactive mode for a motion/text object
<Plug>(LiveEasyAlign) | visual | Start live-interactive mode for the selection
----------------------+--------+-----------------------------------------------------
2. Using :EasyAlign command~
*easy-align-2-using-easyalign-command*
*easy-align-5-2-2*
*:EasyAlign*
If you prefer command-line or do not want to start interactive mode, you can
use `:EasyAlign` command instead.
*:LiveEasyAlign*
-------------------------------------------+-----------------------------------------------
Mode | Command ~
-------------------------------------------+-----------------------------------------------
Interactive mode | `:EasyAlign[!] [OPTIONS]`
Live interactive mode | `:LiveEasyAlign[!] [...]`
Non-interactive mode (predefined rules) | `:EasyAlign[!] [N-th] DELIMITER_KEY [OPTIONS]`
Non-interactive mode (regular expressions) | `:EasyAlign[!] [N-th] /REGEXP/ [OPTIONS]`
-------------------------------------------+-----------------------------------------------
< Interactive mode >__________________________________________________________~
*easy-align-interactive-mode*
*easy-align-5-3*
The following sections will assume that you have <Plug>(EasyAlign) mappings in
your .vimrc as below:
>
" Start interactive EasyAlign in visual mode (e.g. vip<Enter>)
vmap <Enter> <Plug>(EasyAlign)
" Start interactive EasyAlign for a motion/text object (e.g. gaip)
nmap ga <Plug>(EasyAlign)
<
With these mappings, you can align text with only a few keystrokes.
1. <Enter> key in visual mode, or `ga` followed by a motion or a text object to
start interactive mode
2. Optional: Enter keys to select alignment mode (left, right, or center)
3. Optional: N-th delimiter (default: 1)
- `1` Around the 1st occurrences of delimiters
- `2` Around the 2nd occurrences of delimiters
- ...
- `*` Around all occurrences of delimiters
- `**` Left-right alternating alignment around all delimiters
- `-` Around the last occurrences of delimiters (`-1`)
- `-2` Around the second to last occurrences of delimiters
- ...
4. Delimiter key (a single keystroke; <Space>, `=`, `:`, `.`, `|`, `&`, `#`, `,`)
Predefined alignment rules~
*easy-align-predefined-alignment-rules*
*easy-align-5-3-1*
--------------+--------------------------------------------------------------------
Delimiter key | Description/Use cases ~
--------------+--------------------------------------------------------------------
<Space> | General alignment around whitespaces
`=` | Operators containing equals sign ( `=` , `==,` `!=` , `+=` , `&&=` , ...)
`:` | Suitable for formatting JSON or YAML
`.` | Multi-line method chaining
`,` | Multi-line method arguments
`&` | LaTeX tables (matches `&` and `\\` )
`#` | Ruby/Python comments
`"` | Vim comments
<Bar> | Table markdown
--------------+--------------------------------------------------------------------
*g:easy_align_delimiters*
You can override these default rules or define your own rules with
`g:easy_align_delimiters`, which will be described in {the later section}{5}.
{5} https://github.com/junegunn/vim-easy-align#extending-alignment-rules
Examples~
*easy-align-examples*
*easy-align-5-3-2*
------------------+------------------------------------+--------------------
With visual map | Description | Equivalent command ~
------------------+------------------------------------+--------------------
<Enter><Space> | Around 1st whitespaces | :'<,'>EasyAlign\
<Enter>2<Space> | Around 2nd whitespaces | :'<,'>EasyAlign2\
<Enter>-<Space> | Around the last whitespaces | :'<,'>EasyAlign-\
<Enter>-2<Space> | Around the 2nd to last whitespaces | :'<,'>EasyAlign-2\
<Enter>: | Around 1st colon ( `key: value` ) | :'<,'>EasyAlign:
<Enter><Right>: | Around 1st colon ( `key : value` ) | :'<,'>EasyAlign:<l1
<Enter>= | Around 1st operators with = | :'<,'>EasyAlign=
<Enter>3= | Around 3rd operators with = | :'<,'>EasyAlign3=
<Enter>*= | Around all operators with = | :'<,'>EasyAlign*=
<Enter>**= | Left-right alternating around = | :'<,'>EasyAlign**=
<Enter><Enter>= | Right alignment around 1st = | :'<,'>EasyAlign!=
<Enter><Enter>**= | Right-left alternating around = | :'<,'>EasyAlign!**=
------------------+------------------------------------+--------------------
Using regular expressions~
*easy-align-using-regular-expressions*
*easy-align-5-3-3*
Instead of finishing the command with a predefined delimiter key, you can type
in a regular expression after CTRL-/ or CTRL-X key. For example, if you want
to align text around all occurrences of numbers:
- <Enter>
- `*`
- CTRL-X
- `[0-9]\+`
Alignment options in interactive mode~
*easy-align-alignment-options-in-interactive-mode*
*easy-align-5-3-4*
While in interactive mode, you can set alignment options using special
shortcut keys listed below. The meaning of each option will be described in
{the following sections}{6}.
--------+--------------------+---------------------------------------------------
Key | Option | Values ~
--------+--------------------+---------------------------------------------------
CTRL-F | `filter` | Input string ( `[gv]/.*/?` )
CTRL-I | `indentation` | shallow, deep, none, keep
CTRL-L | `left_margin` | Input number or string
CTRL-R | `right_margin` | Input number or string
CTRL-D | `delimiter_align` | left, center, right
CTRL-U | `ignore_unmatched` | 0, 1
CTRL-G | `ignore_groups` | [], ["String'], ["Comment'], ["String', "Comment']
CTRL-A | `align` | Input string ( `/[lrc]+\*{0,2}/` )
<Left> | `stick_to_left` | `{ 'stick_to_left': 1, 'left_margin': 0 }`
<Right> | `stick_to_left` | `{ 'stick_to_left': 0, 'left_margin': 1 }`
<Down> | `*_margin` | `{ 'left_margin': 0, 'right_margin': 0 }`
--------+--------------------+---------------------------------------------------
{6} https://github.com/junegunn/vim-easy-align#alignment-options
< Live interactive mode >_____________________________________________________~
*easy-align-live-interactive-mode*
*easy-align-5-4*
If you're performing a complex alignment where multiple options should be
carefully adjusted, try "live interactive mode" where you can preview the
result of the alignment on-the-fly as you type in.
Live interactive mode can be started with either <Plug>(LiveEasyAlign) map or
`:LiveEasyAlign` command. Or you can switch to live interactive mode while in
ordinary interactive mode by pressing CTRL-P. (P for Preview)
In live interactive mode, you have to type in the same delimiter (or CTRL-X on
regular expression) again to finalize the alignment. This allows you to
preview the result of the alignment and freely change the delimiter using
backspace key without leaving the interactive mode.
< Non-interactive mode >______________________________________________________~
*easy-align-non-interactive-mode*
*easy-align-5-5*
Instead of starting interactive mode, you can use declarative, non-interactive
`:EasyAlign` command.
>
" Using predefined alignment rules
" :EasyAlign[!] [N-th] DELIMITER_KEY [OPTIONS]
:EasyAlign :
:EasyAlign =
:EasyAlign *=
:EasyAlign 3\
" Using arbitrary regular expressions
" :EasyAlign[!] [N-th] /REGEXP/ [OPTIONS]
:EasyAlign /[:;]\+/
:EasyAlign 2/[:;]\+/
:EasyAlign */[:;]\+/
:EasyAlign **/[:;]\+/
<
A command can end with alignment options, {each of which will be discussed in
detail later}{6}, in Vim dictionary format.
- `:EasyAlign * /[:;]\+/ { 'stick_to_left': 1, 'left_margin': 0 }`
`stick_to_left` of 1 means that the matched delimiter should be positioned
right next to the preceding token, and `left_margin` of 0 removes the margin
on the left. So we get:
>
apple;: banana:: cake
data;; exchange:; format
<
Option names are fuzzy-matched, so you can write as follows:
- `:EasyAlign * /[:;]\+/ { 'stl': 1, 'l': 0 }`
You can even omit spaces between the arguments, so concisely (or cryptically):
- `:EasyAlign*/[:;]\+/{'s':1,'l':0}`
Nice. But let's make it even shorter. Option values can be written in
shorthand notation.
- `:EasyAlign*/[:;]\+/<l0`
The following table summarizes the shorthand notation.
-------------------+-----------
Option | Expression~
-------------------+-----------
`filter` | `[gv]/.*/`
`left_margin` | `l[0-9]+`
`right_margin` | `r[0-9]+`
`stick_to_left` | `<` or `>`
`ignore_unmatched` | `iu[01]`
`ignore_groups` | `ig\[.*\]`
`align` | `a[lrc*]*`
`delimiter_align` | `d[lrc]`
`indentation` | `i[ksdn]`
-------------------+-----------
For your information, the same operation can be done in interactive mode as
follows:
- <Enter>
- `*`
- <Left>
- CTRL-X
- `[:;]\+`
{6} https://github.com/junegunn/vim-easy-align#alignment-options
< Partial alignment in blockwise-visual mode >________________________________~
*easy-align-partial-alignment-in-blockwise-visual-mode*
*easy-align-5-6*
In blockwise-visual mode (CTRL-V), EasyAlign command aligns only the selected
text in the block, instead of the whole lines in the range.
Consider the following case where you want to align text around `=>`
operators.
>
my_hash = { :a => 1,
:aa => 2,
:aaa => 3 }
<
In non-blockwise visual mode (`v` / `V`), <Enter>= won't work since the
assignment operator in the first line gets in the way. So we instead enter
blockwise-visual mode (CTRL-V), and select the text around`=>` operators, then
press <Enter>=.
>
my_hash = { :a => 1,
:aa => 2,
:aaa => 3 }
<
However, in this case, we don't really need blockwise visual mode since the
same can be easily done using the negative N-th parameter: <Enter>-=
*easy-align-6*
ALIGNMENT OPTIONS *easy-align-alignment-options*
==============================================================================
< List of options >___________________________________________________________~
*easy-align-list-of-options*
*easy-align-6-1*
-------------------+---------+-----------------------+--------------------------------------------------------
Option | Type | Default | Description ~
-------------------+---------+-----------------------+--------------------------------------------------------
`filter` | string | | Line filtering expression: `g/../` or `v/../`
`left_margin` | number | 1 | Number of spaces to attach before delimiter
`left_margin` | string | `' '` | String to attach before delimiter
`right_margin` | number | 1 | Number of spaces to attach after delimiter
`right_margin` | string | `' '` | String to attach after delimiter
`stick_to_left` | boolean | 0 | Whether to position delimiter on the left-side
`ignore_groups` | list | ["String', "Comment'] | Delimiters in these syntax highlight groups are ignored
`ignore_unmatched` | boolean | 1 | Whether to ignore lines without matching delimiter
`indentation` | string | `k` | Indentation method (keep, deep, shallow, none)
`delimiter_align` | string | `r` | Determines how to align delimiters of different lengths
`align` | string | `l` | Alignment modes for multiple occurrences of delimiters
-------------------+---------+-----------------------+--------------------------------------------------------
There are 4 ways to set alignment options (from lowest precedence to highest):
1. Some option values can be set with corresponding global variables
2. Option values can be specified in the definition of each alignment rule
3. Option values can be given as arguments to `:EasyAlign` command
4. Option values can be set in interactive mode using special shortcut keys
*g:easy_align_ignore_groups* *g:easy_align_ignore_unmatched*
*g:easy_align_indentation* *g:easy_align_delimiter_align*
-------------------+-----------------+-------------+--------------------------------
Option name | Shortcut key | Abbreviated | Global variable ~
-------------------+-----------------+-------------+--------------------------------
`filter` | CTRL-F | `[gv]/.*/` |
`left_margin` | CTRL-L | `l[0-9]+` |
`right_margin` | CTRL-R | `r[0-9]+` |
`stick_to_left` | <Left>, <Right> | `<` or `>` |
`ignore_groups` | CTRL-G | `ig\[.*\]` | `g:easy_align_ignore_groups`
`ignore_unmatched` | CTRL-U | `iu[01]` | `g:easy_align_ignore_unmatched`
`indentation` | CTRL-I | `i[ksdn]` | `g:easy_align_indentation`
`delimiter_align` | CTRL-D | `d[lrc]` | `g:easy_align_delimiter_align`
`align` | CTRL-A | `a[lrc*]*` |
-------------------+-----------------+-------------+--------------------------------
< Filtering lines >___________________________________________________________~
*easy-align-filtering-lines*
*easy-align-6-2*
With `filter` option, you can align lines that only match or do not match a
given pattern. There are several ways to set the pattern.
1. Press CTRL-F in interactive mode and type in `g/pat/` or `v/pat/`
2. In command-line, it can be written in dictionary format: `{'filter':
'g/pat/'}`
3. Or in shorthand notation: `g/pat/` or `v/pat/`
(You don't need to escape "/'s in the regular expression)
Examples~
*easy-align-6-2-1*
>
" Start interactive mode with filter option set to g/hello/
EasyAlign g/hello/
" Start live interactive mode with filter option set to v/goodbye/
LiveEasyAlign v/goodbye/
" Align the lines with 'hi' around the first colons
EasyAlign:g/hi/
<
< Ignoring delimiters in comments or strings >________________________________~
*easy-align-ignoring-delimiters-in-comments-or-strings*
*easy-align-6-3*
EasyAlign can be configured to ignore delimiters in certain syntax highlight
groups, such as code comments or strings. By default, delimiters that are
highlighted as code comments or strings are ignored.
>
" Default:
" If a delimiter is in a highlight group whose name matches
" any of the followings, it will be ignored.
let g:easy_align_ignore_groups = ['Comment', 'String']
<
For example, the following paragraph
>
{
# Quantity of apples: 1
apple: 1,
# Quantity of bananas: 2
bananas: 2,
# Quantity of grape:fruits: 3
'grape:fruits': 3
}
<
becomes as follows on <Enter>: (or `:EasyAlign:`)
>
{
# Quantity of apples: 1
apple: 1,
# Quantity of bananas: 2
bananas: 2,
# Quantity of grape:fruits: 3
'grape:fruits': 3
}
<
Naturally, this feature only works when syntax highlighting is enabled.
You can change the default rule by using one of these 4 methods.
1. Press CTRL-G in interactive mode to switch groups
2. Define global `g:easy_align_ignore_groups` list
3. Define a custom rule in `g:easy_align_delimiters` with `ignore_groups` option
4. Provide `ignore_groups` option to `:EasyAlign` command. e.g. `:EasyAlign:ig[]`
For example if you set `ignore_groups` option to be an empty list, you get
>
{
# Quantity of apples: 1
apple: 1,
# Quantity of bananas: 2
bananas: 2,
# Quantity of grape: fruits: 3
'grape: fruits': 3
}
<
If a pattern in `ignore_groups` is prepended by a `!`, it will have the
opposite meaning. For instance, if `ignore_groups` is given as `['!Comment']`,
delimiters that are not highlighted as Comment will be ignored during the
alignment.
< Ignoring unmatched lines >__________________________________________________~
*easy-align-ignoring-unmatched-lines*
*easy-align-6-4*
`ignore_unmatched` option determines how EasyAlign command processes lines
that do not have N-th delimiter.
1. In left-alignment mode, they are ignored
2. In right or center-alignment mode, they are not ignored, and the last tokens
from those lines are aligned as well as if there is an invisible trailing
delimiter at the end of each line
3. If `ignore_unmatched` is 1, they are ignored regardless of the alignment mode
4. If `ignore_unmatched` is 0, they are not ignored regardless of the mode
Let's take an example. When we align the following code block around the (1st)
colons,
>
{
apple: proc {
this_line_does_not_have_a_colon
},
bananas: 2,
grapefruits: 3
}
<
this is usually what we want.
>
{
apple: proc {
this_line_does_not_have_a_colon
},
bananas: 2,
grapefruits: 3
}
<
However, we can override this default behavior by setting `ignore_unmatched`
option to zero using one of the following methods.
1. Press CTRL-U in interactive mode to toggle `ignore_unmatched` option
2. Set the global `g:easy_align_ignore_unmatched` variable to 0
3. Define a custom alignment rule with `ignore_unmatched` option set to 0
4. Provide `ignore_unmatched` option to `:EasyAlign` command. e.g.
`:EasyAlign:iu0`
Then we get,
>
{
apple: proc {
this_line_does_not_have_a_colon
},
bananas: 2,
grapefruits: 3
}
<
< Aligning delimiters of different lengths >__________________________________~
*easy-align-aligning-delimiters-of-different-lengths*
*easy-align-6-5*
Global `g:easy_align_delimiter_align` option and rule-wise/command-wise
`delimiter_align` option determines how matched delimiters of different
lengths are aligned.
>
apple = 1
banana += apple
cake ||= banana
<
By default, delimiters are right-aligned as follows.
>
apple = 1
banana += apple
cake ||= banana
<
However, with `:EasyAlign=dl`, delimiters are left-aligned.
>
apple = 1
banana += apple
cake ||= banana
<
And on `:EasyAlign=dc`, center-aligned.
>
apple = 1
banana += apple
cake ||= banana
<
In interactive mode, you can change the option value with CTRL-D key.
< Adjusting indentation >_____________________________________________________~
*easy-align-adjusting-indentation*
*easy-align-6-6*
By default :EasyAlign command keeps the original indentation of the lines. But
then again we have `indentation` option. See the following example.
>
# Lines with different indentation
apple = 1
banana = 2
cake = 3
daisy = 4
eggplant = 5
# Default: _k_eep the original indentation
# :EasyAlign=
apple = 1
banana = 2
cake = 3
daisy = 4
eggplant = 5
# Use the _s_hallowest indentation among the lines
# :EasyAlign=is
apple = 1
banana = 2
cake = 3
daisy = 4
eggplant = 5
# Use the _d_eepest indentation among the lines
# :EasyAlign=id
apple = 1
banana = 2
cake = 3
daisy = 4
eggplant = 5
# Indentation: _n_one
# :EasyAlign=in
apple = 1
banana = 2
cake = 3
daisy = 4
eggplant = 5
<
In interactive mode, you can change the option value with CTRL-I key.
< Alignments over multiple occurrences of delimiters >________________________~
*easy-align-alignments-over-multiple-occurrences-of-delimiters*
*easy-align-6-7*
As stated above, "N-th" parameter is used to target specific occurrences of
the delimiter when it appears multiple times in each line.
To recap:
>
" Left-alignment around the FIRST occurrences of delimiters
:EasyAlign =
" Left-alignment around the SECOND occurrences of delimiters
:EasyAlign 2=
" Left-alignment around the LAST occurrences of delimiters
:EasyAlign -=
" Left-alignment around ALL occurrences of delimiters
:EasyAlign *=
" Left-right ALTERNATING alignment around all occurrences of delimiters
:EasyAlign **=
" Right-left ALTERNATING alignment around all occurrences of delimiters
:EasyAlign! **=
<
In addition to these, you can fine-tune alignments over multiple occurrences
of the delimiters with "align' option. (The option can also be set in
interactive mode with the special key CTRL-A)
>
" Left alignment over the first two occurrences of delimiters
:EasyAlign = { 'align': 'll' }
" Right, left, center alignment over the 1st to 3rd occurrences of delimiters
:EasyAlign = { 'a': 'rlc' }
" Using shorthand notation
:EasyAlign = arlc
" Right, left, center alignment over the 2nd to 4th occurrences of delimiters
:EasyAlign 2=arlc
" (*) Repeating alignments (default: l, r, or c)
" Right, left, center, center, center, center, ...
:EasyAlign *=arlc
" (**) Alternating alignments (default: lr or rl)
" Right, left, center, right, left, center, ...
:EasyAlign **=arlc
" Right, left, center, center, center, ... repeating alignment
" over the 3rd to the last occurrences of delimiters
:EasyAlign 3=arlc*
" Right, left, center, right, left, center, ... alternating alignment
" over the 3rd to the last occurrences of delimiters
:EasyAlign 3=arlc**
<
< Extending alignment rules >_________________________________________________~
*easy-align-extending-alignment-rules*
*easy-align-6-8*
Although the default rules should cover the most of the use cases, you can
extend the rules by setting a dictionary named `g:easy_align_delimiters`.
You may refer to the definitions of the default alignment rules {here}{7}.
{7} https://github.com/junegunn/vim-easy-align/blob/2.9.6/autoload/easy_align.vim#L32-L46
Examples~
*easy-align-6-8-1*
>
let g:easy_align_delimiters = {
\ '>': { 'pattern': '>>\|=>\|>' },
\ '/': {
\ 'pattern': '//\+\|/\*\|\*/',
\ 'delimiter_align': 'l',
\ 'ignore_groups': ['!Comment'] },
\ ']': {
\ 'pattern': '[[\]]',
\ 'left_margin': 0,
\ 'right_margin': 0,
\ 'stick_to_left': 0
\ },
\ ')': {
\ 'pattern': '[()]',
\ 'left_margin': 0,
\ 'right_margin': 0,
\ 'stick_to_left': 0
\ },
\ 'd': {
\ 'pattern': ' \(\S\+\s*[;=]\)\@=',
\ 'left_margin': 0,
\ 'right_margin': 0
\ }
\ }
<
*easy-align-7*
OTHER OPTIONS *easy-align-other-options*
==============================================================================
< Disabling &foldmethod during alignment >____________________________________~
*easy-align-disabling-foldmethod-during-alignment*
*easy-align-7-1*
*g:easy_align_bypass_fold*
{It is reported}{8} that 'foldmethod' value of `expr` or `syntax` can
significantly slow down the alignment when editing a large, complex file with
many folds. To alleviate this issue, EasyAlign provides an option to
temporarily set 'foldmethod' to `manual` during the alignment task. In order
to enable this feature, set `g:easy_align_bypass_fold` switch to 1.
>
let g:easy_align_bypass_fold = 1
<
{8} https://github.com/junegunn/vim-easy-align/issues/14
< Left/right/center mode switch in interactive mode >_________________________~
*easy-align-left-right-center-mode-switch-in-interactive-mode*
*easy-align-7-2*
In interactive mode, you can choose the alignment mode you want by pressing
enter keys. The non-bang command, `:EasyAlign` starts in left-alignment mode
and changes to right and center mode as you press enter keys, while the bang
version first starts in right-alignment mode.
- `:EasyAlign`
- Left, Right, Center
- `:EasyAlign!`
- Right, Left, Center
If you do not prefer this default mode transition, you can define your own
settings as follows.
*g:easy_align_interactive_modes* *g:easy_align_bang_interactive_modes*
>
let g:easy_align_interactive_modes = ['l', 'r']
let g:easy_align_bang_interactive_modes = ['c', 'r']
<
*easy-align-8*
ADVANCED EXAMPLES AND USE CASES *easy-align-advanced-examples-and-use-cases*
==============================================================================
See {EXAMPLES.md}{9} for more examples.
{9} https://github.com/junegunn/vim-easy-align/blob/master/EXAMPLES.md
*easy-align-9*
RELATED WORK *easy-align-related-work*
==============================================================================
- {DrChip's Alignment Tool for Vim}{10}
- {Tabular}{11}
{10} http://www.drchip.org/astronaut/vim/align.html
{11} https://github.com/godlygeek/tabular
*easy-align-10*
AUTHOR *easy-align-author*
==============================================================================
{Junegunn Choi}{12}
{12} https://github.com/junegunn
*easy-align-11*
LICENSE *easy-align-license*
==============================================================================
MIT
==============================================================================
vim:tw=78:sw=2:ts=2:ft=help:norl:nowrap:

View file

@ -1,142 +0,0 @@
" Copyright (c) 2014 Junegunn Choi
"
" MIT License
"
" Permission is hereby granted, free of charge, to any person obtaining
" a copy of this software and associated documentation files (the
" "Software"), to deal in the Software without restriction, including
" without limitation the rights to use, copy, modify, merge, publish,
" distribute, sublicense, and/or sell copies of the Software, and to
" permit persons to whom the Software is furnished to do so, subject to
" the following conditions:
"
" The above copyright notice and this permission notice shall be
" included in all copies or substantial portions of the Software.
"
" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
" EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
" NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
" LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
" OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
" WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
if exists("g:loaded_easy_align_plugin")
finish
endif
let g:loaded_easy_align_plugin = 1
command! -nargs=* -range -bang EasyAlign <line1>,<line2>call easy_align#align(<bang>0, 0, 'command', <q-args>)
command! -nargs=* -range -bang LiveEasyAlign <line1>,<line2>call easy_align#align(<bang>0, 1, 'command', <q-args>)
let s:last_command = 'EasyAlign'
function! s:abs(v)
return a:v >= 0 ? a:v : - a:v
endfunction
function! s:remember_visual(mode)
let s:last_visual = [a:mode, s:abs(line("'>") - line("'<")), s:abs(col("'>") - col("'<"))]
endfunction
function! s:repeat_visual()
let [mode, ldiff, cdiff] = s:last_visual
let cmd = 'normal! '.mode
if ldiff > 0
let cmd .= ldiff . 'j'
endif
let ve_save = &virtualedit
try
if mode == "\<C-V>"
if cdiff > 0
let cmd .= cdiff . 'l'
endif
set virtualedit+=block
endif
execute cmd.":\<C-r>=g:easy_align_last_command\<Enter>\<Enter>"
call s:set_repeat()
finally
if ve_save != &virtualedit
let &virtualedit = ve_save
endif
endtry
endfunction
function! s:repeat_in_visual()
if exists('g:easy_align_last_command')
call s:remember_visual(visualmode())
call s:repeat_visual()
endif
endfunction
function! s:set_repeat()
silent! call repeat#set("\<Plug>(EasyAlignRepeat)")
endfunction
function! s:generic_easy_align_op(type, vmode, live)
if !&modifiable
if a:vmode
normal! gv
endif
return
endif
let sel_save = &selection
let &selection = "inclusive"
if a:vmode
let vmode = a:type
let [l1, l2] = ["'<", "'>"]
call s:remember_visual(vmode)
else
let vmode = ''
let [l1, l2] = [line("'["), line("']")]
unlet! s:last_visual
endif
try
let range = l1.','.l2
if get(g:, 'easy_align_need_repeat', 0)
execute range . g:easy_align_last_command
else
execute range . "call easy_align#align(0, a:live, vmode, '')"
end
call s:set_repeat()
finally
let &selection = sel_save
endtry
endfunction
function! s:easy_align_op(type, ...)
call s:generic_easy_align_op(a:type, a:0, 0)
endfunction
function! s:live_easy_align_op(type, ...)
call s:generic_easy_align_op(a:type, a:0, 1)
endfunction
function! s:easy_align_repeat()
if exists('s:last_visual')
call s:repeat_visual()
else
try
let g:easy_align_need_repeat = 1
normal! .
finally
unlet! g:easy_align_need_repeat
endtry
endif
endfunction
nnoremap <silent> <Plug>(EasyAlign) :set opfunc=<SID>easy_align_op<Enter>g@
vnoremap <silent> <Plug>(EasyAlign) :<C-U>call <SID>easy_align_op(visualmode(), 1)<Enter>
nnoremap <silent> <Plug>(LiveEasyAlign) :set opfunc=<SID>live_easy_align_op<Enter>g@
vnoremap <silent> <Plug>(LiveEasyAlign) :<C-U>call <SID>live_easy_align_op(visualmode(), 1)<Enter>
" vim-repeat support
nnoremap <silent> <Plug>(EasyAlignRepeat) :call <SID>easy_align_repeat()<Enter>
vnoremap <silent> <Plug>(EasyAlignRepeat) :<C-U>call <SID>repeat_in_visual()<Enter>
" Backward-compatibility (deprecated)
nnoremap <silent> <Plug>(EasyAlignOperator) :set opfunc=<SID>easy_align_op<Enter>g@

View file

@ -1,13 +0,0 @@
Test cases for vim-easy-align
=============================
### Prerequisite
- [Vader.vim](https://github.com/junegunn/vader.vim)
### Run
```
./run
```

View file

@ -1,22 +0,0 @@
Include: include/setup.vader
Given clojure:
(def world [[1 1 1 1 1]
[999 999 999 999 1]
[1 1 1 1 1]
[1 999 999 999 999]
[1 1 1 1 1]])
Do (Recursive alignment in blockwise-visual mode):
f[;
\<C-V>G
\<Enter>*\<Space>
Expect clojure:
(def world [[1 1 1 1 1]
[999 999 999 999 1]
[1 1 1 1 1]
[1 999 999 999 999]
[1 1 1 1 1]])
Include: include/teardown.vader

View file

@ -1,191 +0,0 @@
Include: include/setup.vader
Given (fruits):
apple;:;;banana::cake
data;;exchange:;::format
Execute (regular expression):
%EasyAlign/[:;]\+/
AssertEqual ':EasyAlign /[:;]\+/', g:easy_align_last_command
Expect:
apple ;:;; banana::cake
data ;; exchange:;::format
Execute (options dictionary):
%EasyAlign/[:;]\+/{ 'left_margin': '<', 'right_margin': 3 }
Expect:
apple<;:;; banana::cake
data < ;; exchange:;::format
Execute (fuzzy matching):
%EasyAlign/[:;]\+/{ 'l':'<', 'r': '>'}
Expect:
apple<;:;;>banana::cake
data < ;;>exchange:;::format
Execute (shorthand notation of margin):
%EasyAlign/[:;]\+/l0r0
Expect:
apple;:;;banana::cake
data ;;exchange:;::format
Execute (delimiter align):
%EasyAlign*/[:;]\+/l0r0dc
Expect:
apple;:;;banana :: cake
data ;; exchange:;::format
Execute (DEPRECATED: shorthand notation of mode_sequence and margin):
%EasyAlign/[:;]\+/mrc*l2r2
Expect:
apple ;:;; banana :: cake
data ;; exchange :;:: format
Execute (shorthand notation of align and margin):
%EasyAlign/[:;]\+/arc*l2r2
Expect:
apple ;:;; banana :: cake
data ;; exchange :;:: format
Execute (DEPRECATED: deep indentation):
%EasyAlign/[:;]\+/mrc*l2r2
%EasyAlign*/[:;]\+/idmrl*
Expect:
apple ;:;; banana :: cake
data ;; exchange :;:: format
Execute (deep indentation):
%EasyAlign/[:;]\+/arc*l2r2
%EasyAlign*/[:;]\+/idarl*
Expect:
apple ;:;; banana :: cake
data ;; exchange :;:: format
Execute (stick_to_left):
%EasyAlign*/[:;]\+/stl1l0dlrm3
Expect:
apple;:;; banana:: cake
data;; exchange:;:: format
Execute (<):
%EasyAlign*/[:;]\+/<l0dlrm3
Expect:
apple;:;; banana:: cake
data;; exchange:;:: format
Execute (>):
%EasyAlign*/[:;]\+/l0dl<>rm3
Expect:
apple;:;; banana :: cake
data ;; exchange:;:: format
Execute (different regular expression):
%EasyAlign*/../{'lm':'<','rm':'>'}
Expect:
ap><pl><e;><:;><;b><an><an><a:><:c><ak>e
da><ta><;;><ex><ch><an><ge><:;><::><fo><rm><at
Execute (merge different option notations):
%EasyAlign*/../iu0 { 'l': '<', 'r': '>' }
Expect:
ap><pl><e;><:;><;b><an><an><a:><:c><ak>e
da><ta><;;><ex><ch><an><ge><:;><::><fo> <rm><at
Execute (Use current search pattern as delimiter if empty regular expression is given):
/an
%EasyAlign*//
Expect:
apple;:;;b an an a::cake
data;;exch an ge:;::format
Given javascript (json):
var jdbc = {
// JDBC driver for MySQL database:
driver: "com.mysql.jdbc.Driver",
/* JDBC URL for the connection (jdbc:mysql://HOSTNAME/DATABASE) */
url: 'jdbc:mysql://localhost/test',
database: "test",
"user:pass":"r00t:pa55"
};
Execute (default syntax-aware alignment):
%EasyAlign*:
Expect javascript:
var jdbc = {
// JDBC driver for MySQL database:
driver: "com.mysql.jdbc.Driver",
/* JDBC URL for the connection (jdbc:mysql://HOSTNAME/DATABASE) */
url: 'jdbc:mysql://localhost/test',
database: "test",
"user:pass": "r00t:pa55"
};
Execute (do not ignore unmatched):
%EasyAlign*:iu0
Expect javascript:
var jdbc = {
// JDBC driver for MySQL database:
driver: "com.mysql.jdbc.Driver",
/* JDBC URL for the connection (jdbc:mysql://HOSTNAME/DATABASE) */
url: 'jdbc:mysql://localhost/test',
database: "test",
"user:pass": "r00t:pa55"
};
Execute (do not ignore any group):
%EasyAlign*:ig[]iu0
Expect javascript:
var jdbc = {
// JDBC driver for MySQL database:
driver: "com.mysql.jdbc.Driver",
/* JDBC URL for the connection (jdbc: mysql: //HOSTNAME/DATABASE) */
url: 'jdbc: mysql: //localhost/test',
database: "test",
"user: pass": "r00t: pa55"
};
Execute (ignore only strings):
%EasyAlign*:ig['String']
Expect javascript:
var jdbc = {
// JDBC driver for MySQL database:
driver: "com.mysql.jdbc.Driver",
/* JDBC URL for the connection (jdbc: mysql: //HOSTNAME/DATABASE) */
url: 'jdbc:mysql://localhost/test',
database: "test",
"user:pass": "r00t:pa55"
};
Execute (ignore only comments):
%EasyAlign*:ig['Comment']
Expect javascript:
var jdbc = {
// JDBC driver for MySQL database:
driver: "com.mysql.jdbc.Driver",
/* JDBC URL for the connection (jdbc:mysql://HOSTNAME/DATABASE) */
url: 'jdbc: mysql: //localhost/test',
database: "test",
"user: pass": "r00t: pa55"
};
Include: include/teardown.vader

View file

@ -1,13 +0,0 @@
Include: include/setup.vader
Before:
set nomodifiable
After:
set modifiable
AssertEqual "hello\nworld\n", @"
Given:
hello
world
Do (#43 Do nothing when nomodifiable):
vip\<enter>\<enter>\<enter>y

View file

@ -1,263 +0,0 @@
Include: include/setup.vader
Given (Table):
|a|b|c|d|
| -|-|>-|-|
|aaa|bbb|ccc|ddd|
Do (Partial alignment around 1st |):
\<C-V>ljj\<Enter>|
Expect (Right margin should be correctly attached):
| a|b|c|d|
| -|-|>-|-|
| aaa|bbb|ccc|ddd|
Given (empty buffer):
Execute (Aligning lines with many delimiters should not fail):
call visualmode(1)
call setline(1, repeat('|', &maxfuncdepth + 1))
%EasyAlign*|
AssertEqual (&maxfuncdepth + 1) * 3 - 2, len(getline(1))
Given:
a | b | c
aa | bb | cc
Execute:
%EasyAlign*|iu0{'l':'<', 'r': '>'}
Expect:
a <|>b <|>c
aa<|>bb<|>cc
Given (Trailing delimiter):
a | b | c |
aa | bb | cc |
Execute:
%EasyAlign*|iu0{'l':'<', 'r': '>'}
Expect:
a <|>b <|>c <|
aa<|>bb<|>cc<|
Given (Tab-indented code (#20)):
class MyUnitTest(unittest.TestCase):
def test_base(self):
n2f = {}
n2v = {}
f2v = {}
n2gv = {}
n2vt = {}
Execute:
set tabstop=1
%EasyAlign=
Expect:
class MyUnitTest(unittest.TestCase):
def test_base(self):
n2f = {}
n2v = {}
f2v = {}
n2gv = {}
n2vt = {}
Execute:
set tabstop=2
%EasyAlign=
Expect:
class MyUnitTest(unittest.TestCase):
def test_base(self):
n2f = {}
n2v = {}
f2v = {}
n2gv = {}
n2vt = {}
Execute:
set tabstop=4
%EasyAlign=
Expect:
class MyUnitTest(unittest.TestCase):
def test_base(self):
n2f = {}
n2v = {}
f2v = {}
n2gv = {}
n2vt = {}
Execute:
set tabstop=8
%EasyAlign=
Expect:
class MyUnitTest(unittest.TestCase):
def test_base(self):
n2f = {}
n2v = {}
f2v = {}
n2gv = {}
n2vt = {}
Execute:
set tabstop=12
%EasyAlign=
Expect:
class MyUnitTest(unittest.TestCase):
def test_base(self):
n2f = {}
n2v = {}
f2v = {}
n2gv = {}
n2vt = {}
Given (Tab-indented code (#20)):
class MyUnitTest(unittest.TestCase):
def test_base(self):
# n2f= {}
## n2v= {}
# f2v = {}
## n2gv = {}
# n2vt = {}
Execute:
set tabstop=12
%EasyAlign=
Expect:
class MyUnitTest(unittest.TestCase):
def test_base(self):
# n2f = {}
## n2v = {}
# f2v = {}
## n2gv = {}
# n2vt = {}
Given (Some text):
a,b,c
d,e,f
Do (Select 1st line, align 3rd line):
- First line
V\<esc>
- Last line
G
- Align
\<space>Aip*,
- Previous selection
gv
- Upcase
U
Expect:
A,B,C
d, e, f
Given c (#40 Ignored delimiters in LiveEasyAlign causes spurious undo):
printf("foo = %f\n", foo);
printf("foobar = %f\n", foobar);
Do:
gUiw
:%LiveEasyAlign\<enter>
=\<bs>==
Expect c:
PRINTF("foo = %f\n", foo);
printf("foobar = %f\n", foobar);
* #50 Error when using delimiter alignment option
Given:
a|bbb|c
aa|bb|cc
Do (#50 EasyAlign command with 'a' option):
:%EasyAlign {'a': 'l'}\<cr>
\<cr>
*|
Expect (Some text):
a | bbb | c
aa | bb | cc
* #51 Repeat of visual <Plug>(LiveEasyAlign) broken
Do (#51/#52 <Plug>(EasyAlignRepeat) in visual mode):
V\<space>\<enter>\<enter>*||
G
V\<space>.
Expect:
a | bbb | c
aa | bb | cc
* #65 ?=
Given:
a?=b
aa-=bb
aaa?=bbb
Do (#65 Alignment around ?=):
\<space>Aip=
Expect:
a ?= b
aa -= bb
aaa ?= bbb
* #67 \v
Given c:
bzero(&servaddr, sizeof(servaddr));
servaddr.sin_family = AF_INET;
servaddr.sin_addr.s_addr = htonl(INADDR_ANY);
servaddr.sin_port = htons(SERV_PORT);
Execute (#67 \v breaks surrounding regex):
%EasyAlign/\v(\=\s)@<=</
Expect:
bzero(&servaddr, sizeof(servaddr));
servaddr.sin_family = AF_INET;
servaddr.sin_addr.s_addr = htonl(INADDR_ANY);
servaddr.sin_port = htons(SERV_PORT);
Execute (#67 \V followed by \v shouldn't matter):
%EasyAlign/\v(\=\s)@<=<\V/
Expect:
bzero(&servaddr, sizeof(servaddr));
servaddr.sin_family = AF_INET;
servaddr.sin_addr.s_addr = htonl(INADDR_ANY);
servaddr.sin_port = htons(SERV_PORT);
Execute (#67 \zs is now allowed):
%EasyAlign/=\zs/
Expect:
bzero(&servaddr, sizeof(servaddr));
servaddr.sin_family = AF_INET;
servaddr.sin_addr.s_addr = htonl(INADDR_ANY);
servaddr.sin_port = htons(SERV_PORT);
Include: include/teardown.vader
Given:
hello = world bye all
hello world = bye all
hello world = foo all
Do (#105: Incorrectly detection of blockwise visual mode):
\<c-v>jj\<esc>
\<Space>Aip=
Expect:
hello = world bye all
hello world = bye all
hello world = foo all

View file

@ -1,24 +0,0 @@
Include: include/setup.vader
# It is currently possible that EasyAlign command incorrectly judges
# that it was executed in block-wise visual mode
Given:
a|b|c
Do (FIXME invalid judgement - block-wise visual mode):
\<C-V>\<Esc>
:%EasyAlign|\<CR>
Expect:
a | b | c
Do (TODO Workaround: reset visualmode() on error):
\<C-V>\<Esc>
:%EasyAlign|\<CR>
:%EasyAlign|\<CR>
Expect:
a | b | c
Include: include/teardown.vader

View file

@ -1,38 +0,0 @@
Execute (Clean up test environment):
Save g:easy_align_ignore_groups, g:easy_align_ignore_unmatched
Save g:easy_align_indentation, g:easy_align_delimiter_align
Save g:easy_align_interactive_modes, g:easy_align_bang_interactive_modes
Save g:easy_align_delimiters, g:easy_align_bypass_fold
Save &tabstop, mapleader
unlet! g:easy_align_ignore_groups
unlet! g:easy_align_ignore_unmatched
unlet! g:easy_align_indentation
unlet! g:easy_align_delimiter_align
unlet! g:easy_align_interactive_modes
unlet! g:easy_align_bang_interactive_modes
unlet! g:easy_align_bypass_fold
let g:easy_align_delimiters = {}
let mapleader = ' '
vnoremap <silent> r<Enter> :EasyAlign!<Enter>
vnoremap <silent> <Leader>r<Enter> :LiveEasyAlign!<Enter>
" " Legacy
" vnoremap <silent> <Enter> :EasyAlign<Enter>
" vnoremap <silent> <Leader><Enter> :LiveEasyAlign<Enter>
" nmap <leader>A <Plug>(EasyAlignOperator)
set ts=2
vmap <Enter> <Plug>(EasyAlign)
vmap <leader><Enter> <Plug>(LiveEasyAlign)
nmap <leader>A <Plug>(EasyAlign)
vmap <leader>. <Plug>(EasyAlignRepeat)
silent! call plug#load('vim-easy-align')
Before:
After:
Given:

View file

@ -1,4 +0,0 @@
Given:
Execute (Restoring test environment):
Restore

File diff suppressed because it is too large Load diff

View file

@ -1,11 +0,0 @@
#!/bin/bash
cd $(dirname $BASH_SOURCE)
vim -Nu <(cat << EOF
syntax on
for dep in ['vader.vim', 'vim-repeat']
execute 'set rtp+=' . finddir(dep, expand('~/.vim').'/**')
endfor
set rtp+=..
EOF) +Vader*

View file

@ -1,158 +0,0 @@
# http://en.wikibooks.org/wiki/LaTeX/Tables
Include: include/setup.vader
Given tex (table with escaped &):
\begin{tabular}{ l c r }
1&2&3\\
44&55&66\\
777&8\&8&999\\
\end{tabular}
# FIXME vip doesn't work if folded
Do (Align around all &s and \\s):
VG\<Enter>*&
Expect tex:
\begin{tabular}{ l c r }
1 & 2 & 3 \\
44 & 55 & 66 \\
777 & 8\&8 & 999 \\
\end{tabular}
Do (right-align with explicit ignore_unmatched):
VG\<Enter>\<Enter>\<C-U>\<C-U>*&
Expect tex:
\begin{tabular}{ l c r }
1 & 2 & 3 \\
44 & 55 & 66 \\
777 & 8\&8 & 999 \\
\end{tabular}
Do (center-align with explicit ignore_unmatched):
VG\<Enter>\<Enter>\<Enter>\<C-U>\<C-U>*&
Expect tex:
\begin{tabular}{ l c r }
1 & 2 & 3 \\
44 & 55 & 66 \\
777 & 8\&8 & 999 \\
\end{tabular}
Given tex (simple table with \hline):
\begin{tabular}{ l c r }
1&2&3\\ \hline
44&55&66\\ \hline
777&8\&&999\\ \hline
\end{tabular}
Do:
VG\<Enter>*&
Expect tex:
\begin{tabular}{ l c r }
1 & 2 & 3 \\ \hline
44 & 55 & 66 \\ \hline
777 & 8\& & 999 \\ \hline
\end{tabular}
Given tex (table with lines w/o &s):
\begin{tabular}{|r|l|}
\hline
7C0 & hexadecimal \\
3700&octal \\ \cline{2-2}
1111100000 & binary \\
\hline \hline
1984 & decimal \\
\hline
\end{tabular}
Do (left-align*):
VG\<Enter>*&
Expect tex:
\begin{tabular}{|r|l|}
\hline
7C0 & hexadecimal \\
3700 & octal \\ \cline{2-2}
1111100000 & binary \\
\hline \hline
1984 & decimal \\
\hline
\end{tabular}
Do(left-align* and right-align around 2nd):
VG\<Enter>*&
gv\<Enter>\<Enter>2&
Expect tex:
\begin{tabular}{|r|l|}
\hline
7C0 & hexadecimal \\
3700 & octal \\ \cline{2-2}
1111100000 & binary \\
\hline \hline
1984 & decimal \\
\hline
\end{tabular}
Given tex:
\begin{tabular}{}
32&1.14\e1&&5.65\e2&&&&1.16\e1&&1.28\e1&\\
64&1.03\e1&0.1&4.98\e2&0.2&&&9.21\e2&0.3&1.02\e1&0.3\\
128&9.86\e2&0.1&4.69\e2&0.1&&&8.46\e2&0.1&9.45\e2&0.1\\
256&9.65\e2&0.0&4.59\e2&0.0&&&8.15\e2&0.1&9.11\e2&0.1\\
% 512&9.55\e2&0.0&4.56\e2&0.0&&&8.01\e2&0.0&8.96\e2&0.0\\
1024&9.49\e2&0.0&4.53\e2&0.0&&&7.94\e2&0.0&8.89\e2&0.0\\
2048&9.47\e2&0.0&4.52\e2&0.0&&&7.91\e2&0.0&8.85\e2&0.0\\
4096&9.46\e2&0.0&4.51\e2&0.0%&&&7.90\e2&0.0&8.83\e2&0.0\\
8192&9.45\e2&0.0&4.51\e2&0.0&&&&&&\\
\end{tabular}
Execute (Alignment around &s, foldmethod should not change):
setlocal foldmethod=syntax
%EasyAlign*&
AssertEqual 'syntax', &l:foldmethod
setlocal foldmethod=manual
%EasyAlign*&
AssertEqual 'manual', &l:foldmethod
Expect tex:
\begin{tabular}{}
32 & 1.14\e1 & & 5.65\e2 & & & & 1.16\e1 & & 1.28\e1 & \\
64 & 1.03\e1 & 0.1 & 4.98\e2 & 0.2 & & & 9.21\e2 & 0.3 & 1.02\e1 & 0.3 \\
128 & 9.86\e2 & 0.1 & 4.69\e2 & 0.1 & & & 8.46\e2 & 0.1 & 9.45\e2 & 0.1 \\
256 & 9.65\e2 & 0.0 & 4.59\e2 & 0.0 & & & 8.15\e2 & 0.1 & 9.11\e2 & 0.1 \\
% 512&9.55\e2&0.0&4.56\e2&0.0&&&8.01\e2&0.0&8.96\e2&0.0\\
1024 & 9.49\e2 & 0.0 & 4.53\e2 & 0.0 & & & 7.94\e2 & 0.0 & 8.89\e2 & 0.0 \\
2048 & 9.47\e2 & 0.0 & 4.52\e2 & 0.0 & & & 7.91\e2 & 0.0 & 8.85\e2 & 0.0 \\
4096 & 9.46\e2 & 0.0 & 4.51\e2 & 0.0%&&&7.90\e2&0.0&8.83\e2&0.0\\
8192 & 9.45\e2 & 0.0 & 4.51\e2 & 0.0 & & & & & & \\
\end{tabular}
Execute (g:easy_align_bypass_fold set, foldmethod should not change):
let g:easy_align_bypass_fold = 1
setlocal foldmethod=syntax
%EasyAlign*&
AssertEqual 'syntax', &l:foldmethod
setlocal foldmethod=manual
%EasyAlign*&
AssertEqual 'manual', &l:foldmethod
Expect tex:
\begin{tabular}{}
32 & 1.14\e1 & & 5.65\e2 & & & & 1.16\e1 & & 1.28\e1 & \\
64 & 1.03\e1 & 0.1 & 4.98\e2 & 0.2 & & & 9.21\e2 & 0.3 & 1.02\e1 & 0.3 \\
128 & 9.86\e2 & 0.1 & 4.69\e2 & 0.1 & & & 8.46\e2 & 0.1 & 9.45\e2 & 0.1 \\
256 & 9.65\e2 & 0.0 & 4.59\e2 & 0.0 & & & 8.15\e2 & 0.1 & 9.11\e2 & 0.1 \\
% 512&9.55\e2&0.0&4.56\e2&0.0&&&8.01\e2&0.0&8.96\e2&0.0\\
1024 & 9.49\e2 & 0.0 & 4.53\e2 & 0.0 & & & 7.94\e2 & 0.0 & 8.89\e2 & 0.0 \\
2048 & 9.47\e2 & 0.0 & 4.52\e2 & 0.0 & & & 7.91\e2 & 0.0 & 8.85\e2 & 0.0 \\
4096 & 9.46\e2 & 0.0 & 4.51\e2 & 0.0%&&&7.90\e2&0.0&8.83\e2&0.0\\
8192 & 9.45\e2 & 0.0 & 4.51\e2 & 0.0 & & & & & & \\
\end{tabular}
Include: include/teardown.vader

View file

@ -1,2 +0,0 @@
#!/bin/sh
git archive -o vim-easy-align.zip HEAD

View file

@ -1,2 +0,0 @@
github: tpope
custom: ["https://www.paypal.me/vimpope"]

View file

@ -1,2 +0,0 @@
/doc/tags
*.pyc

View file

@ -1,10 +0,0 @@
## Contributing
Open [GitHub issues][] for bug reports and feature requests.
I'm a stickler for [commit messages][], so if you send me a pull
request with so much as superfluous period in the subject line, I will
reject it, then TP your house.
[GitHub issues]: http://github.com/tpope/vim-fireplace/issues
[commit messages]: http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html

View file

@ -1,128 +0,0 @@
# fireplace.vim
There's a REPL in Fireplace, but you probably wouldn't have noticed if I hadn't
told you. Such is the way with fireplace.vim. By the way, this plugin is for
Clojure.
## Installation
First, set up [cider-nrepl][]. (If you skip this step, only a subset of
functionality will be available.)
Install Fireplace using your favorite package manager, or use Vim's built-in
package support:
mkdir -p ~/.vim/pack/tpope/start
cd ~/.vim/pack/tpope/start
git clone https://tpope.io/vim/fireplace.git
vim -u NONE -c "helptags fireplace/doc" -c q
You might also want [salve.vim][] for assorted static project support.
## Features
This list isn't exhaustive; see the `:help` for details.
### Transparent setup
Fireplace talks to nREPL. With Leiningen and Boot, it connects automatically
using the `.nrepl-port` file created when you run `lein repl` or `boot repl`.
If you are starting nREPL some other way, run `:FireplaceConnect host:port`.
You can connect to multiple instances of nREPL for different projects, and it
will use the right one automatically. ClojureScript support is just as
seamless with [Piggieback][].
If you're using the new [Clojure CLI][], you can follow the instructions for
[running cider-nrepl with `clj`][cider-nrepl-via-clj].
Briefly, `clj -Sdeps '{:deps {cider/cider-nrepl {:mvn/version "0.21.1"} }}'
-m nrepl.cmdline --middleware "[cider.nrepl/cider-middleware]"` should do the trick.
The [cider-nrepl][cider-nrepl-via-clj] docs also show you how you can add an alias to
your user's `~/.clojure/deps.edn` file, letting you more simply run `clj -A:cider-clj`.
Oh, and if you don't have an nREPL connection, installing [salve.vim][]
lets it fall back to using `java clojure.main` for some of the basics, using a
class path based on your Leiningen or Boot config. It's a bit slow, but a
two-second delay is vastly preferable to being forced out of my flow for a
single command, in my book.
[cider-nrepl]: https://docs.cider.mx/cider-nrepl/usage.html
[cider-nrepl-via-clj]: https://docs.cider.mx/cider-nrepl/usage.html#via-clj
[Piggieback]: https://github.com/nrepl/piggieback
[Clojure CLI]: https://clojure.org/guides/deps_and_cli
[classpath.vim]: https://github.com/tpope/vim-classpath
[salve.vim]: https://github.com/tpope/vim-salve
### Not quite a REPL
You know that one plugin that provides a REPL in a split window and works
absolutely flawlessly, never breaking just because you did something innocuous
like backspace through part of the prompt? No? Such a shame, you really
would have liked it.
I've taken a different approach in Fireplace. `cq` (Think "Clojure
Quasi-REPL") is the prefix for a set of commands that bring up a *command-line
window* — the same thing you get when you hit `q:` — but set up for Clojure
code.
`cqq` prepopulates the command-line window with the expression under the
cursor. `cqc` gives you a blank line in insert mode.
### Evaluating from the buffer
Standard stuff here. `:Eval` evaluates a range (`:%Eval` gets the whole
file), `:Require` requires a namespace with `:reload` (`:Require!` does
`:reload-all`), either the current buffer or a given argument. `:RunTests`
kicks off `(clojure.test/run-tests)` and loads the results into the quickfix
list.
There's a `cp` operator that evaluates a given motion (`cpp` for the
innermost form under the cursor). `cm` and `c1m` are similar, but they only
run `clojure.walk/macroexpand-all` and `macroexpand-1` instead of evaluating
the form entirely.
Any failed evaluation loads the stack trace into the location list, which
can be easily accessed with `:lopen`.
### Navigating and Comprehending
I was brand new to Clojure when I started this plugin, so stuff that helped me
understand code was a top priority.
* `:Source`, `:Doc`, and `:FindDoc`, which map to the underlying
`clojure.repl` macro (with tab complete, of course).
* `K` is mapped to look up the symbol under the cursor with `doc`.
* `[d` is mapped to look up the symbol under the cursor with `source`.
* `[<C-D>` jumps to the definition of a symbol (even if it's inside a jar
file). `<C-]>` does the same and uses the tag stack.
* `gf`, everybody's favorite "go to file" command, works on namespaces.
Where possible, I favor enhancing built-ins over inventing a bunch of
`<Leader>` maps.
### Omnicomplete
Because why not? It works in the quasi-REPL too.
## FAQ
> Why does it take so long for Vim to start up?
That's either [classpath.vim][] or [salve.vim][].
## Self-Promotion
Like fireplace.vim? Follow the repository on
[GitHub](https://github.com/tpope/vim-fireplace) and vote for it on
[vim.org](http://www.vim.org/scripts/script.php?script_id=4978). And if
you're feeling especially charitable, follow [tpope](http://tpo.pe/) on
[Twitter](http://twitter.com/tpope) and
[GitHub](https://github.com/tpope).
## License
Copyright © Tim Pope. Distributed under the same terms as Vim itself.
See `:help license`.

File diff suppressed because it is too large Load diff

View file

@ -1,98 +0,0 @@
" Location: autoload/session/fireplace.vim
if exists("g:autoloaded_fireplace_session")
finish
endif
let g:autoloaded_fireplace_session = 1
function! s:function(name) abort
return function(substitute(a:name,'^s:',matchstr(expand('<sfile>'), '.*\zs<SNR>\d\+_'),''))
endfunction
function! fireplace#session#for(transport, ...) abort
let session = copy(s:session)
let session.callbacks = []
if a:0 > 1 && type(a:2) == v:t_func
call add(session.callbacks, function(a:2, a:000[2:-1]))
endif
let session.transport = a:transport
let session.id = a:transport.Message({'op': 'clone', 'session': a:0 ? a:1 : ''}, v:t_dict)['new-session']
let session.session = session.id
let session.url = a:transport.url . '#' . session.id
let a:transport.sessions[session.id] = function('s:session_callback', [], session)
return session
endfunction
function! s:session_callback(msg) dict abort
if index(get(a:msg, 'status', []), 'session-closed') >= 0
call filter(self, 'v:key !=# "id" && v:key !=# "session"')
endif
for l:Callback in self.callbacks
try
call call(Callback, [a:msg])
catch
endtry
endfor
endfunction
function! s:session_close() dict abort
if has_key(self, 'id')
try
call self.Message({'op': 'close'}, '')
catch
finally
call filter(self, 'v:key !=# "id" && v:key !=# "session"')
endtry
endif
return self
endfunction
function! s:session_clone(...) dict abort
let session = call('fireplace#session#for', [self.transport, self.id] + a:000)
if has_key(self, 'ns')
let session.ns = self.ns
endif
return session
endfunction
function! s:session_path() dict abort
return self.transport._path
endfunction
function! s:close_on_first_done(transport, msg) abort
if index(get(a:msg, 'status', []), 'done') >= 0
call a:transport.Message({'op': 'close', 'session': a:msg.session}, '')
endif
endfunction
function! s:session_message(msg, ...) dict abort
if !has_key(self, 'id')
throw 'Fireplace: session closed'
endif
let msg = a:msg
if !has_key(msg, 'session')
let msg = copy(msg)
let msg.session = self.id
elseif empty(msg.session) && msg.session isnot# v:null || msg.session is# v:true
let session = self.Clone(function('s:close_on_first_done', [self.transport]))
let msg = copy(msg)
let msg.session = session.id
endif
return call(self.transport.message, [msg] + a:000, self.transport)
endfunction
function! s:session_has_op(op) dict abort
return self.transport.HasOp(a:op)
endfunction
let s:session = {
\ 'Close': s:function('s:session_close'),
\ 'Clone': s:function('s:session_clone'),
\ 'HasOp': s:function('s:session_has_op'),
\ 'Message': s:function('s:session_message'),
\ 'Path': s:function('s:session_path'),
\ 'close': s:function('s:session_close'),
\ 'clone': s:function('s:session_clone'),
\ 'has_op': s:function('s:session_has_op'),
\ 'message': s:function('s:session_message'),
\ 'path': s:function('s:session_path')}

View file

@ -1,387 +0,0 @@
" Location: autoload/fireplace/transport.vim
" Author: Tim Pope <http://tpo.pe/>
if exists('g:autoloaded_fireplace_transport')
finish
endif
let g:autoloaded_fireplace_transport = 1
let s:python_dir = fnamemodify(expand("<sfile>"), ':p:h:h:h') . '/pythonx'
if !exists('g:fireplace_python_executable')
let g:fireplace_python_executable = exepath('python3') =~? '^$\|\<appinstallerpythonredirector\.exe$' && executable('python') ? 'python' : 'python3'
endif
if !exists('s:id')
let s:vim_id = 'fireplace-' . hostname() . '-' . localtime()
let s:id = 0
endif
function! fireplace#transport#id() abort
let s:id += 1
let sha = sha256(s:vim_id . '-' . s:id . '-' . reltimestr(reltime()))
return printf('%s-%s-4%s-%s-%s', sha[0:7], sha[8:11], sha[13:15], sha[16:19], sha[20:31])
endfunction
function! fireplace#transport#combine(responses) abort
if type(a:responses) == type({})
return a:responses
endif
let combined = {'status': [], 'session': [], 'value': ['']}
for response in a:responses
for key in keys(response)
if key ==# 'id'
let combined[key] = response[key]
elseif key ==# 'ns'
let combined[key] = response[key]
if !has_key(response, 'value')
call add(combined.value, '')
endif
elseif key ==# 'value'
let combined.value[-1] .= response.value
if has_key(response, 'ns')
call add(combined.value, '')
endif
elseif key ==# 'status'
for entry in response[key]
if index(combined[key], entry) < 0
call extend(combined[key], [entry])
endif
endfor
elseif key ==# 'session'
if index(combined[key], response[key]) < 0
call extend(combined[key], [response[key]])
endif
elseif type(response[key]) == type('')
let combined[key] = get(combined, key, '') . response[key]
else
let combined[key] = response[key]
endif
endfor
endfor
call filter(combined.value, 'len(v:val)')
if empty(combined.value)
call remove(combined, 'value')
endif
return combined
endfunction
function! s:json_send(job, msg) abort
if type(a:job) == v:t_number
call chansend(a:job, json_encode(a:msg) . "\n")
else
call ch_sendexpr(a:job, a:msg)
endif
endfunction
function! s:close(job) abort
if type(a:job) == v:t_number
return chanclose(a:job, 'stdin')
else
return ch_close_in(a:job)
endif
endfunction
function! s:stop(job) abort
if type(a:job) == v:t_number
return jobstop(a:job)
else
call ch_close_in(a:job)
return job_stop(a:job, 'kill')
endif
endfunction
function! s:wrap_nvim_callback(cb, buffer, job, msgs, _) abort
let a:msgs[0] = a:buffer[0] . a:msgs[0]
let a:buffer[0] = remove(a:msgs, -1)
for msg in a:msgs
call call(a:cb, [a:job, json_decode(msg)[1]])
endfor
endfunction
function! s:json_start(command, out_cb, exit_cb) abort
if exists('*job_start') || !exists('*jobstart')
return job_start(a:command, {
\ "in_mode": "json",
\ "out_mode": "json",
\ "out_cb": a:out_cb,
\ "exit_cb": a:exit_cb,
\ })
else
let buf = ['']
return jobstart(a:command, {
\ "on_stdout": { job, data, type -> timer_start(0, { t -> s:wrap_nvim_callback(a:out_cb, buf, job, data, type) }) },
\ "on_exit": { job, status, type -> call(a:exit_cb, [job, status])},
\ })
endif
endfunction
function! s:json_callback(url, state, requests, sessions, job, msg) abort
if type(a:msg) ==# v:t_list && len(a:msg) == 2
if a:msg[0] ==# 'exception'
let g:fireplace_last_python_exception = a:msg[1]
elseif a:msg[0] ==# 'status'
let a:state.status = a:msg[1]
endif
endif
if type(a:msg) !=# v:t_dict
return
endif
if has_key(a:msg, 'new-session') && !has_key(a:sessions, a:msg['new-session'])
let a:sessions[a:msg['new-session']] = 'len'
endif
if has_key(a:requests, get(a:msg, 'id'))
for l:Callback in a:requests[a:msg.id].callbacks
try
call call(l:Callback, [a:msg])
catch
endtry
endfor
if index(get(a:msg, 'status', []), 'done') >= 0
call remove(a:requests, a:msg.id)
endif
endif
if has_key(a:sessions, get(a:msg, 'session'))
try
call call(a:sessions[a:msg.session], [a:msg])
catch
endtry
if index(get(a:msg, 'status', []), 'session-closed') >= 0
call remove(a:sessions, a:msg.session)
endif
endif
endfunction
function! s:exit_callback(url, state, requests, sessions, job, status) abort
if has_key(s:urls, a:url)
call remove(s:urls, a:url)
endif
let a:state.exit = a:status
endfunction
if !exists('s:urls')
let s:urls = {}
endif
augroup fireplace_transport
autocmd!
autocmd VimLeave for s:dict in values(s:urls)
\ | call s:dict.transport.Close()
\ | endfor
augroup END
function! fireplace#transport#connect(arg) abort
let url = substitute(a:arg, '#.*', '', '')
if url =~# '^\d\+$'
let url = 'nrepl://localhost:' . url
elseif url =~# '^[^:/@]\+\(:\d\+\)\=$'
let url = 'nrepl://' . url
elseif url !~# '^\a\+://'
throw "Fireplace: invalid connection string " . string(a:arg)
endif
let url = substitute(url, '^\a\+://[^/]*\zs$', '/', '')
let url = substitute(url, '^nrepl://[^/:]*\zs/', ':7888/', '')
if has_key(s:urls, url)
return s:urls[url].transport
endif
let scheme = matchstr(url, '^\a\+')
if scheme ==# 'nrepl'
let command = [g:fireplace_python_executable, s:python_dir.'/fireplace.py']
elseif exists('g:fireplace_argv_' . scheme)
let command = g:fireplace_argv_{scheme}
else
throw 'Fireplace: unsupported protocol ' . scheme
endif
let transport = deepcopy(s:transport)
let transport.url = url
let transport.state = {}
let transport.sessions = {}
let transport.requests = {}
let cb_args = [url, transport.state, transport.requests, transport.sessions]
let transport.job = s:json_start(command + [url], function('s:json_callback', cb_args), function('s:exit_callback', cb_args))
while !has_key(transport.state, 'status') && transport.Alive()
sleep 1m
endwhile
if get(transport.state, 'status') is# ''
let s:urls[transport.url] = {'transport': transport}
let transport.describe = transport.Message({'op': 'describe', 'verbose?': 1}, v:t_dict)
if transport.HasOp('classpath')
let response = transport.Message({'op': 'classpath', 'session': ''}, v:t_dict)
if type(get(response, 'classpath')) == type([])
let transport._path = response.classpath
endif
endif
if !has_key(transport, '_path')
let response = transport.Message({'op': 'eval', 'code':
\ '(System/getProperty "path.separator") (or' .
\ ' (System/getProperty "fake.class.path")' .
\ ' (System/getProperty "java.class.path") "") ' .
\ '(System/getProperty "user.dir") ' .
\ "(require 'clojure.repl 'clojure.java.javadoc)"}, v:t_dict)
let transport._path = split(eval(response.value[1]), response.value[0][1])
let cwd = eval(response.value[2])
for i in range(len(transport._path))
if transport._path[i] !~# '^/\|^\a\+:'
let transport._path[i] = cwd . matchstr(cwd, '[\/]') . transport._path[i]
endif
endfor
endif
return transport
endif
throw 'Fireplace: Connection Error: ' . get(transport.state, 'status', 'Failed to run command ' . join(command, ' '))
endfunction
function! s:transport_alive() dict abort
return !has_key(self.state, 'exit')
endfunction
function! s:transport_clone(...) dict abort
return call('fireplace#session#for', [self, ''] + a:000)
endfunction
function! s:transport_close() dict abort
if has_key(self, 'job')
for session in keys(self.sessions)
call self.Message({'op': 'close', 'session': session}, '')
call remove(self.sessions, session)
endfor
call s:close(self.job)
for i in range(50)
if !has_key(s:urls, self.url)
return self
endif
sleep 1m
endfor
call s:stop(self.job)
endif
return self
endfunction
function! s:transport_has_op(op) dict abort
return has_key(self.describe.ops, a:op)
endfunction
function! s:transport_message(request, ...) dict abort
let request = copy(a:request)
if empty(get(request, 'id'))
let request.id = fireplace#transport#id()
endif
if empty(get(request, 'session', 1))
unlet request.session
endif
if empty(get(request, 'ns', 1))
unlet request.ns
endif
if empty(get(request, 'id', 1))
call s:json_send(self.job, request)
return {}
endif
let args = copy(a:000)
if len(args) && type(args[0]) == v:t_number
let ret_type = remove(args, 0)
endif
let received = []
let message = {'id': request.id}
if has_key(request, 'session')
let message.session = request.session
endif
let callbacks = [function('add', [received])]
if len(args) && type(args[0]) ==# v:t_list
call extend(callbacks, map(copy(args), 'function(v:val, args[1:-1])'))
elseif len(args) && (type(args[0]) == v:t_func || type(args[0]) == v:t_string && len(args[0]))
call add(callbacks, function(args[0], args[1:-1]))
endif
let self.requests[request.id] = {'callbacks': callbacks}
if has_key(request, 'session')
let self.requests[request.id].session = request.session
endif
call s:json_send(self.job, request)
if !exists('ret_type')
return message
endif
try
while has_key(self.requests, request.id)
sleep 1m
endwhile
finally
if has_key(self.requests, request.id) && has_key(request, 'session')
call s:json_send(self.job, {'op': 'interrupt', 'id': fireplace#transport#id(), 'session': request.session, 'interrupt-id': request.id})
endif
endtry
if ret_type is# v:t_list
return received
elseif ret_type is# v:t_dict
return fireplace#transport#combine(received)
elseif ret_type is# v:t_number
return len(received)
else
return message
endif
endfunction
function! fireplace#transport#interrupt(id) abort
for [url, dict] in items(s:urls)
if has_key(dict.transport.requests, a:id)
let request = dict.transport.requests[a:id]
if has_key(dict.transport, 'job') && has_key(request, 'session')
call s:json_send(dict.transport.job, {'op': 'interrupt', 'id': fireplace#transport#id(), 'session': request.session, 'interrupt-id': a:id})
endif
endif
endfor
endfunction
function! fireplace#transport#stdin(session_or_id, data) abort
let str = type(a:data) == v:t_string ? a:data : nr2char(a:data)
let id = a:session_or_id
for [url, dict] in items(s:urls)
if has_key(dict.transport, 'job') && has_key(dict.transport.sessions, id)
call s:json_send(dict.transport.job, {'op': 'stdin', 'id': fireplace#transport#id(), 'session': id, 'stdin': str})
return v:true
elseif has_key(dict.transport, 'job') && has_key(dict.transport.requests, id)
call s:json_send(dict.transport.job, {'op': 'stdin', 'id': fireplace#transport#id(), 'session': dict.transport.requests[id].session, 'stdin': str})
return v:true
endif
endfor
return v:false
endfunction
function! s:done(id) abort
for [url, dict] in items(s:urls)
if has_key(dict.transport, 'job') && has_key(dict.transport.requests, a:id)
return v:false
endif
endfor
return v:true
endfunction
function! fireplace#transport#wait(id, ...) abort
let max = a:0 ? a:1 : -1
let ms = 0
while !s:done(a:id)
if ms == max
return v:false
endif
let ms += 1
if exists('*wait')
call wait(1, { -> v:false })
else
sleep 1m
endif
endwhile
return v:true
endfunction
let s:transport = {
\ 'Alive': function('s:transport_alive'),
\ 'Clone': function('s:transport_clone'),
\ 'Close': function('s:transport_close'),
\ 'HasOp': function('s:transport_has_op'),
\ 'Message': function('s:transport_message'),
\ 'alive': function('s:transport_alive'),
\ 'clone': function('s:transport_clone'),
\ 'close': function('s:transport_close'),
\ 'has_op': function('s:transport_has_op'),
\ 'message': function('s:transport_message')}

View file

@ -1,335 +0,0 @@
*fireplace.txt* Clojure REPL support
Author: Tim Pope <http://tpo.pe/>
License: Same terms as Vim itself (see |license|)
This plugin is only available if 'compatible' is not set.
*fireplace*
While not a hard dependency of Fireplace itself, many features require
<https://github.com/clojure-emacs/cider-nrepl> for full functionality.
CONNECTING TO A REPL *fireplace-connect*
Connecting to lein repl happens automatically. If you have a different setup,
you can connect by hand.
*fireplace-:Connect*
:Connect nrepl://{host}:{port} [path]
:Connect {port} [path]
Connect to a REPL server. The path is the root of the
project that the REPL applies to (try ".").
The REPL is used for the commands below. If no REPL is found for the current
buffer and 'path' contains at least one jar file, java (or $JAVA_CMD) is
invoked directly, which can be quite slow depending on your setup.
The only adapter shipped with fireplace.vim is for nREPL. You need either
`python` or `python3` in your path.
*fireplace-piggieback* *fireplace-clojurescript*
To use a ClojureScript, invoke |:CljEval| with the command you would normally
use to start a ClojureScript REPL. For example:
>
:CljEval (cider.piggieback/cljs-repl (cljs.repl.nashorn/repl-env))
<
Be aware that your ClojureScript files must be available on the classpath for
this to work properly, and that not all operations are supported.
The :Piggieback command is softly deprecated wrapper for invoking Piggieback.
*fireplace-:Piggieback*
:Piggieback ({ns}/repl-env [...])
Create a new nREPL session and invoke
cider.piggieback/cljs-repl with the given environment.
:Piggieback ({ns}/cljs-repl [...])
If the argument is a call to a function not named
repl-env, it is invoked directly, without
cider.piggieback/cljs-repl. This is useful for
(figwheel.main.api/cljs-repl) and similar functions.
:Piggieback {port} If the argument looks like a port number,
weasel.repl.websocket (if available) or
cljs.repl.browser will be used to provide the REPL
environment.
:Piggieback If no argument is given, :Piggieback defaults to
the ClojureScript environment specified in
*b:fireplace_cljs_repl* or *g:fireplace_cljs_repl* .
If projectionist.vim is installed, the "cljsRepl"
projectionist key is also checked. This default will
be invoked automatically on first eval in a
ClojureScript buffer if :Piggieback is not invoked
explicitly. To restore the old behavior of defaulting
to Nashorn, add this line to your vimrc:
>
let g:fireplace_cljs_repl =
\ '(cider.piggieback/cljs-repl (cljs.repl.nashorn/repl-env))'
<
:Piggieback! Terminate the most recently created piggieback
session.
DOCUMENTATION *fireplace-documentation*
*fireplace-:Doc*
:Doc {symbol} Show the docs for the given symbol.
*fireplace-:Javadoc*
:Javadoc {class} Open the java docs for the given class in a browser.
*fireplace-K*
K Look up the doc, javadoc, or spec-form for the
identifier under the cursor.
*fireplace-:FindDoc*
:FindDoc {arg} Wrapper around (clojure.repl/find-doc ...).
*fireplace-:SpecForm*
:SpecForm {keyword} Show the form of the spec given.
Like (spec/form keyword).
*fireplace-:SpecExample*
:SpecExample {keyword} Generate one example for the spec given.
Like (gen/generate keyword).
*fireplace-:Source*
:Source {symbol} Show the source for the given symbol.
*fireplace-[d*
[d Show source for symbol under cursor.
]d
NAVIGATING *fireplace-navigating*
These commands will never use a remote REPL, only a local one, as file paths
on a remote server wouldn't be very useful locally.
*fireplace-[_CTRL-D*
[<C-D> Jump to the source of the symbol under the cursor.
]<C-D>
*fireplace-CTRL-W_CTRL-D*
<C-W><C-D> Jump to the source of the symbol under the cursor in
<C-W>d a split.
*fireplace-gf*
gf Go to the file for the namespace under the cursor.
*fireplace-CTRL-]*
<C-]> Jump to the source of the symbol under the cursor
g] and put the symbol on the tag stack. See the help for
g<C-]> the built-in |CTRL-]|. All other tag maps are provided
<C-W>] as well.
<C-W>g]
<C-W>g<C-]>
*fireplace-:Djump*
:Djump {symbol} Jump to the definition for the given symbol.
*fireplace-:Dsplit*
:Dsplit {symbol} Jump to the definition for the given symbol in a
split.
EVALUATING CODE *fireplace-eval*
All code is evaluated in the namespace of the current file, requiring it if
necessary. If the current file sits outside the class path (project.clj, for
example), the user namespace is used instead. ClojureScript is used for .cljs
files always and for .cljc files if a ClojureScript repl has already been
initialized.
Evaluation happens in the foreground and blocks Vim by default. Press <C-D>
during a prolonged execution to detach from it and return Vim. When
evaluation is complete, results will load into the preview window.
*fireplace-:Require*
:Require [ns] Require :reload the given/current namespace.
*fireplace-:Require!*
:Require! [ns] Require :reload-all the given/current namespace.
*fireplace-:Eval*
:Eval Eval/print the outermost form for the current line.
:{range}Eval Eval/print the given range.
:Eval {expr} Eval/print the given expression.
*fireplace-:Eval!*
:[range]Eval! Eval the given range or outermost expression and
replace it with its result.
:[range]Eval! {expr} Eval the given expression and insert it after
the given range or current line.
*fireplace-:CljEval*
:CljEval [...] Like :Eval, but always use the user namespace and
Clojure platform. This command is available globally.
*fireplace-:CljsEval*
:CljsEval [...] Like :Eval, but always use the cljs.user namespace and
ClojureScript platform. This command is available
globally.
*fireplace-:RunTests*
:RunTests [ns] [...] Call clojure.test/run-tests on the given namespaces
and load the results into the quickfix list.
:[range]RunTests Call clojure.test/test-var on the var defined at or
above the specified line and load the results into the
quickfix list. Typically invoked as :.RunTests to run
the test under the cursor.
:0RunTests [pattern] Call clojure.test/run-all-tests with the given pattern
and load the results into the quickfix list.
*fireplace-cp*
cp{motion} Eval/print the code indicated by {motion}.
cpp Eval/print the innermost form at the cursor.
*fireplace-cpr*
cpr :Require|RunTests
*fireplace-c!*
c!{motion} Eval/replace the code indicated by {motion}.
c!! Eval/replace the innermost form at the cursor.
*fireplace-cm*
cm{motion} Fully macroexpand the code indicated by {motion}.
*fireplace-cmm*
cmm Fully macroexpand the innermost form at the cursor.
*fireplace-c1m*
c1m{motion} Macroexpand the code indicated by {motion} once.
*fireplace-c1mm*
c1mm Macroexpand the innermost form at the cursor once.
*fireplace-cqp*
cqp Bring up a prompt for code to eval/print.
*fireplace-cqq*
cqq Bring up a |command-line-window| with innermost form
at the cursor prepopulated.
*fireplace-cqc*
cqc Bring up a |command-line-window| for code to
eval/print. Equivalent to cqp<C-F>i.
*fireplace-cq*
cq{motion} Bring up a |command-line-window| with text indicated
by {motion} prepopulated.
*fireplace-:Last*
:Last Open the result of the last evaluation in the preview
window. Use :2Last to get the next-to-last result,
and so on. Once the window is open, cycle to older
and newer entries with |:lprevious| and |:lnext|.
*fireplace-:Stacktrace*
:Stacktrace Retrieve the most recent Clojure error and load the
stacktrace into the quickfix list. By default this is
filtered to exclude duplicates and tooling (e.g.,
nREPL internals). Use :Stacktrace! to get an
unfiltered version.
And insert mode:
*fireplace-i_CTRL-R_(*
<C-R>( Evaluate the given expression and insert the result.
There's omnicomplete on |CTRL-X_CTRL-O|, which works in Clojure buffers and
in the |command-line-window|, and tab complete at the cqp prompt.
API *fireplace-api*
Use fireplace#clj() or fireplace#cljs() to get a "platform" object for Clojure
or ClojureScript, or fireplace#platform() to pick automatically for the
current buffer. The following instance methods are available:
>
let ext = platform.Ext()
<
Retrieve the appropriate file extension, either "clj" or "cljs".
>
let user_ns = platform.UserNs()
<
Retrieve the user namespace, either "user" or "cljs.user".
>
let ns = platform.BufferNs()
let ns = platform.BufferNs(bufnr(''))
<
Retrieve the namespace for the current or given buffer number, determined by
looking for a (ns) declaration and falling back to a using the class path
relative filename. This is the same namespace used by operations like :Eval.
>
call platform.Message({"op": "some-op"})
call platform.Message({"op": "some-op"}, function("Callback"))
<
Send an nREPL message asynchronously. If given, invoke the callback on each
message.
>
let list = platform.Message({"op": "..."}, v:t_list)
let list = platform.Message({"op": "..."}, v:t_list,
\ function("Callback"))
<
Send an nREPL message and return all response messages as a list. If given,
invoke the callback on each message.
>
let dict = platform.Message({"op": "some-op"}, v:t_dict)
let dict = platform.Message({"op": "some-op"}, v:t_dict,
\ function("Callback"))
<
Send an nREPL message and return all response messages as a single combined
dictionary. If given, invoke the callback on each message.
>
let list = platform.Message({"op": "some-op", "ns": bufnr('')})
<
If a buffer number is given as an "ns" parameter, it is replaced with the
namespace for that buffer, as retrieved by platform.BufferNs().
>
let list = platform.Message({"op": "some-op", "session": v:true})
<
If v:true is given as "session", the current session is cloned for the given
operation, and closed when the operation completes. Use this to do an
arbitrary eval without tainting *1, etc. (Although platform.Query() is
generally a better choice for such operations.)
>
if platform.HasOp("some-op")
<
Check for the presence of an nREPL op. Always returns false if no live
connection is available.
>
let msg1 = platform.Message({"op": "some-op"})
let msg2 = platform.Message({"op": "other-op"}, function("Callback"))
call fireplace#wait([msg1, msg2])
<
Wait on one or more asynchronous messages to finish. If CTRL-C is pressed by
the user, all messages will be interrupted with {"op": "interrupt"}.
>
let classpath = platform.Path()
<
Retrieve the class path, either from a REPL connection or from 'path' as set
by classpath.vim or salve.vim.
>
let data = platform.Query("code")
let data = platform.Query("code", {"ns": bufnr('')})
<
Evaluate the given code on the REPL and return it as a Vim data structure.
Works offline if a class path is available.
>
let msg = platform.Query("code", function("Callback"))
<
Evaluate the given code on the REPL and pass it to the callback as a Vim data
structure. Works offline if a class path is available.
ABOUT *fireplace-about*
Grab the latest version or report a bug on GitHub:
http://github.com/tpope/vim-fireplace
vim:tw=78:et:ft=help:norl:

View file

@ -1,42 +0,0 @@
" fireplace.vim - Clojure REPL support
" Maintainer: Tim Pope <http://tpo.pe/>
" Version: 2.1
" GetLatestVimScripts: 4978 1 :AutoInstall: fireplace.vim
if exists("g:loaded_fireplace")
finish
endif
let g:loaded_fireplace = 1
augroup fireplace
autocmd!
if v:version >= 800
autocmd FileType clojure call fireplace#activate()
autocmd QuickFixCmdPost make,cfile,cgetfile
\ if &efm =~# 'classpath' | call fireplace#massage_list() | endif
autocmd QuickFixCmdPost lmake,lfile,lgetfile
\ if &efm =~# 'classpath' | call fireplace#massage_list(0) | endif
else
autocmd FileType clojure
\ if !exists('s:did_warning') |
\ let s:did_warning = 1 |
\ echohl WarningMsg |
\ echo 'Fireplace not loaded: Vim 8.0 or higher required' |
\ echohl None
\ endif
endif
autocmd User ProjectionistActivate
\ for b:fireplace_cljs_repl in projectionist#query_scalar('fireplaceCljsRepl') + projectionist#query_scalar('cljsRepl') |
\ break |
\ endfor
augroup END
command! -bar -bang -complete=customlist,fireplace#ConnectComplete -nargs=* FireplaceConnect
\ exe fireplace#ConnectCommand(<line1>, <count>, +'<range>', <bang>0, <q-mods>, <q-args>, [<f-args>])
command! -bang -range -complete=customlist,fireplace#CljEvalComplete -nargs=* CljEval
\ exe fireplace#CljEvalCommand( <line1>, <count>, +'<range>', <bang>0, <q-mods>, <q-args>)
command! -bang -range -complete=customlist,fireplace#CljsEvalComplete -nargs=* CljsEval
\ exe fireplace#CljsEvalCommand(<line1>, <count>, +'<range>', <bang>0, <q-mods>, <q-args>)

View file

@ -1,195 +0,0 @@
import json
import os
import re
import socket
import sys
import traceback
import threading
def bencode(data, f):
if isinstance(data, list):
f.write(b'l')
for x in data:
bencode(x, f)
f.write(b'e')
elif isinstance(data, dict):
f.write(b'd')
for x in sorted(data.keys()):
bencode(x, f)
bencode(data[x], f)
f.write(b'e')
elif isinstance(data, int) or isinstance(data, bool):
f.write(b'i')
f.write(str(int(data)).encode('UTF-8'))
f.write(b'e')
elif isinstance(data, str) or type(data).__name__ == 'unicode':
data = data.encode('UTF-8')
f.write(str(len(data)).encode('UTF-8'))
f.write(b':')
f.write(data)
else:
raise TypeError("can't bencode a " + type(data).__name__)
def binread(f, count=1):
buf = f.read(count)
length = len(buf)
while len(buf) != count and length > 0:
more = f.read(count - len(buf))
length = len(more)
buf += more
return buf
def bdecode(f, char=None):
if char == None:
char = binread(f)
if char == b'l':
l = []
while True:
char = binread(f)
if char == b'e':
return l
l.append(bdecode(f, char))
elif char == b'd':
d = {}
while True:
char = binread(f)
if char == b'e':
return d
key = bdecode(f, char)
d[key] = bdecode(f)
elif char == b'i':
i = b''
while True:
char = binread(f)
if char == b'e':
return int(i)
i += char
elif char.isdigit():
i = int(char)
while True:
char = binread(f)
if char == b':':
return binread(f, i).decode('UTF-8')
i = 10 * i + int(char)
elif char == b'':
raise EOFError("unexpected end of bencode data")
else:
raise TypeError("unexpected type "+char.decode('UTF-8')+" in bencode data")
def quickfix(t, e, tb):
items = []
stack = traceback.extract_tb(tb)
for frame in stack:
(filename, lineno, name, line) = frame
module = ''
if filename and filename[0] == '<':
module = filename
filename = ''
items.append({
'filename': filename,
'lnum': lineno,
'module': module,
'text': line})
return {'title': str(e), 'items': items}
class Connection:
def __init__(self, host, port, keepalive_file=None):
self.keepalive_file = keepalive_file
self.connected = False
self.host = host
self.port = int(port)
def socket(self):
if not self.connected:
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.settimeout(8)
s.connect((self.host, self.port))
s.setblocking(1)
self._socket = s
self.connected = True
return self._socket
def close(self):
if self.connected:
return self.socket().close()
def send(self, payload):
f = self.socket().makefile('wb')
try:
if isinstance(payload, dict):
bencode(payload, f)
else:
f.write(payload.encode('UTF-8'))
finally:
f.close()
return ''
def receive(self, char=None):
f = self.socket().makefile('rb', False)
try:
return bdecode(f)
finally:
f.close()
def notify(self, data, i = 0):
json.dump([i, data], sys.stdout)
sys.stdout.write("\n")
sys.stdout.flush()
def tunnel_socket_to_stdout(self):
socket_in = self.socket().makefile('rb', False)
try:
while True:
msg = self.receive()
self.notify(msg)
except EOFError:
os._exit(0)
except Exception:
self.notify(["exception", quickfix(*sys.exc_info())])
os._exit(4)
finally:
socket_in.close()
def tunnel(self):
try:
self.socket()
t = threading.Thread(target = self.tunnel_socket_to_stdout)
t.daemon = True
t.start()
self.notify(["status", ""])
line = sys.stdin.readline()
while len(line) > 0:
try:
obj = json.loads(line)
if isinstance(obj, list):
obj = obj[1]
self.send(obj)
except Exception:
self.notify(["exception", quickfix(*sys.exc_info())])
line = sys.stdin.readline()
t.join(0.1)
except socket.error as e:
self.notify(["status", e.strerror])
os._exit(2)
except Exception as e:
self.notify(["status", str(e)])
self.notify(["exception", quickfix(*sys.exc_info())])
os._exit(3)
def main(host = None, port = None, *args):
try:
match = re.search('//([^:/@]+)(?::(\d+))?', host)
if match:
host = match.groups()[0]
port = match.groups()[1]
conn = Connection(host, int(port or 7888))
try:
conn.tunnel()
finally:
conn.close()
except Exception:
json.dump([0, ["exception", quickfix(*sys.exc_info())]], sys.stdout)
exit(1)
if __name__ == "__main__":
main(*sys.argv[1:])

@ -1 +1 @@
Subproject commit 24afe922e6a05891756ecf331f39a1f6743d3d5a000000000000000000000000
Subproject commit 65846025c15494983dafe5e3b46c8f88ab2e9635000000000000000000000000

@ -1 +1 @@
Subproject commit 5a36fd29df63ea3f65562bd2bb837be48a5ec90b000000000000000000000000
Subproject commit c17eb01ebf5aaf766c53bab1f6592710e5ffb796000000000000000000000000

@ -0,0 +1 @@
Subproject commit 72792615e739d0eb54a9c8f7e0a46a6e2407c9e8000000000000000000000000

View file

@ -15,42 +15,17 @@ set viewdir=$XDG_STATE_HOME/vim/view | call mkdir(&viewdir, 'p')
if !has('nvim') | set viminfofile=$XDG_STATE_HOME/vim/viminfo | endif
call plug#begin(expand('~/.config/vim/plugged'))
"Plug 'vimwiki/vimwiki'
Plug 'jceb/vim-orgmode'
Plug 'https://github.com/tpope/vim-speeddating'
Plug 'https://github.com/tpope/vim-repeat.git'
"Plug 'https://github.com/yegappan/taglist.git'
Plug 'https://github.com/chrisbra/NrrwRgn.git'
Plug 'https://github.com/inkarkat/vim-SyntaxRange.git'
"Plug 'https://github.com/arcticicestudio/nord-vim.git'
Plug 'dylanaraps/wal.vim'
Plug 'vim-airline/vim-airline'
Plug 'junegunn/goyo.vim'
"Plug 'junegunn/goyo.vim', { 'for': 'markdown' }
"Plug 'vim-airline/vim-airline-themes'
Plug 'ap/vim-css-color'
"Plug 'vifm/vifm.vim'
"Plug 'junegunn/vim-easy-align'
"Plug 'preservim/nerdtree'
" Any valid git URL is allowed
"Plug 'https://github.com/junegunn/vim-github-dashboard.git'
" Multiple Plug commands can be written in a single line using | separators
" Plug 'SirVer/ultisnips' | Plug 'honza/vim-snippets'
" On-demand loading
"Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
"Plug 'tpope/vim-fireplace', { 'for': 'clojure' }
" Using a non-default branch
"Plug 'rdnetto/YCM-Generator', { 'branch': 'stable' }
" Using a tagged release; wildcard allowed (requires git 1.9.2 or above)
"Plug 'fatih/vim-go', { 'tag': '*' }
" Plugin options
"Plug 'nsf/gocode', { 'tag': 'v.20150303', 'rtp': 'vim' }
" Plugin outside ~/.vim/plugged with post-update hook
"Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
" Unmanaged plugin (manually installed and updated)
"Plug '~/my-prototype-plugin'
" fzf stuff
"Plug 'junegunn/fzf.vim'
Plug 'vimwiki/vimwiki'
" Initialize plugin system
call plug#end()
@ -68,6 +43,7 @@ set nocompatible
set notermguicolors
set background=dark
set number
filetype plugin on
syntax enable
colorscheme wal
let g:airline_powerline_fonts = 1
@ -76,15 +52,14 @@ let g:airline_left_alt_sep = ''
let g:airline_right_sep = ''
let g:airline_right_alt_sep = ''
let mapleader = ","
"let &t_SI = "\e[6 q"
"let &t_EI = "\e[2 q"
"nnoremap <leader>n :NERDTreeFocus<CR>
"nnoremap <C-n> :NERDTree<CR>
"nnoremap <C-t> :NERDTreeToggle<CR>
"nnoremap <silent> <C-f> :Files<CR>
"nnoremap <silent> <Leader>f :Rg<CR>
"nnoremap <leader>vv :Vifm<CR>
let g:vimwiki_list = [{'path': '~/.config/vimwiki'}]
let g:vimwiki_global_ext = 0
nnoremap <leader>bn :bnext<CR>
nnoremap <leader>bp :bprev<CR>
nnoremap <leader>vs :VsplitVifm<CR>
nnoremap <leader>tt :VimwikiTabnewLink<CR>
nnoremap <leader>sp :SplitVifm<CR>
nnoremap <leader>dv :DiffVifm<CR>
nnoremap <leader>tv :TabVifm<CR>
@ -110,19 +85,6 @@ autocmd! User GoyoEnter nested call <SID>goyo_enter()
autocmd! User GoyoLeave nested call <SID>goyo_leave()
let g:goyo_height='50%'
" nnoremap <Left> :echo "No left for you!"<CR>
" vnoremap <Left> :<C-u>echo "No left for you!"<CR>
" inoremap <Left> <C-o>:echo "No left for you!"<CR>
" nnoremap <Right> :echo "No right for you!"<CR>
" vnoremap <Right> :<C-u>echo "No right for you!"<CR>
" inoremap <Right> <C-o>:echo "No right for you!"<CR>
" nnoremap <Up> :echo "No Up for you!"<CR>
" vnoremap <Up> :<C-u>echo "No Up for you!"<CR>
" inoremap <Up> <C-o>:echo "No Up for you!"<CR>
" nnoremap <Down> :echo "No Down for you!"<CR>
" vnoremap <Down> :<C-u>echo "No Down for you!"<CR>
" inoremap <Down> <C-o>:echo "No Down for you!"<CR>
" Remove newbie crutches in Command Mode
cnoremap <Down> <Nop>
cnoremap <Left> <Nop>
cnoremap <Right> <Nop>
@ -145,4 +107,3 @@ vnoremap <Down> <Nop>
vnoremap <Left> <Nop>
vnoremap <Right> <Nop>
vnoremap <Up> <Nop>

File diff suppressed because it is too large Load diff