diff --git a/com.googlecode.iterm2.plist b/com.googlecode.iterm2.plist index d186262..9dc9766 100644 --- a/com.googlecode.iterm2.plist +++ b/com.googlecode.iterm2.plist @@ -697,11 +697,11 @@ Name Default Non Ascii Font - Monaco 12 + InconsolataNFM-Regular 12 Non-ASCII Anti Aliased Normal Font - Inconsolata-Regular 16 + InconsolataNFM-Regular 12 Option Key Sends 2 Prompt Before Closing 2 diff --git a/config/nvim/init.vim b/config/nvim/init.vim deleted file mode 100644 index 6492696..0000000 --- a/config/nvim/init.vim +++ /dev/null @@ -1,7 +0,0 @@ -set runtimepath^=~/.vim runtimepath+=~/.vim/after -let &packpath = &runtimepath -source ~/.vimrc - -set termguicolors - -set inccommand=nosplit " Show substitutions incrementally, as you type them diff --git a/config/nvim/lua/user/README.md b/config/nvim/lua/user/README.md new file mode 100644 index 0000000..75ba351 --- /dev/null +++ b/config/nvim/lua/user/README.md @@ -0,0 +1,28 @@ +# AstroNvim User Configuration + +## 🛠️ Installation + +### Make a backup of your current nvim and shared folder + +```shell +mv ~/.config/nvim ~/.config/nvim.bak +mv ~/.local/share/nvim ~/.local/share/nvim.bak +``` + +### Clone AstroNvim base config + +```shell +git clone https://github.com/AstroNvim/AstroNvim ~/.config/nvim +``` + +### Copy my user config + +```shell +cp ~/.config/nvim/lua/user +``` + +### Start Neovim + +```shell +nvim +``` diff --git a/config/nvim/lua/user/init.lua b/config/nvim/lua/user/init.lua new file mode 100644 index 0000000..e27246a --- /dev/null +++ b/config/nvim/lua/user/init.lua @@ -0,0 +1,85 @@ +return { + -- Configure AstroNvim updates + updater = { + remote = "origin", -- remote to use + channel = "stable", -- "stable" or "nightly" + version = "latest", -- "latest", tag name, or regex search like "v1.*" to only do updates before v2 (STABLE ONLY) + -- branch = "nightly", -- branch name (NIGHTLY ONLY) + -- commit = nil, -- commit hash (NIGHTLY ONLY) + pin_plugins = nil, -- nil, true, false (nil will pin plugins on stable only) + skip_prompts = false, -- skip prompts about breaking changes + show_changelog = true, -- show the changelog after performing an update + auto_quit = false, -- automatically quit the current session after a successful update + remotes = { -- easily add new remotes to track + -- ["remote_name"] = "https://remote_url.come/repo.git", -- full remote url + -- ["remote2"] = "github_user/repo", -- GitHub user/repo shortcut, + -- ["remote3"] = "github_user", -- GitHub user assume AstroNvim fork + }, + }, + + -- Set colorscheme to use + colorscheme = "astrodark", + + -- Diagnostics configuration (for vim.diagnostics.config({...})) when diagnostics are on + diagnostics = { + virtual_text = true, + underline = true, + }, + + lsp = { + -- customize lsp formatting options + formatting = { + -- control auto formatting on save + format_on_save = { + enabled = true, -- enable or disable format on save globally + allow_filetypes = { -- enable format on save for specified filetypes only + -- "go", + }, + ignore_filetypes = { -- disable format on save for specified filetypes + -- "python", + }, + }, + disabled = { -- disable formatting capabilities for the listed language servers + -- disable lua_ls formatting capability if you want to use StyLua to format your lua code + -- "lua_ls", + }, + timeout_ms = 25000, -- default format timeout + -- filter = function(client) -- fully override the default formatting function + -- return true + -- end + }, + -- enable servers that you already have installed without mason + servers = { + -- "pyright" + }, + }, + + -- Configure require("lazy").setup() options + lazy = { + defaults = { lazy = true }, + performance = { + rtp = { + -- customize default disabled vim plugins + disabled_plugins = { "tohtml", "gzip", "matchit", "zipPlugin", "netrwPlugin", "tarPlugin" }, + }, + }, + }, + + -- This function is run last and is a good place to configuring + -- augroups/autocommands and custom filetypes also this just pure lua so + -- anything that doesn't fit in the normal config locations above can go here + polish = function() + -- Set up custom filetypes + -- vim.filetype.add { + -- extension = { + -- foo = "fooscript", + -- }, + -- filename = { + -- ["Foofile"] = "fooscript", + -- }, + -- pattern = { + -- ["~/%.config/foo/.*"] = "fooscript", + -- }, + -- } + end, +} diff --git a/config/nvim/lua/user/mappings.lua b/config/nvim/lua/user/mappings.lua new file mode 100644 index 0000000..6759114 --- /dev/null +++ b/config/nvim/lua/user/mappings.lua @@ -0,0 +1,44 @@ +-- Mapping data with "desc" stored directly by vim.keymap.set(). +-- +-- Please use this mappings table to set keyboard mapping since this is the +-- lower level configuration and more robust one. (which-key will +-- automatically pick-up stored data by this setting.) +return { + n = { + [""] = { "" }, + ["Q"] = { "gq" }, + + -- "Chordless" keys to move between windows + ["gj"] = { "j" }, + ["gk"] = { "k" }, + ["gh"] = { "h" }, + ["gl"] = { "l" }, + + -- Copy current filename to system clipboard + ["f"] = { "let @* = expand(\"%%\")" }, + + -- Move a line of text around with Alt+j/Alt+k + [""] = { "mz:m+`z" }, + [""] = { "mz:m-2`z" }, + }, + v = { + [""] = { "gV" }, + + -- Move selected lines around with Alt+j/Alt+k + [""] = { ":m'>+`mzgv`yo`z" }, + [""] = { ":m'<-2`>my`"] = { "" }, + }, + i = { + [""] = { "`^" }, + + -- Some basic readline mappings in insert mode + [""] = { "" }, + [""] = { "" }, + [""] = { "" }, + }, + t = { + }, +} diff --git a/config/nvim/lua/user/options.lua b/config/nvim/lua/user/options.lua new file mode 100644 index 0000000..6b16273 --- /dev/null +++ b/config/nvim/lua/user/options.lua @@ -0,0 +1,30 @@ +-- set vim options here (vim.. = value) +return { + opt = { + -- set to true or false etc. + relativenumber = false, -- sets vim.opt.relativenumber + number = true, -- sets vim.opt.number + spell = false, -- sets vim.opt.spell + signcolumn = "auto", -- sets vim.opt.signcolumn to auto + wrap = false, -- sets vim.opt.wrap + guifont = "Inconsolata Nerd Font Mono", + }, + g = { + mapleader = " ", -- sets vim.g.mapleader + autoformat_enabled = true, -- enable or disable auto formatting at start (lsp.formatting.format_on_save must be enabled) + cmp_enabled = true, -- enable completion at start + autopairs_enabled = false, -- enable autopairs at start + diagnostics_mode = 3, -- set the visibility of diagnostics in the UI (0=off, 1=only show in status line, 2=virtual text off, 3=all on) + icons_enabled = true, -- disable icons in the UI (disable if no nerd font is available, requires :PackerSync after changing) + ui_notifications_enabled = true, -- disable notifications when toggling UI elements + }, +} +-- If you need more control, you can use the function()...end notation +-- return function(local_vim) +-- local_vim.opt.relativenumber = true +-- local_vim.g.mapleader = " " +-- local_vim.opt.whichwrap = vim.opt.whichwrap - { 'b', 's' } -- removing option from list +-- local_vim.opt.shortmess = vim.opt.shortmess + { I = true } -- add to option list +-- +-- return local_vim +-- end diff --git a/config/nvim/lua/user/plugins/core.lua b/config/nvim/lua/user/plugins/core.lua new file mode 100644 index 0000000..fc39ef9 --- /dev/null +++ b/config/nvim/lua/user/plugins/core.lua @@ -0,0 +1,20 @@ +return { + { "max397574/better-escape.nvim", enabled = false }, + { "windwp/nvim-autopairs", enabled = false }, + { + "hrsh7th/nvim-cmp", + opts = function(_, opts) + -- I use Ctrl-Space at the OS level + opts.mapping[""] = nil + -- Unnecessary and potentially confusing + opts.mapping[""] = nil + -- Unnecessary and potentially confusing + opts.mapping[""] = nil + -- Incompatible with my using for + opts.mapping[""] = nil + opts.mapping[""] = nil + + return opts + end, + }, +} diff --git a/vim/bundle/vim-abolish/.gitignore b/vim/bundle/vim-abolish/.gitignore deleted file mode 100644 index 0a56e3f..0000000 --- a/vim/bundle/vim-abolish/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/doc/tags diff --git a/vim/bundle/vim-abolish/CONTRIBUTING.markdown b/vim/bundle/vim-abolish/CONTRIBUTING.markdown deleted file mode 100644 index b3f0095..0000000 --- a/vim/bundle/vim-abolish/CONTRIBUTING.markdown +++ /dev/null @@ -1 +0,0 @@ -See the [contribution guidelines for pathogen.vim](https://github.com/tpope/vim-pathogen/blob/master/CONTRIBUTING.markdown). diff --git a/vim/bundle/vim-abolish/README.markdown b/vim/bundle/vim-abolish/README.markdown deleted file mode 100644 index beb696c..0000000 --- a/vim/bundle/vim-abolish/README.markdown +++ /dev/null @@ -1,150 +0,0 @@ -# abolish.vim - -I sat on this plugin for 3 years before releasing it, primarily -because it's so gosh darn hard to explain. It's three superficially -unrelated plugins in one that share a common theme: working with -variants of a word. - -## Abbreviation - -I know how to spell "separate". I know how to spell "desperate". My -fingers, however, have trouble distinguishing between the two, and I -invariably have a 50 percent chance of typing "seperate" or "desparate" -each time one of these comes up. At first, I tried abbreviations: - - :iabbrev seperate separate - :iabbrev desparate desperate - -But this falls short at the beginning of a sentence. - - :iabbrev Seperate Separate - :iabbrev Desparate Desperate - -To be really thorough, we need uppercase too! - - :iabbrev SEPERATE SEPARATE - :iabbrev DESPARATE DESPERATE - -Oh, but consider the noun form, and the adverb form! - - :iabbrev seperation separation - :iabbrev desparation desperation - :iabbrev seperately separately - :iabbrev desparately desperately - :iabbrev Seperation separation - :iabbrev Desparation Desperation - :iabbrev Seperately Separately - :iabbrev Desparately Desperately - :iabbrev SEPERATION SEPARATION - :iabbrev DESPARATION DESPERATION - :iabbrev SEPERATELY SEPARATELY - :iabbrev DESPARATELY DESPERATELY - -Wait, there's also "separates", "separated", "separating", -"separations", "separator"... - -Abolish.vim provides a simpler way. The following one command produces -48 abbreviations including all of the above. - - :Abolish {despa,sepe}rat{e,es,ed,ing,ely,ion,ions,or} {despe,sepa}rat{} - -My current configuration has 25 Abolish commands that create hundreds of -corrections my fingers refuse to learn. - -## Substitution - -One time I had an application with a domain model called -"facility" that needed to be renamed to "building". So, a simple -search and replace, right? - - :%s/facility/building/g - -Oh, but the case variants! - - :%s/Facility/Building/g - :%s/FACILITY/BUILDING/g - -Wait, the plural is more than "s" so we need to get that too! - - :%s/facilities/buildings/g - :%s/Facilities/Buildings/g - :%s/FACILITIES/BUILDINGS/g - -Abolish.vim has your back. One command to do all six, and you can -repeat it with `&` too! - - :%Subvert/facilit{y,ies}/building{,s}/g - -From a conceptual level, one way to think about how this substitution -works is to imagine that in the braces you are declaring the -requirements for turning that word from singular to plural. In -the facility example, the same base letters in both the singular -and plural form of the word are `facilit` To turn "facility" to a -plural word you must change the `y` to `ies` so you specify -`{y,ies}` in the braces. - -To convert the word "building" from singular to plural, again -look at the common letters between the singular and plural forms: -`building`. In this case you do not need to remove any letter -from building to turn it into plural form and you need to -add an `s` so the braces should be `{,s}`. - -A few more examples: - -Address to Reference - - :Subvert/address{,es}/reference{,s}/g - -Blog to Post (you can just do this with a regular :s also) - - :Subvert/blog{,s}/post{,s}/g - -Child to Adult - - :Subvert/child{,ren}/adult{,s}/g - -Be amazed as it correctly turns the word children into the word adults! - -Die to Spinner - - :Subvert/di{e,ce}/spinner{,s}/g - -You can abbreviate it as `:S`, and it accepts the full range of flags -including things like `c` (confirm). - -There's also a variant for searching and a variant for grepping. - -## Coercion - -Want to turn `fooBar` into `foo_bar`? Press `crs` (coerce to -snake\_case). MixedCase (`crm`), camelCase (`crc`), snake\_case -(`crs`), UPPER\_CASE (`cru`), dash-case (`cr-`), dot.case (`cr.`), -space case (`cr`), and Title Case (`crt`) are all just 3 -keystrokes away. These commands support -[repeat.vim](https://github.com/tpope/vim-repeat). - -## Installation - -If you don't have a preferred installation method, I recommend -installing [pathogen.vim](https://github.com/tpope/vim-pathogen), and -then simply copy and paste: - - cd ~/.vim/bundle - git clone git://github.com/tpope/vim-abolish.git - -Once help tags have been generated, you can view the manual with -`:help abolish`. - -## Self-Promotion - -Like abolish.vim? Follow the repository on -[GitHub](https://github.com/tpope/vim-abolish) and vote for it on -[vim.org](http://www.vim.org/scripts/script.php?script_id=1545). 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 (c) Tim Pope. Distributed under the same terms as Vim itself. -See `:help license`. diff --git a/vim/bundle/vim-abolish/doc/abolish.txt b/vim/bundle/vim-abolish/doc/abolish.txt deleted file mode 100644 index 91f24da..0000000 --- a/vim/bundle/vim-abolish/doc/abolish.txt +++ /dev/null @@ -1,181 +0,0 @@ -*abolish.txt* Language friendly searches, substitutions, and abbreviations - -Author: Tim Pope -License: Same terms as Vim itself (see |license|) - -This plugin is only available if 'compatible' is not set. - -INTRODUCTION *abolish* *:Abolish* *:Subvert* - -Abolish lets you quickly find, substitute, and abbreviate several variations -of a word at once. By default, three case variants (foo, Foo, and FOO) are -operated on by every command. - -Two commands are provided. :Abolish is the most general interface. -:Subvert provides an alternative, more concise syntax for searching and -substituting. -> - :Abolish [options] {abbreviation} {replacement} - :Abolish -delete [options] {abbreviation} - - :Abolish -search [options] {pattern} - :Subvert/{pattern}[/flags] - :Abolish!-search [options] {pattern} - :Subvert?{pattern}[?flags] - - :Abolish -search [options] {pattern} {grep-arguments} - :Subvert /{pattern}/[flags] {grep-options} - :Abolish!-search [options] {pattern} {grep-arguments} - :Subvert!/{pattern}/[flags] {grep-options} - - :[range]Abolish -substitute [options] {pattern} {replacement} - :[range]Subvert/{pattern}/{replacement}[/flags] -< - *:S* -In addition to the :Subvert command, a :S synonym is provided if not -already defined. This will be used in examples below. - -PATTERNS *abolish-patterns* - -Patterns can include brace pairs that contain comma separated alternatives: - - box{,es} => box, boxes, Box, Boxes, BOX, BOXES - -For commands with a replacement, corresponding brace pairs are used in both -halves. If the replacement should be identical to the pattern, an empty -brace pair may be used. If fewer replacements are given than were given in -the pattern, they are looped. That is, {a,b} on the replacement side is the -same as {a,b,a,b,a,b,...} repeated indefinitely. - -The following replaces several different misspellings of "necessary": -> - :%S/{,un}nec{ce,ces,e}sar{y,ily}/{}nec{es}sar{}/g -< -ABBREVIATING *abolish-abbrev* - -By default :Abolish creates abbreviations, which replace words automatically -as you type. This is good for words you frequently misspell, or as -shortcuts for longer words. Since these are just Vim abbreviations, only -whole words will match. -> - :Abolish anomol{y,ies} anomal{} - :Abolish {,in}consistant{,ly} {}consistent{} - :Abolish Tqbf The quick, brown fox jumps over the lazy dog -< -Accepts the following options: - - -buffer: buffer local - -cmdline: work in command line in addition to insert mode - -A good place to define abbreviations is "after/plugin/abolish.vim", -relative to ~\vimfiles on Windows and ~/.vim everywhere else. - -With a bang (:Abolish!) the abbreviation is also appended to the file in -g:abolish_save_file. The default is "after/plugin/abolish.vim", relative -to the install directory. - -Abbreviations can be removed with :Abolish -delete: -> - Abolish -delete -buffer -cmdline anomol{y,ies} -< -SEARCHING *abolish-search* - -The -search command does a search in a manner similar to / key. -search. After searching, you can use |n| and |N| as you would with a normal -search. - -The following will search for box, Box, and BOX: -> - :Abolish -search box -< -When given a single word to operate on, :Subvert defaults to doing a -search as well: -> - :S/box/ -< -This one searches for box, boxes, boxed, boxing, Box, Boxes, Boxed, Boxing, -BOX, BOXES, BOXED, and BOXING: -> - :S/box{,es,ed,ing}/ -< -The following syntaxes search in reverse. -> - :Abolish! -search box - :S?box? -< -Flags can be given with the -flags= option to :Abolish, or by appending them -after the separator to :Subvert. The flags trigger the following behaviors: - - I: Disable case variations (box, Box, BOX) - v: Match inside variable names (match my_box, myBox, but not mybox) - w: Match whole words (like surrounding with \< and \>) - -A |search-offset| may follow the flags. -> - :Abolish -search -flags=avs+1 box - :S?box{,es,ed,ing}?we -< -GREPPING *abolish-grep* - -Grepping works similar to searching, and is invoked when additional options -are given. These options are passed directly to the :grep command. -> - :Abolish -search box{,es} - :S /box{,es}/ * - :S /box/aw *.txt *.html -< -The slash delimiters must both be present if used with :Subvert. They may -both be omitted if no flags are used. - -Both an external grepprg and vimgrep (via grepprg=internal) are supported. -With an external grep, the "v" flag behaves less intelligently, due to the -lack of look ahead and look behind support in grep regexps. - -SUBSTITUTING *abolish-substitute* - -Giving a range switches :Subvert into substitute mode. This command will -change box -> bag, boxes -> bags, Box -> Bag, Boxes -> Bags, BOX -> BAG, -BOXES -> BAGS across the entire document: -> - :%Abolish -substitute -flags=g box{,es} bag{,s} - :%S/box{,es}/bag{,s}/g -< -The "c", "e", "g", and "n" flags can be used from the substitute command -|:s_flags|, along with the "a", "I", "v", and "w" flags from searching. - -COERCION *abolish-coercion* *cr* - -Abolish's case mutating algorithms can be applied to the word under the cursor -using the cr mapping (mnemonic: CoeRce) followed by one of the following -characters: - - c: camelCase - m: MixedCase - _: snake_case - s: snake_case - u: SNAKE_UPPERCASE - U: SNAKE_UPPERCASE - -: dash-case (not usually reversible; see |abolish-coercion-reversible|) - k: kebab-case (not usually reversible; see |abolish-coercion-reversible|) - .: dot.case (not usually reversible; see |abolish-coercion-reversible|) - : space case (not usually reversible; see |abolish-coercion-reversible|) - t: Title Case (not usually reversible; see |abolish-coercion-reversible|) - -For example, cru on a lowercase word is a slightly easier to type equivalent -to gUiw. - -COERCION REVERSIBILITY *abolish-coercion-reversible* - -Some separators, such as "-" and ".", are listed as "not usually reversible". -The reason is that these are not "keyword characters", so vim (and -abolish.vim) will treat them as breaking a word. - -For example: "key_word" is a single keyword. The dash-case version, -"key-word", is treated as two keywords, "key" and "word". - -This behaviour is governed by the 'iskeyword' option. If a separator appears -in 'iskeyword', the corresponding coercion will be reversible. For instance, -dash-case is reversible in 'lisp' files, and dot-case is reversible in R -files. - - vim:tw=78:ts=8:ft=help:norl: diff --git a/vim/bundle/vim-abolish/plugin/abolish.vim b/vim/bundle/vim-abolish/plugin/abolish.vim deleted file mode 100644 index e2486c1..0000000 --- a/vim/bundle/vim-abolish/plugin/abolish.vim +++ /dev/null @@ -1,631 +0,0 @@ -" abolish.vim - Language friendly searches, substitutions, and abbreviations -" Maintainer: Tim Pope -" Version: 1.1 -" GetLatestVimScripts: 1545 1 :AutoInstall: abolish.vim - -" Initialization {{{1 - -if exists("g:loaded_abolish") || &cp || v:version < 700 - finish -endif -let g:loaded_abolish = 1 - -if !exists("g:abolish_save_file") - if isdirectory(expand("~/.vim")) - let g:abolish_save_file = expand("~/.vim/after/plugin/abolish.vim") - elseif isdirectory(expand("~/vimfiles")) || has("win32") - let g:abolish_save_file = expand("~/vimfiles/after/plugin/abolish.vim") - else - let g:abolish_save_file = expand("~/.vim/after/plugin/abolish.vim") - endif -endif - -" }}}1 -" Utility functions {{{1 - -function! s:function(name) - return function(substitute(a:name,'^s:',matchstr(expand(''), '\d\+_'),'')) -endfunction - -function! s:send(self,func,...) - if type(a:func) == type('') || type(a:func) == type(0) - let Func = get(a:self,a:func,'') - else - let Func = a:func - endif - let s = type(a:self) == type({}) ? a:self : {} - if type(Func) == type(function('tr')) - return call(Func,a:000,s) - elseif type(Func) == type({}) && has_key(Func,'apply') - return call(Func.apply,a:000,Func) - elseif type(Func) == type({}) && has_key(Func,'call') - return call(Func.call,a:000,s) - elseif type(Func) == type('') && Func == '' && has_key(s,'function missing') - return call('s:send',[s,'function missing',a:func] + a:000) - else - return Func - endif -endfunction - -let s:object = {} -function! s:object.clone(...) - let sub = deepcopy(self) - return a:0 ? extend(sub,a:1) : sub -endfunction - -if !exists("g:Abolish") - let Abolish = {} -endif -call extend(Abolish, s:object, 'force') -call extend(Abolish, {'Coercions': {}}, 'keep') - -function! s:throw(msg) - let v:errmsg = a:msg - throw "Abolish: ".a:msg -endfunction - -function! s:words() - let words = [] - let lnum = line('w0') - while lnum <= line('w$') - let line = getline(lnum) - let col = 0 - while match(line,'\<\k\k\+\>',col) != -1 - let words += [matchstr(line,'\<\k\k\+\>',col)] - let col = matchend(line,'\<\k\k\+\>',col) - endwhile - let lnum += 1 - endwhile - return words -endfunction - -function! s:extractopts(list,opts) - let i = 0 - while i < len(a:list) - if a:list[i] =~ '^-[^=]' && has_key(a:opts,matchstr(a:list[i],'-\zs[^=]*')) - let key = matchstr(a:list[i],'-\zs[^=]*') - let value = matchstr(a:list[i],'=\zs.*') - if type(get(a:opts,key)) == type([]) - let a:opts[key] += [value] - elseif type(get(a:opts,key)) == type(0) - let a:opts[key] = 1 - else - let a:opts[key] = value - endif - else - let i += 1 - continue - endif - call remove(a:list,i) - endwhile - return a:opts -endfunction - -" }}}1 -" Dictionary creation {{{1 - -function! s:mixedcase(word) - return substitute(s:camelcase(a:word),'^.','\u&','') -endfunction - -function! s:camelcase(word) - let word = substitute(a:word, '-', '_', 'g') - if word !~# '_' && word =~# '\l' - return substitute(word,'^.','\l&','') - else - return substitute(word,'\C\(_\)\=\(.\)','\=submatch(1)==""?tolower(submatch(2)) : toupper(submatch(2))','g') - endif -endfunction - -function! s:snakecase(word) - let word = substitute(a:word,'::','/','g') - let word = substitute(word,'\(\u\+\)\(\u\l\)','\1_\2','g') - let word = substitute(word,'\(\l\|\d\)\(\u\)','\1_\2','g') - let word = substitute(word,'[.-]','_','g') - let word = tolower(word) - return word -endfunction - -function! s:uppercase(word) - return toupper(s:snakecase(a:word)) -endfunction - -function! s:dashcase(word) - return substitute(s:snakecase(a:word),'_','-','g') -endfunction - -function! s:spacecase(word) - return substitute(s:snakecase(a:word),'_',' ','g') -endfunction - -function! s:dotcase(word) - return substitute(s:snakecase(a:word),'_','.','g') -endfunction - -function! s:titlecase(word) - return substitute(s:spacecase(a:word), '\(\<\w\)','\=toupper(submatch(1))','g') -endfunction - -call extend(Abolish, { - \ 'camelcase': s:function('s:camelcase'), - \ 'mixedcase': s:function('s:mixedcase'), - \ 'snakecase': s:function('s:snakecase'), - \ 'uppercase': s:function('s:uppercase'), - \ 'dashcase': s:function('s:dashcase'), - \ 'dotcase': s:function('s:dotcase'), - \ 'spacecase': s:function('s:spacecase'), - \ 'titlecase': s:function('s:titlecase') - \ }, 'keep') - -function! s:create_dictionary(lhs,rhs,opts) - let dictionary = {} - let i = 0 - let expanded = s:expand_braces({a:lhs : a:rhs}) - for [lhs,rhs] in items(expanded) - if get(a:opts,'case',1) - let dictionary[s:mixedcase(lhs)] = s:mixedcase(rhs) - let dictionary[tolower(lhs)] = tolower(rhs) - let dictionary[toupper(lhs)] = toupper(rhs) - endif - let dictionary[lhs] = rhs - endfor - let i += 1 - return dictionary -endfunction - -function! s:expand_braces(dict) - let new_dict = {} - for [key,val] in items(a:dict) - if key =~ '{.*}' - let redo = 1 - let [all,kbefore,kmiddle,kafter;crap] = matchlist(key,'\(.\{-\}\){\(.\{-\}\)}\(.*\)') - let [all,vbefore,vmiddle,vafter;crap] = matchlist(val,'\(.\{-\}\){\(.\{-\}\)}\(.*\)') + ["","","",""] - if all == "" - let [vbefore,vmiddle,vafter] = [val, ",", ""] - endif - let targets = split(kmiddle,',',1) - let replacements = split(vmiddle,',',1) - if replacements == [""] - let replacements = targets - endif - for i in range(0,len(targets)-1) - let new_dict[kbefore.targets[i].kafter] = vbefore.replacements[i%len(replacements)].vafter - endfor - else - let new_dict[key] = val - endif - endfor - if exists("redo") - return s:expand_braces(new_dict) - else - return new_dict - endif -endfunction - -" }}}1 -" Abolish Dispatcher {{{1 - -function! s:SubComplete(A,L,P) - if a:A =~ '^[/?]\k\+$' - let char = strpart(a:A,0,1) - return join(map(s:words(),'char . v:val'),"\n") - elseif a:A =~# '^\k\+$' - return join(s:words(),"\n") - endif -endfunction - -function! s:Complete(A,L,P) - let g:L = a:L - " Vim bug: :Abolish - calls this function with a:A equal to 0 - if a:A =~# '^[^/?-]' && type(a:A) != type(0) - return join(s:words(),"\n") - elseif a:L =~# '^\w\+\s\+\%(-\w*\)\=$' - return "-search\n-substitute\n-delete\n-buffer\n-cmdline\n" - elseif a:L =~# ' -\%(search\|substitute\)\>' - return "-flags=" - else - return "-buffer\n-cmdline" - endif -endfunction - -let s:commands = {} -let s:commands.abstract = s:object.clone() - -function! s:commands.abstract.dispatch(bang,line1,line2,count,args) - return self.clone().go(a:bang,a:line1,a:line2,a:count,a:args) -endfunction - -function! s:commands.abstract.go(bang,line1,line2,count,args) - let self.bang = a:bang - let self.line1 = a:line1 - let self.line2 = a:line2 - let self.count = a:count - return self.process(a:bang,a:line1,a:line2,a:count,a:args) -endfunction - -function! s:dispatcher(bang,line1,line2,count,args) - let i = 0 - let args = copy(a:args) - let command = s:commands.abbrev - while i < len(args) - if args[i] =~# '^-\w\+$' && has_key(s:commands,matchstr(args[i],'-\zs.*')) - let command = s:commands[matchstr(args[i],'-\zs.*')] - call remove(args,i) - break - endif - let i += 1 - endwhile - try - return command.dispatch(a:bang,a:line1,a:line2,a:count,args) - catch /^Abolish: / - echohl ErrorMsg - echo v:errmsg - echohl NONE - return "" - endtry -endfunction - -" }}}1 -" Subvert Dispatcher {{{1 - -function! s:subvert_dispatcher(bang,line1,line2,count,args) - try - return s:parse_subvert(a:bang,a:line1,a:line2,a:count,a:args) - catch /^Subvert: / - echohl ErrorMsg - echo v:errmsg - echohl NONE - return "" - endtry -endfunction - -function! s:parse_subvert(bang,line1,line2,count,args) - if a:args =~ '^\%(\w\|$\)' - let args = (a:bang ? "!" : "").a:args - else - let args = a:args - endif - let separator = matchstr(args,'^.') - let split = split(args,separator,1)[1:] - if a:count || split == [""] - return s:parse_substitute(a:bang,a:line1,a:line2,a:count,split) - elseif len(split) == 1 - return s:find_command(separator,"",split[0]) - elseif len(split) == 2 && split[1] =~# '^[A-Za-z]*n[A-Za-z]*$' - return s:parse_substitute(a:bang,a:line1,a:line2,a:count,[split[0],"",split[1]]) - elseif len(split) == 2 && split[1] =~# '^[A-Za-z]*\%([+-]\d\+\)\=$' - return s:find_command(separator,split[1],split[0]) - elseif len(split) >= 2 && split[1] =~# '^[A-Za-z]* ' - let flags = matchstr(split[1],'^[A-Za-z]*') - let rest = matchstr(join(split[1:],separator),' \zs.*') - return s:grep_command(rest,a:bang,flags,split[0]) - elseif len(split) >= 2 && separator == ' ' - return s:grep_command(join(split[1:],' '),a:bang,"",split[0]) - else - return s:parse_substitute(a:bang,a:line1,a:line2,a:count,split) - endif -endfunction - -function! s:normalize_options(flags) - if type(a:flags) == type({}) - let opts = a:flags - let flags = get(a:flags,"flags","") - else - let opts = {} - let flags = a:flags - endif - let g:op1 = copy(opts) - if flags =~# 'w' - let opts.boundaries = 2 - elseif flags =~# 'v' - let opts.boundaries = 1 - elseif !has_key(opts,'boundaries') - let opts.boundaries = 0 - endif - let opts.case = (flags !~# 'I' ? get(opts,'case',1) : 0) - let opts.flags = substitute(flags,'\C[avIiw]','','g') - let g:op2 = copy(opts) - return opts -endfunction - -" }}}1 -" Searching {{{1 - -function! s:subesc(pattern) - return substitute(a:pattern,'[][\\/.*+?~%()&]','\\&','g') -endfunction - -function! s:sort(a,b) - if a:a ==? a:b - return a:a == a:b ? 0 : a:a > a:b ? 1 : -1 - elseif strlen(a:a) == strlen(a:b) - return a:a >? a:b ? 1 : -1 - else - return strlen(a:a) < strlen(a:b) ? 1 : -1 - endif -endfunction - -function! s:pattern(dict,boundaries) - if a:boundaries == 2 - let a = '<' - let b = '>' - elseif a:boundaries - let a = '%(<|_@<=|[[:lower:]]@<=[[:upper:]]@=)' - let b = '%(>|_@=|[[:lower:]]@<=[[:upper:]]@=)' - else - let a = '' - let b = '' - endif - return '\v\C'.a.'%('.join(map(sort(keys(a:dict),function('s:sort')),'s:subesc(v:val)'),'|').')'.b -endfunction - -function! s:egrep_pattern(dict,boundaries) - if a:boundaries == 2 - let a = '\<' - let b = '\>' - elseif a:boundaries - let a = '(\<\|_)' - let b = '(\>\|_\|[[:upper:]][[:lower:]])' - else - let a = '' - let b = '' - endif - return a.'('.join(map(sort(keys(a:dict),function('s:sort')),'s:subesc(v:val)'),'\|').')'.b -endfunction - -function! s:c() - call histdel('search',-1) - return "" -endfunction - -function! s:find_command(cmd,flags,word) - let opts = s:normalize_options(a:flags) - let dict = s:create_dictionary(a:word,"",opts) - " This is tricky. If we use :/pattern, the search drops us at the - " beginning of the line, and we can't use position flags (e.g., /foo/e). - " If we use :norm /pattern, we leave ourselves vulnerable to "press enter" - " prompts (even with :silent). - let cmd = (a:cmd =~ '[?!]' ? '?' : '/') - let @/ = s:pattern(dict,opts.boundaries) - if opts.flags == "" || !search(@/,'n') - return "norm! ".cmd."\" - elseif opts.flags =~ ';[/?]\@!' - call s:throw("E386: Expected '?' or '/' after ';'") - else - return "exe 'norm! ".cmd.cmd.opts.flags."\'|call histdel('search',-1)" - return "" - endif -endfunction - -function! s:grep_command(args,bang,flags,word) - let opts = s:normalize_options(a:flags) - let dict = s:create_dictionary(a:word,"",opts) - if &grepprg == "internal" - let lhs = "'".s:pattern(dict,opts.boundaries)."'" - else - let lhs = "-E '".s:egrep_pattern(dict,opts.boundaries)."'" - endif - return "grep".(a:bang ? "!" : "")." ".lhs." ".a:args -endfunction - -let s:commands.search = s:commands.abstract.clone() -let s:commands.search.options = {"word": 0, "variable": 0, "flags": ""} - -function! s:commands.search.process(bang,line1,line2,count,args) - call s:extractopts(a:args,self.options) - if self.options.word - let self.options.flags .= "w" - elseif self.options.variable - let self.options.flags .= "v" - endif - let opts = s:normalize_options(self.options) - if len(a:args) > 1 - return s:grep_command(join(a:args[1:]," "),a:bang,opts,a:args[0]) - elseif len(a:args) == 1 - return s:find_command(a:bang ? "!" : " ",opts,a:args[0]) - else - call s:throw("E471: Argument required") - endif -endfunction - -" }}}1 -" Substitution {{{1 - -function! Abolished() - return get(g:abolish_last_dict,submatch(0),submatch(0)) -endfunction - -function! s:substitute_command(cmd,bad,good,flags) - let opts = s:normalize_options(a:flags) - let dict = s:create_dictionary(a:bad,a:good,opts) - let lhs = s:pattern(dict,opts.boundaries) - let g:abolish_last_dict = dict - return a:cmd.'/'.lhs.'/\=Abolished()'."/".opts.flags -endfunction - -function! s:parse_substitute(bang,line1,line2,count,args) - if get(a:args,0,'') =~ '^[/?'']' - let separator = matchstr(a:args[0],'^.') - let args = split(join(a:args,' '),separator,1) - call remove(args,0) - else - let args = a:args - endif - if len(args) < 2 - call s:throw("E471: Argument required") - elseif len(args) > 3 - call s:throw("E488: Trailing characters") - endif - let [bad,good,flags] = (args + [""])[0:2] - if a:count == 0 - let cmd = "substitute" - else - let cmd = a:line1.",".a:line2."substitute" - endif - return s:substitute_command(cmd,bad,good,flags) -endfunction - -let s:commands.substitute = s:commands.abstract.clone() -let s:commands.substitute.options = {"word": 0, "variable": 0, "flags": "g"} - -function! s:commands.substitute.process(bang,line1,line2,count,args) - call s:extractopts(a:args,self.options) - if self.options.word - let self.options.flags .= "w" - elseif self.options.variable - let self.options.flags .= "v" - endif - let opts = s:normalize_options(self.options) - if len(a:args) <= 1 - call s:throw("E471: Argument required") - else - let good = join(a:args[1:],"") - let cmd = a:bang ? "." : "%" - return s:substitute_command(cmd,a:args[0],good,self.options) - endif -endfunction - -" }}}1 -" Abbreviations {{{1 - -function! s:badgood(args) - let words = filter(copy(a:args),'v:val !~ "^-"') - call filter(a:args,'v:val =~ "^-"') - if empty(words) - call s:throw("E471: Argument required") - elseif !empty(a:args) - call s:throw("Unknown argument: ".a:args[0]) - endif - let [bad; words] = words - return [bad, join(words," ")] -endfunction - -function! s:abbreviate_from_dict(cmd,dict) - for [lhs,rhs] in items(a:dict) - exe a:cmd lhs rhs - endfor -endfunction - -let s:commands.abbrev = s:commands.abstract.clone() -let s:commands.abbrev.options = {"buffer":0,"cmdline":0,"delete":0} -function! s:commands.abbrev.process(bang,line1,line2,count,args) - let args = copy(a:args) - call s:extractopts(a:args,self.options) - if self.options.delete - let cmd = "unabbrev" - let good = "" - else - let cmd = "noreabbrev" - endif - if !self.options.cmdline - let cmd = "i" . cmd - endif - if self.options.delete - let cmd = "silent! ".cmd - endif - if self.options.buffer - let cmd = cmd . " " - endif - let [bad, good] = s:badgood(a:args) - if substitute(bad,'{.\{-\}.}','','g') !~ '^\k\+$' - call s:throw("E474: Invalid argument (not a keyword: ".string(bad).")") - endif - if !self.options.delete && good == "" - call s:throw("E471: Argument required".a:args[0]) - endif - let dict = s:create_dictionary(bad,good,self.options) - call s:abbreviate_from_dict(cmd,dict) - if a:bang - let i = 0 - let str = "Abolish ".join(args," ") - let file = g:abolish_save_file - if !isdirectory(fnamemodify(file,':h')) - call mkdir(fnamemodify(file,':h'),'p') - endif - - if filereadable(file) - let old = readfile(file) - else - let old = ["\" Exit if :Abolish isn't available.","if !exists(':Abolish')"," finish","endif",""] - endif - call writefile(old + [str],file) - endif - return "" -endfunction - -let s:commands.delete = s:commands.abbrev.clone() -let s:commands.delete.options.delete = 1 - -" }}}1 -" Maps {{{1 - -function! s:unknown_coercion(letter,word) - return a:word -endfunction - -call extend(Abolish.Coercions, { - \ 'c': Abolish.camelcase, - \ 'm': Abolish.mixedcase, - \ 's': Abolish.snakecase, - \ '_': Abolish.snakecase, - \ 'u': Abolish.uppercase, - \ 'U': Abolish.uppercase, - \ '-': Abolish.dashcase, - \ 'k': Abolish.dashcase, - \ '.': Abolish.dotcase, - \ ' ': Abolish.spacecase, - \ 't': Abolish.titlecase, - \ "function missing": s:function("s:unknown_coercion") - \}, "keep") - -function! s:coerce(transformation) - let clipboard = &clipboard - try - set clipboard= - let regbody = getreg('"') - let regtype = getregtype('"') - let c = v:count1 - while c > 0 - let c -= 1 - norm! yiw - let word = @@ - let @@ = s:send(g:Abolish.Coercions,a:transformation,word) - if !exists('begin') - let begin = getpos("'[") - endif - if word !=# @@ - let changed = 1 - norm! viwpw - else - norm! w - endif - endwhile - call setreg('"',regbody,regtype) - call setpos("'[",begin) - call setpos(".",begin) - if exists("changed") - silent! call repeat#set("\Coerce".a:transformation) - endif - finally - let &clipboard = clipboard - endtry -endfunction - -nnoremap Coerce :call coerce(nr2char(getchar())) - -" }}}1 - -if !exists("g:abolish_no_mappings") || ! g:abolish_no_mappings - nmap cr Coerce -endif - -command! -nargs=+ -bang -bar -range=0 -complete=custom,s:Complete Abolish - \ :exec s:dispatcher(0,,,,[]) -command! -nargs=1 -bang -bar -range=0 -complete=custom,s:SubComplete Subvert - \ :exec s:subvert_dispatcher(0,,,,) -if exists(':S') != 2 - command -nargs=1 -bang -bar -range=0 -complete=custom,s:SubComplete S - \ :exec s:subvert_dispatcher(0,,,,) -endif - -" vim:set ft=vim sw=2 sts=2: diff --git a/vim/bundle/vim-coffee-script/.gitignore b/vim/bundle/vim-coffee-script/.gitignore deleted file mode 100644 index 1ff7b05..0000000 --- a/vim/bundle/vim-coffee-script/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -.*.sw[a-z] -.*.un~ -doc/tags - diff --git a/vim/bundle/vim-coffee-script/Copying.md b/vim/bundle/vim-coffee-script/Copying.md deleted file mode 100644 index 51cf8d1..0000000 --- a/vim/bundle/vim-coffee-script/Copying.md +++ /dev/null @@ -1,15 +0,0 @@ - DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE - Version 2, December 2004 - - Copyright (C) 2010 to 2012 Mick Koch - - Everyone is permitted to copy and distribute verbatim or modified - copies of this license document, and changing it is allowed as long - as the name is changed. - - DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. You just DO WHAT THE FUCK YOU WANT TO. - - diff --git a/vim/bundle/vim-coffee-script/Makefile b/vim/bundle/vim-coffee-script/Makefile deleted file mode 100644 index e6ef409..0000000 --- a/vim/bundle/vim-coffee-script/Makefile +++ /dev/null @@ -1,25 +0,0 @@ -REF = HEAD -VERSION = $(shell git describe --always $(REF)) - -ARCHIVE = vim-coffee-script-$(VERSION).zip -ARCHIVE_DIRS = after autoload compiler doc ftdetect ftplugin indent syntax - -# Don't do anything by default. -all: - -# Make vim.org zipball. -archive: - git archive $(REF) -o $(ARCHIVE) -- $(ARCHIVE_DIRS) - -# Remove zipball. -clean: - -rm -f $(ARCHIVE) - -# Build the list of syntaxes for @coffeeAll. -coffeeAll: - @grep -E 'syn (match|region)' syntax/coffee.vim |\ - grep -v 'contained' |\ - awk '{print $$3}' |\ - uniq - -.PHONY: all archive clean hash coffeeAll diff --git a/vim/bundle/vim-coffee-script/News.md b/vim/bundle/vim-coffee-script/News.md deleted file mode 100644 index 9706796..0000000 --- a/vim/bundle/vim-coffee-script/News.md +++ /dev/null @@ -1,18 +0,0 @@ -### Version 002 (December 5, 2011) - -Added binary numbers (0b0101) and fixed some bugs (#9, #62, #63, #65). - -### Version 001 (October 18, 2011) - -Removed deprecated `coffee_folding` option, added `coffee_compile_vert` option, -split out compiler, fixed indentation and syntax bugs, and added Haml support -and omnicompletion. - - - The coffee compiler is now a proper vim compiler that can be loaded with - `:compiler coffee`. - - The `coffee_compile_vert` option can now be set to split the CoffeeCompile - buffer vertically by default. - - CoffeeScript is now highlighted inside the `:coffeescript` filter in Haml. - - Omnicompletion (`:help compl-omni`) now uses JavaScript's dictionary to - complete words. - - We now have a fancy version number. diff --git a/vim/bundle/vim-coffee-script/Readme.md b/vim/bundle/vim-coffee-script/Readme.md deleted file mode 100644 index d557848..0000000 --- a/vim/bundle/vim-coffee-script/Readme.md +++ /dev/null @@ -1,599 +0,0 @@ -This project adds [CoffeeScript] support to vim. It covers syntax, indenting, -compiling, and more. - -![Screenshot](http://i.imgur.com/j1BhpZQ.png) - -[CoffeeScript]: http://coffeescript.org/ - -## Table of Contents - -- Installation - - [Requirements](#requirements) - - [Install using Pathogen](#install-using-pathogen) - - [Install using Vundle](#install-using-vundle) - - [Install from a Zip File](#install-from-a-zip-file) -- Coffee Commands - - [Compile to JavaScript](#compile-to-javascript) - - [Compile CoffeeScript Snippets](#coffeecompile-compile-coffeescript-snippets) - - [Live Preview Compiling](#coffeewatch-live-preview-compiling) - - [Run CoffeeScript Snippets](#coffeerun-run-coffeescript-snippets) - - [Lint your CoffeeScript](#coffeelint-lint-your-coffeescript) -- Extras - - [Literate CoffeeScript](#literate-coffeescript) - - [CoffeeScript in HTML](#coffeescript-in-html) - - [CoffeeScript in Haml](#coffeescript-in-haml) -- Configuration - - [Custom Autocmds](#custom-autocmds) - - [Configuration Variables](#configuration-variables) - - [Configure Syntax Highlighting](#configure-syntax-highlighting) - - [Tune Vim for CoffeeScript](#tune-vim-for-coffeescript) - -## Requirements - - - vim 7.4 or later - - coffee 1.2.0 or later - -## Install using Pathogen - -This project uses rolling releases based on git commits, so pathogen is a -natural fit for it. If you're already using pathogen, you can skip to step 4. - -1. Install [pathogen.vim] into `~/.vim/autoload/` (see [pathogen's - readme][install-pathogen] for more information.) - -[pathogen.vim]: http://www.vim.org/scripts/script.php?script_id=2332 -[install-pathogen]: https://github.com/tpope/vim-pathogen#installation - -2. Enable pathogen in your vimrc. Here's a bare-minimum vimrc that enables - all the features of `vim-coffee-script`: - - ```vim - call pathogen#infect() - syntax enable - filetype plugin indent on - ``` - - If you already have a vimrc built up, just make sure it contains these calls, - in this order. - -3. Create the directory `~/.vim/bundle/`: - - mkdir ~/.vim/bundle - -4. Clone the `vim-coffee-script` repo into `~/.vim/bundle/`: - - git clone https://github.com/kchmck/vim-coffee-script.git ~/.vim/bundle/vim-coffee-script/ - -Updating takes two steps: - -1. Change into `~/.vim/bundle/vim-coffee-script/`: - - cd ~/.vim/bundle/vim-coffee-script - -2. Pull in the latest changes: - - git pull - -## Install using Vundle - -1. [Install Vundle] into `~/.vim/bundle/`. - -[Install Vundle]: https://github.com/gmarik/vundle#quick-start - -2. Configure your vimrc for Vundle. Here's a bare-minimum vimrc that enables all - the features of `vim-coffee-script`: - - - ```vim - set nocompatible - filetype off - - set rtp+=~/.vim/bundle/vundle/ - call vundle#rc() - - Bundle 'kchmck/vim-coffee-script' - - syntax enable - filetype plugin indent on - ``` - - If you're adding Vundle to a built-up vimrc, just make sure all these calls - are in there and that they occur in this order. - -3. Open vim and run `:BundleInstall`. - -To update, open vim and run `:BundleInstall!` (notice the bang!) - -## Install from a Zip File - -1. Download the latest zip file from [vim.org][zip]. - -2. Extract the archive into `~/.vim/`: - - unzip -od ~/.vim/ ARCHIVE.zip - - This should create the files `~/.vim/autoload/coffee.vim`, - `~/.vim/compiler/coffee.vim`, etc. - -You can update the plugin using the same steps. - -[zip]: http://www.vim.org/scripts/script.php?script_id=3590 - -## Compile to JavaScript - -A `coffee` wrapper for use with `:make` is enabled automatically for coffee -files if no other compiler is loaded. To enable it manually, run - - :compiler coffee - -The `:make` command is then configured to use the `coffee` compiler and -recognize its errors. I've included a quick reference here but be sure to check -out [`:help :make`][make] for a full reference of the command. - - ![make](http://i.imgur.com/scUXmxR.png) - - ![make Result](http://i.imgur.com/eGIjEdn.png) - -[make]: http://vimdoc.sourceforge.net/htmldoc/quickfix.html#:make_makeprg - -Consider the full signature of a `:make` call as - - :[silent] make[!] [COFFEE-OPTIONS]... - -By default `:make` shows all compiler output and jumps to the first line -reported as an error. Compiler output can be hidden with a leading `:silent`: - - :silent make - -Line-jumping can be turned off by adding a bang: - - :make! - -`COFFEE-OPTIONS` given to `:make` are passed along to `coffee` (see also -[`coffee_make_options`](#coffee_make_options)): - - :make --bare --output /some/dir - -See the [full table of options](http://coffeescript.org/#usage) for a -list of all the options that `coffee` recognizes. - -*Configuration*: [`coffee_compiler`](#coffee_compiler), -[`coffee_make_options`](#coffee_make_options) - -#### The quickfix window - -Compiler errors are added to the [quickfix] list by `:make`, but the quickfix -window isn't automatically shown. The [`:cwindow`][cwindow] command will pop up -the quickfix window if there are any errors: - - :make - :cwindow - -This is usually the desired behavior, so you may want to add an autocmd to your -vimrc to do this automatically: - - autocmd QuickFixCmdPost * nested cwindow | redraw! - -The `redraw!` command is needed to fix a redrawing quirk in terminal vim, but -can removed for gVim. - -[quickfix]: http://vimdoc.sourceforge.net/htmldoc/quickfix.html#quickfix -[cwindow]: http://vimdoc.sourceforge.net/htmldoc/quickfix.html#:cwindow - -#### Recompile on write - -To recompile a file when it's written, add a `BufWritePost` autocmd to your -vimrc: - - autocmd BufWritePost *.coffee silent make! - -#### Cake and Cakefiles - -A `cake` compiler is also available with the call - - :compiler cake - -You can then use `:make` as above to run your Cakefile and capture any `coffee` -errors: - - :silent make build - -It runs within the current directory, so make sure you're in the directory of -your Cakefile before calling it. - -*Configuration*: [`coffee_cake`](#coffee_cake), -[`coffee_cake_options`](#coffee_cake_options) - -## CoffeeCompile: Compile CoffeeScript Snippets - -CoffeeCompile shows how the current file or a snippet of CoffeeScript is -compiled to JavaScript. - - :[RANGE] CoffeeCompile [vert[ical]] [WINDOW-SIZE] - -Calling `:CoffeeCompile` without a range compiles the whole file: - - ![CoffeeCompile](http://i.imgur.com/0zFG0l0.png) - - ![CoffeeCompile Result](http://i.imgur.com/bpiAxaa.png) - -Calling it with a range, like in visual mode, compiles only the selected snippet -of CoffeeScript: - - ![CoffeeCompile Snippet](http://i.imgur.com/x3OT3Ay.png) - - ![Compiled Snippet](http://i.imgur.com/J02j4T8.png) - -Each file gets its own CoffeeCompile buffer, and the same buffer is used for all -future calls of `:CoffeeCompile` on that file. It can be quickly closed by -hitting `q` in normal mode. - -Using `vert` opens the CoffeeCompile buffer vertically instead of horizontally -(see also [`coffee_compile_vert`](#coffee_compile_vert)): - - :CoffeeCompile vert - -By default the CoffeeCompile buffer splits the source buffer in half, but this -can be overridden by passing in a `WINDOW-SIZE`: - - :CoffeeCompile 4 - -*Configuration*: [`coffee_compiler`](#coffee_compiler`), -[`coffee_compile_vert`](#coffee_compile_vert) - -#### Quick syntax checking - -If compiling a snippet results in a compiler error, CoffeeCompile adds that -error to the [quickfix] list. - -[quickfix]: http://vimdoc.sourceforge.net/htmldoc/quickfix.html#quickfix - - ![Syntax Checking](http://i.imgur.com/RC8accF.png) - - ![Syntax Checking Result](http://i.imgur.com/gi1ON75.png) - -You can use this to quickly check the syntax of a snippet. - -## CoffeeWatch: Live Preview Compiling - -CoffeeWatch emulates using the Try CoffeeScript preview box on the [CoffeeScript -homepage][CoffeeScript]. - - ![CoffeeWatch](http://i.imgur.com/TRHdIMG.png) - - ![CoffeeWatch Result](http://i.imgur.com/rJbOeeS.png) - -CoffeeWatch takes the same options as CoffeeCompile: - - :CoffeeWatch [vert[ical]] [WINDOW-SIZE] - -After a source buffer is watched, leaving insert mode or saving the file fires -off a recompile of the CoffeeScript: - - ![Insert Mode](http://i.imgur.com/SBVcf4k.png) - - ![Recompile](http://i.imgur.com/pbPMog7.png) - -You can force recompilation by calling `:CoffeeWatch`. - -To get synchronized scrolling of the source buffer and CoffeeWatch buffer, set -[`'scrollbind'`](http://vimdoc.sourceforge.net/htmldoc/options.html#'scrollbind') -on each: - - :setl scrollbind - -*Configuration*: [`coffee_compiler`](#coffee_compiler), -[`coffee_watch_vert`](#coffee_watch_vert) - -## CoffeeRun: Run CoffeeScript Snippets - -CoffeeRun compiles the current file or selected snippet and runs the resulting -JavaScript. - - ![CoffeeRun](http://i.imgur.com/YSkHUuQ.png) - - ![CoffeeRun Output](http://i.imgur.com/wZQbggN.png) - -The command has two forms: - - :CoffeeRun [PROGRAM-OPTIONS]... - -This form applies when no `RANGE` is given or when the given range is `1,$` -(first line to last line). It allows passing `PROGRAM-OPTIONS` to your compiled -program. The filename is passed directly to `coffee` so you must save the file -for your changes to take effect. - - :RANGE CoffeeRun [COFFEE-OPTIONS]... - -This form applies with all other ranges. It compiles and runs the lines within -the given `RANGE` and any extra `COFFEE-OPTIONS` are passed to `coffee`. - -*Configuration*: [`coffee_compiler`](#coffee_compiler), -[`coffee_run_vert`](#coffee_run_vert) - -## CoffeeLint: Lint your CoffeeScript - -CoffeeLint runs [coffeelint](http://www.coffeelint.org/) (version 0.5.7 or later -required) on the current file and adds any issues to the [quickfix] list. - - ![CoffeeLint](http://i.imgur.com/UN8Nr5N.png) - - ![CoffeeLint Result](http://i.imgur.com/9hSIj3W.png) - - :[RANGE] CoffeeLint[!] [COFFEELINT-OPTIONS]... [ | cwindow] - -If a `RANGE` is given, only those lines are piped to `coffeelint`. Options given -in `COFFEELINT-OPTIONS` are passed to `coffeelint` (see also -[`coffee_lint_options`](#coffee_lint_options)): - - :CoffeeLint -f lint.json - -It behaves very similar to `:make`, described [above](#compile-to-javascript). - - :CoffeeLint! | cwindow - -*Configuration*: [`coffee_linter`](#coffee_linter), -[`coffee_lint_options`](#coffee_lint_options) - -## Literate CoffeeScript - -Literate CoffeeScript syntax and indent support is provided by -[vim-literate-coffeescript]. The `Coffee` commands detect when they're running -on a litcoffee file and pass the `--literate` flag to their respective tools, -but at this time the commands are not automatically loaded when a litcoffee file -is opened. - -[vim-literate-coffeescript]: https://github.com/mintplant/vim-literate-coffeescript - -To load them, run - - runtime ftplugin/coffee.vim - -while inside a litcoffee buffer. To do this automatically, add - - autocmd FileType litcoffee runtime ftplugin/coffee.vim - -to your vimrc. - -## CoffeeScript in HTML - -CoffeeScript is highlighted and indented within - -```html - -``` - -blocks in html files. - -## CoffeeScript in Haml - -CoffeeScript is highlighted within the `:coffeescript` filter in haml files: - -```haml -:coffeescript - console.log "hullo" -``` - -At this time, coffee indenting doesn't work in these blocks. - -## Custom Autocmds - -You can [define commands][autocmd-explain] to be ran automatically on these -custom events. - -In all cases, the name of the command running the event (`CoffeeCompile`, -`CoffeeWatch`, or `CoffeeRun`) is matched by the [`{pat}`][autocmd] argument. -You can match all commands with a `*` or only specific commands by separating -them with a comma: `CoffeeCompile,CoffeeWatch`. - -[autocmd-explain]: http://vimdoc.sourceforge.net/htmldoc/usr_40.html#40.3 -[autocmd]: http://vimdoc.sourceforge.net/htmldoc/autocmd.html#:autocmd - -#### CoffeeBufNew - -CoffeeBufNew is ran when a new scratch buffer is created. It's called from the -new buffer, so it can be used to do additional set up. - -```vim -augroup CoffeeBufNew - autocmd User * set wrap -augroup END -``` - -*Used By*: CoffeeCompile, CoffeeWatch, CoffeeRun - -#### CoffeeBufUpdate - -CoffeeBufUpdate is ran when a scratch buffer is updated with output from -`coffee`. It's called from the scratch buffer, so it can be used to alter the -compiled output. - -```vim -" Switch back to the source buffer after updating. -augroup CoffeeBufUpdate - autocmd User CoffeeCompile,CoffeeRun exec bufwinnr(b:coffee_src_buf) 'wincmd w' -augroup END -``` - -For example, to strip off the "Generated by" comment on the first line, put this -in your vimrc: - -```vim -function! s:RemoveGeneratedBy() - " If there was an error compiling, there's no comment to remove. - if v:shell_error - return - endif - - " Save cursor position. - let pos = getpos('.') - - " Remove first line. - set modifiable - 1 delete _ - set nomodifiable - - " Restore cursor position. - call setpos('.', pos) -endfunction - -augroup CoffeeBufUpdate - autocmd User CoffeeCompile,CoffeeWatch call s:RemoveGeneratedBy() -augroup END -``` - -*Used By*: CoffeeCompile, CoffeeWatch, CoffeeRun - -## Configuration Variables - -This is the full list of configuration variables available, with example -settings and default values. Use these in your vimrc to control the default -behavior. - -#### coffee\_indent\_keep\_current - -By default, the indent function matches the indent of the previous line if it -doesn't find a reason to indent or outdent. To change this behavior so it -instead keeps the [current indent of the cursor][98], use - - let coffee_indent_keep_current = 1 - -[98]: https://github.com/kchmck/vim-coffee-script/pull/98 - -*Default*: `unlet coffee_indent_keep_current` - -Note that if you change this after a coffee file has been loaded, you'll have to -reload the indent script for the change to take effect: - - unlet b:did_indent | runtime indent/coffee.vim - -#### coffee\_compiler - -Path to the `coffee` executable used by the `Coffee` commands: - - let coffee_compiler = '/usr/bin/coffee' - -*Default*: `'coffee'` (search `$PATH` for executable) - -#### coffee\_make\_options - -Options to pass to `coffee` with `:make`: - - let coffee_make_options = '--bare' - -*Default*: `''` (nothing) - -Note that `coffee_make_options` is embedded into `'makeprg'`, so `:compiler -coffee` must be ran after changing `coffee_make_options` for the changes to take -effect. - -#### coffee\_cake - -Path to the `cake` executable: - - let coffee_cake = '/opt/bin/cake' - -*Default*: `'cake'` (search `$PATH` for executable) - -#### coffee\_cake\_options - -Options to pass to `cake` with `:make`: - - let coffee_cake_options = 'build' - -*Default*: `''` (nothing) - -#### coffee\_linter - -Path to the `coffeelint` executable: - - let coffee_linter = '/opt/bin/coffeelint' - -*Default*: `'coffeelint'` (search `$PATH` for executable) - -#### coffee\_lint\_options - -Options to pass to `coffeelint`: - - let coffee_lint_options = '-f lint.json' - -*Default*: `''` (nothing) - -#### coffee\_compile\_vert - -Open the CoffeeCompile buffer with a vertical split instead of a horizontal -one: - - let coffee_compile_vert = 1 - -*Default*: `unlet coffee_compile_vert` - -#### coffee\_watch\_vert - -Open the CoffeeWatch buffer with a vertical split instead of a horizontal -one: - - let coffee_watch_vert = 1 - -*Default*: `unlet coffee_watch_vert` - -#### coffee\_run\_vert - -Open the CoffeeRun buffer with a vertical split instead of a horizontal -one: - - let coffee_run_vert = 1 - -*Default*: `unlet coffee_run_vert` - -## Configure Syntax Highlighting - -Add these lines to your vimrc to disable the relevant syntax group. - -#### Disable trailing whitespace error - -Trailing whitespace is highlighted as an error by default. This can be disabled -with: - - hi link coffeeSpaceError NONE - -#### Disable trailing semicolon error - -Trailing semicolons are considered an error (for help transitioning from -JavaScript.) This can be disabled with: - - hi link coffeeSemicolonError NONE - -#### Disable reserved words error - -Reserved words like `function` and `var` are highlighted as an error where -they're not allowed in CoffeeScript. This can be disabled with: - - hi link coffeeReservedError NONE - -## Tune Vim for CoffeeScript - -Changing these core settings can make vim more CoffeeScript friendly. - -#### Fold by indentation - -Folding by indentation works well for CoffeeScript functions and classes: - - ![Folding](http://i.imgur.com/gDgUBdO.png) - -To fold by indentation in CoffeeScript files, add this line to your vimrc: - - autocmd BufNewFile,BufReadPost *.coffee setl foldmethod=indent nofoldenable - -With this, folding is disabled by default but can be quickly toggled per-file -by hitting `zi`. To enable folding by default, remove `nofoldenable`: - - autocmd BufNewFile,BufReadPost *.coffee setl foldmethod=indent - -#### Two-space indentation - -To get standard two-space indentation in CoffeeScript files, add this line to -your vimrc: - - autocmd BufNewFile,BufReadPost *.coffee setl shiftwidth=2 expandtab diff --git a/vim/bundle/vim-coffee-script/Thanks.md b/vim/bundle/vim-coffee-script/Thanks.md deleted file mode 100644 index 8ddcf23..0000000 --- a/vim/bundle/vim-coffee-script/Thanks.md +++ /dev/null @@ -1,44 +0,0 @@ -Thanks to all bug reporters, and special thanks to those who have contributed -code: - - Brian Egan (brianegan): - Initial compiling support - - Ches Martin (ches): - Initial vim docs - - Chris Hoffman (cehoffman): - Add new keywoards from, to, and do - Highlight the - in negative integers - Add here regex highlighting, increase fold level for here docs - - David Wilhelm (bigfish): - CoffeeRun command - - Jay Adkisson (jayferd): - Support for eco templates - - Karl Guertin (grayrest) - Cakefiles are coffeescript - - Maciej Konieczny (narfdotpl): - Fix funny typo - - Matt Sacks (mattsa): - Javascript omni-completion - coffee_compile_vert option - - Nick Stenning (nickstenning): - Fold by indentation for coffeescript - - Simon Lipp (sloonz): - Trailing spaces are not error on lines containing only spaces - - Stéphan Kochen (stephank): - Initial HTML CoffeeScript highlighting - - Sven Felix Oberquelle (Svelix): - Haml CoffeeScript highlighting - - Wei Dai (clvv): - Fix the use of Vim built-in make command. diff --git a/vim/bundle/vim-coffee-script/Todo.md b/vim/bundle/vim-coffee-script/Todo.md deleted file mode 100644 index 3d4ffaa..0000000 --- a/vim/bundle/vim-coffee-script/Todo.md +++ /dev/null @@ -1 +0,0 @@ -- Don't highlight bad operator combinations diff --git a/vim/bundle/vim-coffee-script/after/indent/html.vim b/vim/bundle/vim-coffee-script/after/indent/html.vim deleted file mode 100644 index e637708..0000000 --- a/vim/bundle/vim-coffee-script/after/indent/html.vim +++ /dev/null @@ -1,33 +0,0 @@ -" Language: CoffeeScript -" Maintainer: Mick Koch -" URL: http://github.com/kchmck/vim-coffee-script -" License: WTFPL - -" Load the coffee and html indent functions. -silent! unlet b:did_indent -runtime indent/coffee.vim -let s:coffeeIndentExpr = &l:indentexpr - -" Load html last so it can overwrite coffee settings. -silent! unlet b:did_indent -runtime indent/html.vim -let s:htmlIndentExpr = &l:indentexpr - -" Inject our wrapper indent function. -setlocal indentexpr=GetCoffeeHtmlIndent(v:lnum) - -function! GetCoffeeHtmlIndent(curlinenum) - " See if we're inside a coffeescript block. - let scriptlnum = searchpair('', 'bWn') - let prevlnum = prevnonblank(a:curlinenum) - - " If we're in the script block and the previous line isn't the script tag - " itself, use coffee indenting. - if scriptlnum && scriptlnum != prevlnum - exec 'return ' s:coffeeIndentExpr - endif - - " Otherwise use html indenting. - exec 'return ' s:htmlIndentExpr -endfunction diff --git a/vim/bundle/vim-coffee-script/after/syntax/haml.vim b/vim/bundle/vim-coffee-script/after/syntax/haml.vim deleted file mode 100644 index 4c517eb..0000000 --- a/vim/bundle/vim-coffee-script/after/syntax/haml.vim +++ /dev/null @@ -1,13 +0,0 @@ -" Language: CoffeeScript -" Maintainer: Sven Felix Oberquelle -" URL: http://github.com/kchmck/vim-coffee-script -" License: WTFPL - -" Inherit coffee from html so coffeeComment isn't redefined and given higher -" priority than hamlInterpolation. -syn cluster hamlCoffeescript contains=@htmlCoffeeScript -syn region hamlCoffeescriptFilter matchgroup=hamlFilter -\ start="^\z(\s*\):coffee\z(script\)\?\s*$" -\ end="^\%(\z1 \| *$\)\@!" -\ contains=@hamlCoffeeScript,hamlInterpolation -\ keepend diff --git a/vim/bundle/vim-coffee-script/after/syntax/html.vim b/vim/bundle/vim-coffee-script/after/syntax/html.vim deleted file mode 100644 index 9e2eb3a..0000000 --- a/vim/bundle/vim-coffee-script/after/syntax/html.vim +++ /dev/null @@ -1,11 +0,0 @@ -" Language: CoffeeScript -" Maintainer: Mick Koch -" URL: http://github.com/kchmck/vim-coffee-script -" License: WTFPL - -" Syntax highlighting for text/coffeescript script tags -syn include @htmlCoffeeScript syntax/coffee.vim -syn region coffeeScript start=##me=s-1 keepend -\ contains=@htmlCoffeeScript,htmlScriptTag,@htmlPreproc -\ containedin=htmlHead diff --git a/vim/bundle/vim-coffee-script/autoload/coffee.vim b/vim/bundle/vim-coffee-script/autoload/coffee.vim deleted file mode 100644 index 04d5efb..0000000 --- a/vim/bundle/vim-coffee-script/autoload/coffee.vim +++ /dev/null @@ -1,54 +0,0 @@ -" Language: CoffeeScript -" Maintainer: Mick Koch -" URL: http://github.com/kchmck/vim-coffee-script -" License: WTFPL - -" Set up some common global/buffer variables. -function! coffee#CoffeeSetUpVariables() - " Path to coffee executable - if !exists('g:coffee_compiler') - let g:coffee_compiler = 'coffee' - endif - - " Options passed to coffee with make - if !exists('g:coffee_make_options') - let g:coffee_make_options = '' - endif - - " Path to cake executable - if !exists('g:coffee_cake') - let g:coffee_cake = 'cake' - endif - - " Extra options passed to cake - if !exists('g:coffee_cake_options') - let g:coffee_cake_options = '' - endif - - " Path to coffeelint executable - if !exists('g:coffee_linter') - let g:coffee_linter = 'coffeelint' - endif - - " Options passed to CoffeeLint - if !exists('g:coffee_lint_options') - let g:coffee_lint_options = '' - endif - - " Pass the litcoffee flag to tools in this buffer if a litcoffee file is open. - " Let the variable be overwritten so it can be updated if a different filetype - " is set. - if &filetype == 'litcoffee' - let b:coffee_litcoffee = '--literate' - else - let b:coffee_litcoffee = '' - endif -endfunction - -function! coffee#CoffeeSetUpErrorFormat() - CompilerSet errorformat=Error:\ In\ %f\\,\ %m\ on\ line\ %l, - \Error:\ In\ %f\\,\ Parse\ error\ on\ line\ %l:\ %m, - \SyntaxError:\ In\ %f\\,\ %m, - \%f:%l:%c:\ error:\ %m, - \%-G%.%# -endfunction diff --git a/vim/bundle/vim-coffee-script/compiler/cake.vim b/vim/bundle/vim-coffee-script/compiler/cake.vim deleted file mode 100644 index 0a3c703..0000000 --- a/vim/bundle/vim-coffee-script/compiler/cake.vim +++ /dev/null @@ -1,15 +0,0 @@ -" Language: CoffeeScript -" Maintainer: Mick Koch -" URL: http://github.com/kchmck/vim-coffee-script -" License: WTFPL - -if exists('current_compiler') - finish -endif - -let current_compiler = 'cake' -call coffee#CoffeeSetUpVariables() - -exec 'CompilerSet makeprg=' . escape(g:coffee_cake . ' ' . -\ g:coffee_cake_options . ' $*', ' ') -call coffee#CoffeeSetUpErrorFormat() diff --git a/vim/bundle/vim-coffee-script/compiler/coffee.vim b/vim/bundle/vim-coffee-script/compiler/coffee.vim deleted file mode 100644 index a70fa64..0000000 --- a/vim/bundle/vim-coffee-script/compiler/coffee.vim +++ /dev/null @@ -1,82 +0,0 @@ -" Language: CoffeeScript -" Maintainer: Mick Koch -" URL: http://github.com/kchmck/vim-coffee-script -" License: WTFPL - -" All this is needed to support compiling filenames with spaces, quotes, and -" such. The filename is escaped and embedded into the `makeprg` setting. -" -" Because of this, `makeprg` must be updated on every file rename. And because -" of that, `CompilerSet` can't be used because it doesn't exist when the -" rename autocmd is ran. So, we have to do some checks to see whether `compiler` -" was called locally or globally, and respect that in the rest of the script. - -if exists('current_compiler') - finish -endif - -let current_compiler = 'coffee' -call coffee#CoffeeSetUpVariables() - -" Pattern to check if coffee is the compiler -let s:pat = '^' . current_compiler - -" Get a `makeprg` for the current filename. -function! s:GetMakePrg() - return g:coffee_compiler . - \ ' -c' . - \ ' ' . b:coffee_litcoffee . - \ ' ' . g:coffee_make_options . - \ ' $*' . - \ ' ' . fnameescape(expand('%')) -endfunction - -" Set `makeprg` and return 1 if coffee is still the compiler, else return 0. -function! s:SetMakePrg() - if &l:makeprg =~ s:pat - let &l:makeprg = s:GetMakePrg() - elseif &g:makeprg =~ s:pat - let &g:makeprg = s:GetMakePrg() - else - return 0 - endif - - return 1 -endfunction - -" Set a dummy compiler so we can check whether to set locally or globally. -exec 'CompilerSet makeprg=' . current_compiler -" Then actually set the compiler. -call s:SetMakePrg() -call coffee#CoffeeSetUpErrorFormat() - -function! s:CoffeeMakeDeprecated(bang, args) - echoerr 'CoffeeMake is deprecated! Please use :make instead, its behavior ' . - \ 'is identical.' - sleep 5 - exec 'make' . a:bang a:args -endfunction - -" Compile the current file. -command! -bang -bar -nargs=* CoffeeMake -\ call s:CoffeeMakeDeprecated(, ) - -" Set `makeprg` on rename since we embed the filename in the setting. -augroup CoffeeUpdateMakePrg - autocmd! - - " Update `makeprg` if coffee is still the compiler, else stop running this - " function. - function! s:UpdateMakePrg() - if !s:SetMakePrg() - autocmd! CoffeeUpdateMakePrg - endif - endfunction - - " Set autocmd locally if compiler was set locally. - if &l:makeprg =~ s:pat - autocmd BufFilePost,BufWritePost call s:UpdateMakePrg() - else - autocmd BufFilePost,BufWritePost call s:UpdateMakePrg() - endif -augroup END diff --git a/vim/bundle/vim-coffee-script/doc/coffee-script.txt b/vim/bundle/vim-coffee-script/doc/coffee-script.txt deleted file mode 100644 index 1b43cf3..0000000 --- a/vim/bundle/vim-coffee-script/doc/coffee-script.txt +++ /dev/null @@ -1,4 +0,0 @@ -Please see the project readme for up-to-date docs: -https://github.com/kchmck/vim-coffee-script - - vim:tw=78:ts=8:ft=help:norl: diff --git a/vim/bundle/vim-coffee-script/ftdetect/coffee.vim b/vim/bundle/vim-coffee-script/ftdetect/coffee.vim deleted file mode 100644 index 5056929..0000000 --- a/vim/bundle/vim-coffee-script/ftdetect/coffee.vim +++ /dev/null @@ -1,17 +0,0 @@ -" Language: CoffeeScript -" Maintainer: Mick Koch -" URL: http://github.com/kchmck/vim-coffee-script -" License: WTFPL - -autocmd BufNewFile,BufRead *.coffee set filetype=coffee -autocmd BufNewFile,BufRead *Cakefile set filetype=coffee -autocmd BufNewFile,BufRead *.coffeekup,*.ck set filetype=coffee -autocmd BufNewFile,BufRead *._coffee set filetype=coffee - -function! s:DetectCoffee() - if getline(1) =~ '^#!.*\' - set filetype=coffee - endif -endfunction - -autocmd BufNewFile,BufRead * call s:DetectCoffee() diff --git a/vim/bundle/vim-coffee-script/ftplugin/coffee.vim b/vim/bundle/vim-coffee-script/ftplugin/coffee.vim deleted file mode 100644 index c44fe97..0000000 --- a/vim/bundle/vim-coffee-script/ftplugin/coffee.vim +++ /dev/null @@ -1,404 +0,0 @@ -" Language: CoffeeScript -" Maintainer: Mick Koch -" URL: http://github.com/kchmck/vim-coffee-script -" License: WTFPL - -if exists('b:did_ftplugin') - finish -endif - -let b:did_ftplugin = 1 -call coffee#CoffeeSetUpVariables() - -setlocal formatoptions-=t formatoptions+=croql -setlocal comments=:# commentstring=#\ %s -setlocal omnifunc=javascriptcomplete#CompleteJS - -" Create custom augroups. -augroup CoffeeBufUpdate | augroup END -augroup CoffeeBufNew | augroup END - -" Enable coffee compiler if a compiler isn't set already. -if !len(&l:makeprg) - compiler coffee -endif - -" Switch to the window for buf. -function! s:SwitchWindow(buf) - exec bufwinnr(a:buf) 'wincmd w' -endfunction - -" Create a new scratch buffer and return the bufnr of it. After the function -" returns, vim remains in the scratch buffer so more set up can be done. -function! s:ScratchBufBuild(src, vert, size) - if a:size <= 0 - if a:vert - let size = winwidth(bufwinnr(a:src)) / 2 - else - let size = winheight(bufwinnr(a:src)) / 2 - endif - endif - - if a:vert - vertical belowright new - exec 'vertical resize' size - else - belowright new - exec 'resize' size - endif - - setlocal bufhidden=wipe buftype=nofile nobuflisted noswapfile nomodifiable - nnoremap q :hide - - return bufnr('%') -endfunction - -" Replace buffer contents with text and delete the last empty line. -function! s:ScratchBufUpdate(buf, text) - " Move to the scratch buffer. - call s:SwitchWindow(a:buf) - - " Double check we're in the scratch buffer before overwriting. - if bufnr('%') != a:buf - throw 'unable to change to scratch buffer' - endif - - setlocal modifiable - silent exec '% delete _' - silent put! =a:text - silent exec '$ delete _' - setlocal nomodifiable -endfunction - -" Parse the output of coffee into a qflist entry for src buffer. -function! s:ParseCoffeeError(output, src, startline) - " Coffee error is always on first line? - let match = matchlist(a:output, - \ '^\(\f\+\|\[stdin\]\):\(\d\):\(\d\): error: \(.\{-}\)' . "\n") - - if !len(match) - return - endif - - " Consider the line number from coffee as relative and add it to the beginning - " line number of the range the command was called on, then subtract one for - " zero-based relativity. - call setqflist([{'bufnr': a:src, 'lnum': a:startline + str2nr(match[2]) - 1, - \ 'type': 'E', 'col': str2nr(match[3]), 'text': match[4]}], 'r') -endfunction - -" Reset source buffer variables. -function! s:CoffeeCompileResetVars() - " Variables defined in source buffer: - " b:coffee_compile_buf: bufnr of output buffer - " Variables defined in output buffer: - " b:coffee_src_buf: bufnr of source buffer - " b:coffee_compile_pos: previous cursor position in output buffer - - let b:coffee_compile_buf = -1 -endfunction - -function! s:CoffeeWatchResetVars() - " Variables defined in source buffer: - " b:coffee_watch_buf: bufnr of output buffer - " Variables defined in output buffer: - " b:coffee_src_buf: bufnr of source buffer - " b:coffee_watch_pos: previous cursor position in output buffer - - let b:coffee_watch_buf = -1 -endfunction - -function! s:CoffeeRunResetVars() - " Variables defined in CoffeeRun source buffer: - " b:coffee_run_buf: bufnr of output buffer - " Variables defined in CoffeeRun output buffer: - " b:coffee_src_buf: bufnr of source buffer - " b:coffee_run_pos: previous cursor position in output buffer - - let b:coffee_run_buf = -1 -endfunction - -" Clean things up in the source buffers. -function! s:CoffeeCompileClose() - " Switch to the source buffer if not already in it. - silent! call s:SwitchWindow(b:coffee_src_buf) - call s:CoffeeCompileResetVars() -endfunction - -function! s:CoffeeWatchClose() - silent! call s:SwitchWindow(b:coffee_src_buf) - silent! autocmd! CoffeeAuWatch * - call s:CoffeeWatchResetVars() -endfunction - -function! s:CoffeeRunClose() - silent! call s:SwitchWindow(b:coffee_src_buf) - call s:CoffeeRunResetVars() -endfunction - -" Compile the lines between startline and endline and put the result into buf. -function! s:CoffeeCompileToBuf(buf, startline, endline) - let src = bufnr('%') - let input = join(getline(a:startline, a:endline), "\n") - - " Coffee doesn't like empty input. - if !len(input) - " Function should still return within output buffer. - call s:SwitchWindow(a:buf) - return - endif - - " Pipe lines into coffee. - let output = system(g:coffee_compiler . - \ ' -scb' . - \ ' ' . b:coffee_litcoffee . - \ ' 2>&1', input) - - " Paste output into output buffer. - call s:ScratchBufUpdate(a:buf, output) - - " Highlight as JavaScript if there were no compile errors. - if v:shell_error - call s:ParseCoffeeError(output, src, a:startline) - setlocal filetype= - else - " Clear the quickfix list. - call setqflist([], 'r') - setlocal filetype=javascript - endif -endfunction - -" Peek at compiled CoffeeScript in a scratch buffer. We handle ranges like this -" to prevent the cursor from being moved (and its position saved) before the -" function is called. -function! s:CoffeeCompile(startline, endline, args) - if a:args =~ '\' - echoerr 'CoffeeCompile watch is deprecated! Please use CoffeeWatch instead' - sleep 5 - call s:CoffeeWatch(a:args) - return - endif - - " Switch to the source buffer if not already in it. - silent! call s:SwitchWindow(b:coffee_src_buf) - - " Bail if not in source buffer. - if !exists('b:coffee_compile_buf') - return - endif - - " Build the output buffer if it doesn't exist. - if bufwinnr(b:coffee_compile_buf) == -1 - let src = bufnr('%') - - let vert = exists('g:coffee_compile_vert') || a:args =~ '\' - let size = str2nr(matchstr(a:args, '\<\d\+\>')) - - " Build the output buffer and save the source bufnr. - let buf = s:ScratchBufBuild(src, vert, size) - let b:coffee_src_buf = src - - " Set the buffer name. - exec 'silent! file [CoffeeCompile ' . src . ']' - - " Clean up the source buffer when the output buffer is closed. - autocmd BufWipeout call s:CoffeeCompileClose() - " Save the cursor when leaving the output buffer. - autocmd BufLeave let b:coffee_compile_pos = getpos('.') - - " Run user-defined commands on new buffer. - silent doautocmd CoffeeBufNew User CoffeeCompile - - " Switch back to the source buffer and save the output bufnr. This also - " triggers BufLeave above. - call s:SwitchWindow(src) - let b:coffee_compile_buf = buf - endif - - " Fill the scratch buffer. - call s:CoffeeCompileToBuf(b:coffee_compile_buf, a:startline, a:endline) - " Reset cursor to previous position. - call setpos('.', b:coffee_compile_pos) - - " Run any user-defined commands on the scratch buffer. - silent doautocmd CoffeeBufUpdate User CoffeeCompile -endfunction - -" Update the scratch buffer and switch back to the source buffer. -function! s:CoffeeWatchUpdate() - call s:CoffeeCompileToBuf(b:coffee_watch_buf, 1, '$') - call setpos('.', b:coffee_watch_pos) - silent doautocmd CoffeeBufUpdate User CoffeeWatch - call s:SwitchWindow(b:coffee_src_buf) -endfunction - -" Continually compile a source buffer. -function! s:CoffeeWatch(args) - silent! call s:SwitchWindow(b:coffee_src_buf) - - if !exists('b:coffee_watch_buf') - return - endif - - if bufwinnr(b:coffee_watch_buf) == -1 - let src = bufnr('%') - - let vert = exists('g:coffee_watch_vert') || a:args =~ '\' - let size = str2nr(matchstr(a:args, '\<\d\+\>')) - - let buf = s:ScratchBufBuild(src, vert, size) - let b:coffee_src_buf = src - - exec 'silent! file [CoffeeWatch ' . src . ']' - - autocmd BufWipeout call s:CoffeeWatchClose() - autocmd BufLeave let b:coffee_watch_pos = getpos('.') - - silent doautocmd CoffeeBufNew User CoffeeWatch - - call s:SwitchWindow(src) - let b:coffee_watch_buf = buf - endif - - " Make sure only one watch autocmd is defined on this buffer. - silent! autocmd! CoffeeAuWatch * - - augroup CoffeeAuWatch - autocmd InsertLeave call s:CoffeeWatchUpdate() - autocmd BufWritePost call s:CoffeeWatchUpdate() - augroup END - - call s:CoffeeWatchUpdate() -endfunction - -" Run a snippet of CoffeeScript between startline and endline. -function! s:CoffeeRun(startline, endline, args) - silent! call s:SwitchWindow(b:coffee_src_buf) - - if !exists('b:coffee_run_buf') - return - endif - - if bufwinnr(b:coffee_run_buf) == -1 - let src = bufnr('%') - - let buf = s:ScratchBufBuild(src, exists('g:coffee_run_vert'), 0) - let b:coffee_src_buf = src - - exec 'silent! file [CoffeeRun ' . src . ']' - - autocmd BufWipeout call s:CoffeeRunClose() - autocmd BufLeave let b:coffee_run_pos = getpos('.') - - silent doautocmd CoffeeBufNew User CoffeeRun - - call s:SwitchWindow(src) - let b:coffee_run_buf = buf - endif - - if a:startline == 1 && a:endline == line('$') - let output = system(g:coffee_compiler . - \ ' ' . b:coffee_litcoffee . - \ ' ' . fnameescape(expand('%')) . - \ ' ' . a:args) - else - let input = join(getline(a:startline, a:endline), "\n") - - if !len(input) - return - endif - - let output = system(g:coffee_compiler . - \ ' -s' . - \ ' ' . b:coffee_litcoffee . - \ ' ' . a:args, input) - endif - - call s:ScratchBufUpdate(b:coffee_run_buf, output) - call setpos('.', b:coffee_run_pos) - - silent doautocmd CoffeeBufUpdate User CoffeeRun -endfunction - -" Run coffeelint on a file, and add any errors between startline and endline -" to the quickfix list. -function! s:CoffeeLint(startline, endline, bang, args) - let input = join(getline(a:startline, a:endline), "\n") - - if !len(input) - return - endif - - let output = system(g:coffee_linter . - \ ' -s --csv' . - \ ' ' . b:coffee_litcoffee . - \ ' ' . g:coffee_lint_options . - \ ' ' . a:args . - \ ' 2>&1', input) - - " Convert output into an array and strip off the csv header. - let lines = split(output, "\n")[1:] - let buf = bufnr('%') - let qflist = [] - - for line in lines - let match = matchlist(line, '^stdin,\(\d\+\),\d*,\(error\|warn\),\(.\+\)$') - - " Ignore unmatched lines. - if !len(match) - continue - endif - - " The 'type' will result in either 'E' or 'W'. - call add(qflist, {'bufnr': buf, 'lnum': a:startline + str2nr(match[1]) - 1, - \ 'type': toupper(match[2][0]), 'text': match[3]}) - endfor - - " Replace the quicklist with our items. - call setqflist(qflist, 'r') - - " If not given a bang, jump to first error. - if !len(a:bang) - silent! cc 1 - endif -endfunction - -" Complete arguments for Coffee* commands. -function! s:CoffeeComplete(cmd, cmdline, cursor) - let args = ['vertical'] - - " If no partial command, return all possibilities. - if !len(a:cmd) - return args - endif - - let pat = '^' . a:cmd - - for arg in args - if arg =~ pat - return [arg] - endif - endfor -endfunction - -" Set initial state variables if they don't exist -if !exists('b:coffee_compile_buf') - call s:CoffeeCompileResetVars() -endif - -if !exists('b:coffee_watch_buf') - call s:CoffeeWatchResetVars() -endif - -if !exists('b:coffee_run_buf') - call s:CoffeeRunResetVars() -endif - -command! -range=% -bar -nargs=* -complete=customlist,s:CoffeeComplete -\ CoffeeCompile call s:CoffeeCompile(, , ) -command! -bar -nargs=* -complete=customlist,s:CoffeeComplete -\ CoffeeWatch call s:CoffeeWatch() -command! -range=% -bar -nargs=* CoffeeRun -\ call s:CoffeeRun(, , ) -command! -range=% -bang -bar -nargs=* CoffeeLint -\ call s:CoffeeLint(, , , ) diff --git a/vim/bundle/vim-coffee-script/ftplugin/coffee/folding.vim b/vim/bundle/vim-coffee-script/ftplugin/coffee/folding.vim deleted file mode 100644 index d450ddd..0000000 --- a/vim/bundle/vim-coffee-script/ftplugin/coffee/folding.vim +++ /dev/null @@ -1,39 +0,0 @@ -setlocal foldmethod=expr -setlocal foldexpr=GetCoffeeFold(v:lnum) - -function! s:NextNonBlankLine(lnum) - let numlines = line('$') - let current = a:lnum + 1 - - while current <= numlines - if getline(current) =~? '\v\S' - return current - endif - - let current += 1 - endwhile - - return -2 -endfunction - -function! s:IndentLevel(lnum) - return indent(a:lnum) / &shiftwidth -endfunction - -function! GetCoffeeFold(lnum) - if getline(a:lnum) =~? '\v^\s*$' - return '-1' - endif - - let this_indent = s:IndentLevel(a:lnum) - let next_indent = s:IndentLevel(s:NextNonBlankLine(a:lnum)) - - if next_indent == this_indent - return this_indent - elseif next_indent < this_indent - return this_indent - elseif next_indent > this_indent - return '>' . next_indent - endif -endfunction - diff --git a/vim/bundle/vim-coffee-script/indent/coffee.vim b/vim/bundle/vim-coffee-script/indent/coffee.vim deleted file mode 100644 index 7bd82e3..0000000 --- a/vim/bundle/vim-coffee-script/indent/coffee.vim +++ /dev/null @@ -1,428 +0,0 @@ -" Language: CoffeeScript -" Maintainer: Mick Koch -" URL: http://github.com/kchmck/vim-coffee-script -" License: WTFPL - -if exists('b:did_indent') - finish -endif - -let b:did_indent = 1 - -setlocal autoindent -setlocal indentexpr=GetCoffeeIndent(v:lnum) -" Make sure GetCoffeeIndent is run when these are typed so they can be -" indented or outdented. -setlocal indentkeys+=0],0),0.,=else,=when,=catch,=finally - -" If no indenting or outdenting is needed, either keep the indent of the cursor -" (use autoindent) or match the indent of the previous line. -if exists('g:coffee_indent_keep_current') - let s:DEFAULT_LEVEL = '-1' -else - let s:DEFAULT_LEVEL = 'indent(prevnlnum)' -endif - -" Only define the function once. -if exists('*GetCoffeeIndent') - finish -endif - -" Keywords that begin a block -let s:BEGIN_BLOCK_KEYWORD = '\C^\%(if\|unless\|else\|for\|while\|until\|' -\ . 'loop\|switch\|when\|try\|catch\|finally\|' -\ . 'class\)\>\%(\s*:\)\@!' - -" An expression that uses the result of a statement -let s:COMPOUND_EXPRESSION = '\C\%([^-]-\|[^+]+\|[^/]/\|[:=*%&|^<>]\)\s*' -\ . '\%(if\|unless\|for\|while\|until\|loop\|switch\|' -\ . 'try\|class\)\>' - -" Combine the two above -let s:BEGIN_BLOCK = s:BEGIN_BLOCK_KEYWORD . '\|' . s:COMPOUND_EXPRESSION - -" Operators that begin a block but also count as a continuation -let s:BEGIN_BLOCK_OP = '[([{:=]$' - -" Begins a function block -let s:FUNCTION = '[-=]>$' - -" Operators that continue a line onto the next line -let s:CONTINUATION_OP = '\C\%(\<\%(is\|isnt\|and\|or\)\>\|' -\ . '[^-]-\|[^+]+\|[^-=]>\|[^.]\.\|[<*/%&|^,]\)$' - -" Ancestor operators that prevent continuation indenting -let s:CONTINUATION = s:CONTINUATION_OP . '\|' . s:BEGIN_BLOCK_OP - -" A closing bracket by itself on a line followed by a continuation -let s:BRACKET_CONTINUATION = '^\s*[}\])]\s*' . s:CONTINUATION_OP - -" A continuation dot access -let s:DOT_ACCESS = '^\.' - -" Keywords that break out of a block -let s:BREAK_BLOCK_OP = '\C^\%(return\|break\|continue\|throw\)\>' - -" A condition attached to the end of a statement -let s:POSTFIX_CONDITION = '\C\S\s\+\zs\<\%(if\|unless\|when\|while\|until\)\>' - -" A then contained in brackets -let s:CONTAINED_THEN = '\C[(\[].\{-}\.\{-\}[)\]]' - -" An else with a condition attached -let s:ELSE_COND = '\C^\s*else\s\+\<\%(if\|unless\)\>' - -" A single-line else statement (without a condition attached) -let s:SINGLE_LINE_ELSE = '\C^else\s\+\%(\<\%(if\|unless\)\>\)\@!' - -" Pairs of starting and ending keywords, with an initial pattern to match -let s:KEYWORD_PAIRS = [ -\ ['\C^else\>', '\C\<\%(if\|unless\|when\|else\s\+\%(if\|unless\)\)\>', -\ '\C\'], -\ ['\C^catch\>', '\C\', '\C\'], -\ ['\C^finally\>', '\C\', '\C\'] -\] - -" Pairs of starting and ending brackets -let s:BRACKET_PAIRS = {']': '\[', '}': '{', ')': '('} - -" Max lines to look back for a match -let s:MAX_LOOKBACK = 50 - -" Syntax names for strings -let s:SYNTAX_STRING = 'coffee\%(String\|AssignString\|Embed\|Regex\|Heregex\|' -\ . 'Heredoc\)' - -" Syntax names for comments -let s:SYNTAX_COMMENT = 'coffee\%(Comment\|BlockComment\|HeregexComment\)' - -" Syntax names for strings and comments -let s:SYNTAX_STRING_COMMENT = s:SYNTAX_STRING . '\|' . s:SYNTAX_COMMENT - -" Compatibility code for shiftwidth() as recommended by the docs, but modified -" so there isn't as much of a penalty if shiftwidth() exists. -if exists('*shiftwidth') - let s:ShiftWidth = function('shiftwidth') -else - function! s:ShiftWidth() - return &shiftwidth - endfunction -endif - -" Get the linked syntax name of a character. -function! s:SyntaxName(lnum, col) - return synIDattr(synID(a:lnum, a:col, 1), 'name') -endfunction - -" Check if a character is in a comment. -function! s:IsComment(lnum, col) - return s:SyntaxName(a:lnum, a:col) =~ s:SYNTAX_COMMENT -endfunction - -" Check if a character is in a string. -function! s:IsString(lnum, col) - return s:SyntaxName(a:lnum, a:col) =~ s:SYNTAX_STRING -endfunction - -" Check if a character is in a comment or string. -function! s:IsCommentOrString(lnum, col) - return s:SyntaxName(a:lnum, a:col) =~ s:SYNTAX_STRING_COMMENT -endfunction - -" Search a line for a regex until one is found outside a string or comment. -function! s:SearchCode(lnum, regex) - " Start at the first column and look for an initial match (including at the - " cursor.) - call cursor(a:lnum, 1) - let pos = search(a:regex, 'c', a:lnum) - - while pos - if !s:IsCommentOrString(a:lnum, col('.')) - return 1 - endif - - " Move to the match and continue searching (don't accept matches at the - " cursor.) - let pos = search(a:regex, '', a:lnum) - endwhile - - return 0 -endfunction - -" Search for the nearest previous line that isn't a comment. -function! s:GetPrevNormalLine(startlnum) - let curlnum = a:startlnum - - while curlnum - let curlnum = prevnonblank(curlnum - 1) - - " Return the line if the first non-whitespace character isn't a comment. - if !s:IsComment(curlnum, indent(curlnum) + 1) - return curlnum - endif - endwhile - - return 0 -endfunction - -function! s:SearchPair(startlnum, lookback, skip, open, close) - " Go to the first column so a:close will be matched even if it's at the - " beginning of the line. - call cursor(a:startlnum, 1) - return searchpair(a:open, '', a:close, 'bnW', a:skip, max([1, a:lookback])) -endfunction - -" Skip if a match -" - is in a string or comment -" - is a single-line statement that isn't immediately -" adjacent -" - has a postfix condition and isn't an else statement or compound -" expression -function! s:ShouldSkip(startlnum, lnum, col) - return s:IsCommentOrString(a:lnum, a:col) || - \ s:SearchCode(a:lnum, '\C\') && a:startlnum - a:lnum > 1 || - \ s:SearchCode(a:lnum, s:POSTFIX_CONDITION) && - \ getline(a:lnum) !~ s:ELSE_COND && - \ !s:SearchCode(a:lnum, s:COMPOUND_EXPRESSION) -endfunction - -" Search for the nearest and farthest match for a keyword pair. -function! s:SearchMatchingKeyword(startlnum, open, close) - let skip = 's:ShouldSkip(' . a:startlnum . ", line('.'), line('.'))" - - " Search for the nearest match. - let nearestlnum = s:SearchPair(a:startlnum, a:startlnum - s:MAX_LOOKBACK, - \ skip, a:open, a:close) - - if !nearestlnum - return [] - endif - - " Find the nearest previous line with indent less than or equal to startlnum. - let ind = indent(a:startlnum) - let lookback = s:GetPrevNormalLine(a:startlnum) - - while lookback && indent(lookback) > ind - let lookback = s:GetPrevNormalLine(lookback) - endwhile - - " Search for the farthest match. If there are no other matches, then the - " nearest match is also the farthest one. - let matchlnum = nearestlnum - - while matchlnum - let lnum = matchlnum - let matchlnum = s:SearchPair(matchlnum, lookback, skip, a:open, a:close) - endwhile - - return [nearestlnum, lnum] -endfunction - -" Strip a line of a trailing comment and surrounding whitespace. -function! s:GetTrimmedLine(lnum) - " Try to find a comment starting at the first column. - call cursor(a:lnum, 1) - let pos = search('#', 'c', a:lnum) - - " Keep searching until a comment is found or search returns 0. - while pos - if s:IsComment(a:lnum, col('.')) - break - endif - - let pos = search('#', '', a:lnum) - endwhile - - if !pos - " No comment was found so use the whole line. - let line = getline(a:lnum) - else - " Subtract 1 to get to the column before the comment and another 1 for - " column indexing -> zero-based indexing. - let line = getline(a:lnum)[:col('.') - 2] - endif - - return substitute(substitute(line, '^\s\+', '', ''), - \ '\s\+$', '', '') -endfunction - -" Get the indent policy when no special rules are used. -function! s:GetDefaultPolicy(curlnum) - " Check whether equalprg is being ran on existing lines. - if strlen(getline(a:curlnum)) == indent(a:curlnum) - " If not indenting an existing line, use the default policy. - return s:DEFAULT_LEVEL - else - " Otherwise let autoindent determine what to do with an existing line. - return '-1' - endif -endfunction - -function! GetCoffeeIndent(curlnum) - " Get the previous non-blank line (may be a comment.) - let prevlnum = prevnonblank(a:curlnum - 1) - - " Bail if there's no code before. - if !prevlnum - return -1 - endif - - " Bail if inside a multiline string. - if s:IsString(a:curlnum, 1) - let prevnlnum = prevlnum - exec 'return' s:GetDefaultPolicy(a:curlnum) - endif - - " Get the code part of the current line. - let curline = s:GetTrimmedLine(a:curlnum) - " Get the previous non-comment line. - let prevnlnum = s:GetPrevNormalLine(a:curlnum) - - " Check if the current line is the closing bracket in a bracket pair. - if has_key(s:BRACKET_PAIRS, curline[0]) - " Search for a matching opening bracket. - let matchlnum = s:SearchPair(a:curlnum, a:curlnum - s:MAX_LOOKBACK, - \ "s:IsCommentOrString(line('.'), col('.'))", - \ s:BRACKET_PAIRS[curline[0]], curline[0]) - - if matchlnum - " Match the indent of the opening bracket. - return indent(matchlnum) - else - " No opening bracket found (bad syntax), so bail. - exec 'return' s:GetDefaultPolicy(a:curlnum) - endif - endif - - " Check if the current line is the closing keyword in a keyword pair. - for pair in s:KEYWORD_PAIRS - if curline =~ pair[0] - " Find the nearest and farthest matches within the same indent level. - let matches = s:SearchMatchingKeyword(a:curlnum, pair[1], pair[2]) - - if len(matches) - " Don't force indenting/outdenting as long as line is already lined up - " with a valid match - return max([min([indent(a:curlnum), indent(matches[0])]), - \ indent(matches[1])]) - else - " No starting keyword found (bad syntax), so bail. - exec 'return' s:GetDefaultPolicy(a:curlnum) - endif - endif - endfor - - " Check if the current line is a `when` and not the first in a switch block. - if curline =~ '\C^when\>' && !s:SearchCode(prevnlnum, '\C\') - " Look back for a `when`. - while prevnlnum - if getline(prevnlnum) =~ '\C^\s*when\>' - " Indent to match the found `when`, but don't force indenting (for when - " indenting nested switch blocks.) - return min([indent(a:curlnum), indent(prevnlnum)]) - endif - - let prevnlnum = s:GetPrevNormalLine(prevnlnum) - endwhile - - " No matching `when` found (bad syntax), so bail. - exec 'return' s:GetDefaultPolicy(a:curlnum) - endif - - " If the previous line is a comment, use its indentation, but don't force - " indenting. - if prevlnum != prevnlnum - return min([indent(a:curlnum), indent(prevlnum)]) - endif - - let prevline = s:GetTrimmedLine(prevnlnum) - - " Always indent after these operators. - if prevline =~ s:BEGIN_BLOCK_OP - return indent(prevnlnum) + s:ShiftWidth() - endif - - " Indent if the previous line starts a function block, but don't force - " indenting if the line is non-blank (for empty function bodies.) - if prevline =~ s:FUNCTION - if strlen(getline(a:curlnum)) > indent(a:curlnum) - return min([indent(prevnlnum) + s:ShiftWidth(), indent(a:curlnum)]) - else - return indent(prevnlnum) + s:ShiftWidth() - endif - endif - - " Check if continuation indenting is needed. If the line ends in a slash, make - " sure it isn't a regex. - if prevline =~ s:CONTINUATION_OP && - \ !(prevline =~ '/$' && s:IsString(prevnlnum, col([prevnlnum, '$']) - 1)) - " Don't indent if the continuation follows a closing bracket. - if prevline =~ s:BRACKET_CONTINUATION - exec 'return' s:GetDefaultPolicy(a:curlnum) - endif - - let prevprevnlnum = s:GetPrevNormalLine(prevnlnum) - - " Don't indent if not the first continuation. - if prevprevnlnum && s:GetTrimmedLine(prevprevnlnum) =~ s:CONTINUATION - exec 'return' s:GetDefaultPolicy(a:curlnum) - endif - - " Continuation indenting seems to vary between programmers, so if the line - " is non-blank, don't override the indentation - if strlen(getline(a:curlnum)) > indent(a:curlnum) - exec 'return' s:GetDefaultPolicy(a:curlnum) - endif - - " Otherwise indent a level. - return indent(prevnlnum) + s:ShiftWidth() - endif - - " Check if the previous line starts with a keyword that begins a block. - if prevline =~ s:BEGIN_BLOCK - " Indent if the current line doesn't start with `then` and the previous line - " isn't a single-line statement. - if curline !~ '\C^\' && !s:SearchCode(prevnlnum, '\C\') && - \ prevline !~ s:SINGLE_LINE_ELSE - return indent(prevnlnum) + s:ShiftWidth() - else - exec 'return' s:GetDefaultPolicy(a:curlnum) - endif - endif - - " Indent a dot access if it's the first. - if curline =~ s:DOT_ACCESS - if prevline !~ s:DOT_ACCESS - return indent(prevnlnum) + s:ShiftWidth() - else - exec 'return' s:GetDefaultPolicy(a:curlnum) - endif - endif - - " Outdent if a keyword breaks out of a block as long as it doesn't have a - " postfix condition (and the postfix condition isn't a single-line statement.) - if prevline =~ s:BREAK_BLOCK_OP - if !s:SearchCode(prevnlnum, s:POSTFIX_CONDITION) || - \ s:SearchCode(prevnlnum, '\C\') && - \ !s:SearchCode(prevnlnum, s:CONTAINED_THEN) - " Don't force indenting. - return min([indent(a:curlnum), indent(prevnlnum) - s:ShiftWidth()]) - else - exec 'return' s:GetDefaultPolicy(a:curlnum) - endif - endif - - " Check if inside brackets. - let matchlnum = s:SearchPair(a:curlnum, a:curlnum - s:MAX_LOOKBACK, - \ "s:IsCommentOrString(line('.'), col('.'))", - \ '\[\|(\|{', '\]\|)\|}') - - " If inside brackets, indent relative to the brackets, but don't outdent an - " already indented line. - if matchlnum - return max([indent(a:curlnum), indent(matchlnum) + s:ShiftWidth()]) - endif - - " No special rules applied, so use the default policy. - exec 'return' s:GetDefaultPolicy(a:curlnum) -endfunction diff --git a/vim/bundle/vim-coffee-script/syntax/coffee.vim b/vim/bundle/vim-coffee-script/syntax/coffee.vim deleted file mode 100755 index 7f8df73..0000000 --- a/vim/bundle/vim-coffee-script/syntax/coffee.vim +++ /dev/null @@ -1,221 +0,0 @@ -" Language: CoffeeScript -" Maintainer: Mick Koch -" URL: http://github.com/kchmck/vim-coffee-script -" License: WTFPL - -" Bail if our syntax is already loaded. -if exists('b:current_syntax') && b:current_syntax == 'coffee' - finish -endif - -" Include JavaScript for coffeeEmbed. -syn include @coffeeJS syntax/javascript.vim -silent! unlet b:current_syntax - -" Highlight long strings. -syntax sync fromstart - -" These are `matches` instead of `keywords` because vim's highlighting -" priority for keywords is higher than matches. This causes keywords to be -" highlighted inside matches, even if a match says it shouldn't contain them -- -" like with coffeeAssign and coffeeDot. -syn match coffeeStatement /\<\%(return\|break\|continue\|throw\)\>/ display -hi def link coffeeStatement Statement - -syn match coffeeRepeat /\<\%(for\|while\|until\|loop\)\>/ display -hi def link coffeeRepeat Repeat - -syn match coffeeConditional /\<\%(if\|else\|unless\|switch\|when\|then\)\>/ -\ display -hi def link coffeeConditional Conditional - -syn match coffeeException /\<\%(try\|catch\|finally\)\>/ display -hi def link coffeeException Exception - -syn match coffeeKeyword /\<\%(new\|in\|of\|by\|and\|or\|not\|is\|isnt\|class\|extends\|super\|do\)\>/ -\ display -" The `own` keyword is only a keyword after `for`. -syn match coffeeKeyword /\/ contained containedin=coffeeRepeat -\ display -hi def link coffeeKeyword Keyword - -syn match coffeeOperator /\<\%(instanceof\|typeof\|delete\)\>/ display -hi def link coffeeOperator Operator - -" The first case matches symbol operators only if they have an operand before. -syn match coffeeExtendedOp /\%(\S\s*\)\@<=[+\-*/%&|\^=!<>?.]\{-1,}\|[-=]>\|--\|++\|:/ -\ display -syn match coffeeExtendedOp /\<\%(and\|or\)=/ display -hi def link coffeeExtendedOp coffeeOperator - -" This is separate from `coffeeExtendedOp` to help differentiate commas from -" dots. -syn match coffeeSpecialOp /[,;]/ display -hi def link coffeeSpecialOp SpecialChar - -syn match coffeeBoolean /\<\%(true\|on\|yes\|false\|off\|no\)\>/ display -hi def link coffeeBoolean Boolean - -syn match coffeeGlobal /\<\%(null\|undefined\)\>/ display -hi def link coffeeGlobal Type - -" A special variable -syn match coffeeSpecialVar /\<\%(this\|prototype\|arguments\)\>/ display -hi def link coffeeSpecialVar Special - -" An @-variable -syn match coffeeSpecialIdent /@\%(\%(\I\|\$\)\%(\i\|\$\)*\)\?/ display -hi def link coffeeSpecialIdent Identifier - -" A class-like name that starts with a capital letter -syn match coffeeObject /\<\u\w*\>/ display -hi def link coffeeObject Structure - -" A constant-like name in SCREAMING_CAPS -syn match coffeeConstant /\<\u[A-Z0-9_]\+\>/ display -hi def link coffeeConstant Constant - -" A variable name -syn cluster coffeeIdentifier contains=coffeeSpecialVar,coffeeSpecialIdent, -\ coffeeObject,coffeeConstant - -" A non-interpolated string -syn cluster coffeeBasicString contains=@Spell,coffeeEscape -" An interpolated string -syn cluster coffeeInterpString contains=@coffeeBasicString,coffeeInterp - -" Regular strings -syn region coffeeString start=/"/ skip=/\\\\\|\\"/ end=/"/ -\ contains=@coffeeInterpString -syn region coffeeString start=/'/ skip=/\\\\\|\\'/ end=/'/ -\ contains=@coffeeBasicString -hi def link coffeeString String - -" A integer, including a leading plus or minus -syn match coffeeNumber /\%(\i\|\$\)\@/ display -syn match coffeeNumber /\<0[bB][01]\+\>/ display -syn match coffeeNumber /\<0[oO][0-7]\+\>/ display -syn match coffeeNumber /\<\%(Infinity\|NaN\)\>/ display -hi def link coffeeNumber Number - -" A floating-point number, including a leading plus or minus -syn match coffeeFloat /\%(\i\|\$\)\@/ -\ display -hi def link coffeeReservedError Error - -" A normal object assignment -syn match coffeeObjAssign /@\?\%(\I\|\$\)\%(\i\|\$\)*\s*\ze::\@!/ contains=@coffeeIdentifier display -hi def link coffeeObjAssign Identifier - -syn keyword coffeeTodo TODO FIXME XXX contained -hi def link coffeeTodo Todo - -syn match coffeeComment /#.*/ contains=@Spell,coffeeTodo -hi def link coffeeComment Comment - -syn region coffeeBlockComment start=/####\@!/ end=/###/ -\ contains=@Spell,coffeeTodo -hi def link coffeeBlockComment coffeeComment - -" A comment in a heregex -syn region coffeeHeregexComment start=/#/ end=/\ze\/\/\/\|$/ contained -\ contains=@Spell,coffeeTodo -hi def link coffeeHeregexComment coffeeComment - -" Embedded JavaScript -syn region coffeeEmbed matchgroup=coffeeEmbedDelim -\ start=/`/ skip=/\\\\\|\\`/ end=/`/ keepend -\ contains=@coffeeJS -hi def link coffeeEmbedDelim Delimiter - -syn region coffeeInterp matchgroup=coffeeInterpDelim start=/#{/ end=/}/ contained -\ contains=@coffeeAll -hi def link coffeeInterpDelim PreProc - -" A string escape sequence -syn match coffeeEscape /\\\d\d\d\|\\x\x\{2\}\|\\u\x\{4\}\|\\./ contained display -hi def link coffeeEscape SpecialChar - -" A regex -- must not follow a parenthesis, number, or identifier, and must not -" be followed by a number -syn region coffeeRegex start=#\%(\%()\|\%(\i\|\$\)\@> #{ == { { { } } } == } << " -" >> #{ == { abc: { def: 42 } } == } << " diff --git a/vim/bundle/vim-coffee-script/test/test-ops.coffee b/vim/bundle/vim-coffee-script/test/test-ops.coffee deleted file mode 100644 index 54be8db..0000000 --- a/vim/bundle/vim-coffee-script/test/test-ops.coffee +++ /dev/null @@ -1,90 +0,0 @@ -# Various operators -abc instanceof def -typeof abc -delete abc -abc::def - -abc + def -abc - def -abc * def -abc / def -abc % def -abc & def -abc | def -abc ^ def -abc >> def -abc << def -abc >>> def -abc ? def -abc && def -abc and def -abc || def -abc or def - -abc += def -abc -= def -abc *= def -abc /= def -abc %= def -abc &= def -abc |= def -abc ^= def -abc >>= def -abc <<= def -abc >>>= def -abc ?= def -abc &&= def -abc ||= def - -abc and= def -abc or= def - -abc.def.ghi -abc?.def?.ghi - -abc < def -abc > def -abc = def -abc == def -abc != def -abc <= def -abc >= def - -abc++ -abc-- -++abc ---abc - -# Nested operators -abc[def] = ghi -abc[def[ghi: jkl]] = 42 -@abc[def] = ghi - -abc["#{def = 42}"] = 42 -abc["#{def.ghi = 42}"] = 42 -abc["#{def[ghi] = 42}"] = 42 -abc["#{def['ghi']}"] = 42 - -# Object assignments -abc = - def: 123 - DEF: 123 - @def: 123 - Def: 123 - 'def': 123 - 42: 123 - -# Operators shouldn't be highlighted -vector= -wand= - -abc+++ -abc--- -abc ** def -abc &&& def -abc ^^ def -abc ===== def -abc <==== def -abc >==== def -abc +== def -abc =^= def diff --git a/vim/bundle/vim-coffee-script/test/test-reserved.coffee b/vim/bundle/vim-coffee-script/test/test-reserved.coffee deleted file mode 100644 index b841760..0000000 --- a/vim/bundle/vim-coffee-script/test/test-reserved.coffee +++ /dev/null @@ -1,27 +0,0 @@ -# Should be an error -function = 42 -var = 42 - -# Shouldn't be an error -abc.with = 42 -function: 42 -var: 42 - -# Keywords shouldn't be highlighted -abc.function -abc.do -abc.break -abc.true - -abc::function -abc::do -abc::break -abc::true - -abc:: function -abc. function - -# Numbers should be highlighted -def.42 -def .42 -def::42 diff --git a/vim/bundle/vim-coffee-script/test/test.haml b/vim/bundle/vim-coffee-script/test/test.haml deleted file mode 100644 index ae19fba..0000000 --- a/vim/bundle/vim-coffee-script/test/test.haml +++ /dev/null @@ -1,3 +0,0 @@ -:coffeescript - class Hello - # test diff --git a/vim/bundle/vim-coffee-script/test/test.html b/vim/bundle/vim-coffee-script/test/test.html deleted file mode 100644 index 3479145..0000000 --- a/vim/bundle/vim-coffee-script/test/test.html +++ /dev/null @@ -1,7 +0,0 @@ - - - diff --git a/vim/bundle/vim-colors-solarized/README.mkd b/vim/bundle/vim-colors-solarized/README.mkd deleted file mode 100644 index a163b02..0000000 --- a/vim/bundle/vim-colors-solarized/README.mkd +++ /dev/null @@ -1,267 +0,0 @@ ---- -Title: Solarized Colorscheme for Vim -Description: Precision colors for machines and people -Author: Ethan Schoonover -Colors: light yellow -Created: 2011 Mar 15 -Modified: 2011 Apr 16 - ---- - -Solarized Colorscheme for Vim -============================= - -Developed by Ethan Schoonover - -Visit the [Solarized homepage] ------------------------------- - -See the [Solarized homepage] for screenshots, -details and colorscheme versions for Vim, Mutt, popular terminal emulators and -other applications. - -Screenshots ------------ - -![solarized dark](https://github.com/altercation/solarized/raw/master/img/solarized-vim.png) - -Downloads ---------- - -If you have come across this colorscheme via the [Vim-only repository] on -github, or the [vim.org script] page see the link above to the Solarized -homepage or visit the main [Solarized repository]. - -The [Vim-only repository] is kept in sync with the main [Solarized repository] -and is for installation convenience only (with [Pathogen] or [Vundle], for -instance). Issues, bug reports, changelogs are centralized at the main -[Solarized repository]. - -[Solarized homepage]: http://ethanschoonover.com/solarized -[Solarized repository]: https://github.com/altercation/solarized -[Vim-only repository]: https://github.com/altercation/vim-colors-solarized -[vimorg-script]: http://vim.org/script -[Pathogen]: https://github.com/tpope/vim-pathogen -[Vundle]: https://github.com/gmarik/vundle - -Installation ------------- - -### Option 1: Manual installation - -1. Move `solarized.vim` to your `.vim/colors` directory. After downloading the - vim script or package: - - $ cd vim-colors-solarized/colors - $ mv solarized.vim ~/.vim/colors/ - -### Option 2: Pathogen installation ***(recommended)*** - -1. Download and install Tim Pope's [Pathogen]. - -2. Next, move or clone the `vim-colors-solarized` directory so that it is - a subdirectory of the `.vim/bundle` directory. - - a. **Clone:** - - $ cd ~/.vim/bundle - $ git clone git://github.com/altercation/vim-colors-solarized.git - - b. **Move:** - - In the parent directory of vim-colors-solarized: - - $ mv vim-colors-solarized ~/.vim/bundle/ - -### Modify .vimrc - -After either Option 1 or Option 2 above, put the following two lines in your -.vimrc: - - syntax enable - set background=dark - colorscheme solarized - -or, for the light background mode of Solarized: - - syntax enable - set background=light - colorscheme solarized - -I like to have a different background in GUI and terminal modes, so I can use -the following if-then. However, I find vim's background autodetection to be -pretty good and, at least with MacVim, I can leave this background value -assignment out entirely and get the same results. - - if has('gui_running') - set background=light - else - set background=dark - endif - -See the [Solarized homepage] for screenshots which will help you -select either the light or dark background. - -### IMPORTANT NOTE FOR TERMINAL USERS: - -If you are going to use Solarized in Terminal mode (i.e. not in a GUI version -like gvim or macvim), **please please please** consider setting your terminal -emulator's colorscheme to used the Solarized palette. I've included palettes -for some popular terminal emulator as well as Xdefaults in the official -Solarized download available from [Solarized homepage]. If you use -Solarized *without* these colors, Solarized will need to be told to degrade its -colorscheme to a set compatible with the limited 256 terminal palette (whereas -by using the terminal's 16 ansi color values, you can set the correct, specific -values for the Solarized palette). - -If you do use the custom terminal colors, solarized.vim should work out of the -box for you. If you are using a terminal emulator that supports 256 colors and -don't want to use the custom Solarized terminal colors, you will need to use -the degraded 256 colorscheme. To do so, simply add the following line *before* -the `colorschem solarized` line: - - let g:solarized_termcolors=256 - -Again, I recommend just changing your terminal colors to Solarized values -either manually or via one of the many terminal schemes available for import. - -Advanced Configuration ----------------------- - -Solarized will work out of the box with just the two lines specified above but -does include several other options that can be set in your .vimrc file. - -Set these in your vimrc file prior to calling the colorscheme. -" - option name default optional - ------------------------------------------------ - g:solarized_termcolors= 16 | 256 - g:solarized_termtrans = 0 | 1 - g:solarized_degrade = 0 | 1 - g:solarized_bold = 1 | 0 - g:solarized_underline = 1 | 0 - g:solarized_italic = 1 | 0 - g:solarized_contrast = "normal"| "high" or "low" - g:solarized_visibility= "normal"| "high" or "low" - ------------------------------------------------ - -### Option Details - -* g:solarized_termcolors - - This is set to *16* by default, meaning that Solarized will attempt to use - the standard 16 colors of your terminal emulator. You will need to set - those colors to the correct Solarized values either manually or by - importing one of the many colorscheme available for popular terminal - emulators and Xdefaults. - -* g:solarized_termtrans - - If you use a terminal emulator with a transparent background and Solarized - isn't displaying the background color transparently, set this to 1 and - Solarized will use the default (transparent) background of the terminal - emulator. *urxvt* required this in my testing; iTerm2 did not. - - Note that on Mac OS X Terminal.app, solarized_termtrans is set to 1 by - default as this is almost always the best option. The only exception to - this is if the working terminfo file supports 256 colors (xterm-256color). - -* g:solarized_degrade - - For test purposes only; forces Solarized to use the 256 degraded color mode - to test the approximate color values for accuracy. - -* g:solarized_bold | g:solarized_underline | g:solarized_italic - - If you wish to stop Solarized from displaying bold, underlined or - italicized typefaces, simply assign a zero value to the appropriate - variable, for example: `let g:solarized_italic=0` - -* g:solarized_contrast - - Stick with normal! It's been carefully tested. Setting this option to high - or low does use the same Solarized palette but simply shifts some values up - or down in order to expand or compress the tonal range displayed. - -* g:solarized_visibility - - Special characters such as trailing whitespace, tabs, newlines, when - displayed using `:set list` can be set to one of three levels depending on - your needs. Default value is `normal` with `high` and `low` options. - -Toggle Background Function --------------------------- - -Solarized comes with a Toggle Background plugin that by default will map to - if that mapping is available. If it is not available you will need to -either map the function manually or change your current mapping to -something else. - -To set your own mapping in your .vimrc file, simply add the following line to -support normal, insert and visual mode usage, changing the "" value to the -key or key combination you wish to use: - - call togglebg#map("") - -Note that you'll want to use a single function key or equivalent if you want -the plugin to work in all modes (normal, insert, visual). - -Code Notes ----------- - -Use folding to view the `solarized.vim` script with `foldmethod=marker` turned -on. - -I have attempted to modularize the creation of Vim colorschemes in this script -and, while it could be refactored further, it should be a good foundation for -the creation of any color scheme. By simply changing the sixteen values in the -GUI section and testing in gvim (or mvim) you can rapidly prototype new -colorschemes without diving into the weeds of line-item editing each syntax -highlight declaration. - -The Values ----------- - -L\*a\*b values are canonical (White D65, Reference D50), other values are -matched in sRGB space. - - SOLARIZED HEX 16/8 TERMCOL XTERM/HEX L*A*B sRGB HSB - --------- ------- ---- ------- ----------- ---------- ----------- ----------- - base03 #002b36 8/4 brblack 234 #1c1c1c 15 -12 -12 0 43 54 193 100 21 - base02 #073642 0/4 black 235 #262626 20 -12 -12 7 54 66 192 90 26 - base01 #586e75 10/7 brgreen 240 #4e4e4e 45 -07 -07 88 110 117 194 25 46 - base00 #657b83 11/7 bryellow 241 #585858 50 -07 -07 101 123 131 195 23 51 - base0 #839496 12/6 brblue 244 #808080 60 -06 -03 131 148 150 186 13 59 - base1 #93a1a1 14/4 brcyan 245 #8a8a8a 65 -05 -02 147 161 161 180 9 63 - base2 #eee8d5 7/7 white 254 #d7d7af 92 -00 10 238 232 213 44 11 93 - base3 #fdf6e3 15/7 brwhite 230 #ffffd7 97 00 10 253 246 227 44 10 99 - yellow #b58900 3/3 yellow 136 #af8700 60 10 65 181 137 0 45 100 71 - orange #cb4b16 9/3 brred 166 #d75f00 50 50 55 203 75 22 18 89 80 - red #dc322f 1/1 red 160 #d70000 50 65 45 220 50 47 1 79 86 - magenta #d33682 5/5 magenta 125 #af005f 50 65 -05 211 54 130 331 74 83 - violet #6c71c4 13/5 brmagenta 61 #5f5faf 50 15 -45 108 113 196 237 45 77 - blue #268bd2 4/4 blue 33 #0087ff 55 -10 -45 38 139 210 205 82 82 - cyan #2aa198 6/6 cyan 37 #00afaf 60 -35 -05 42 161 152 175 74 63 - green #859900 2/2 green 64 #5f8700 60 -20 65 133 153 0 68 100 60 - -License -------- -Copyright (c) 2011 Ethan Schoonover - -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. diff --git a/vim/bundle/vim-colors-solarized/autoload/togglebg.vim b/vim/bundle/vim-colors-solarized/autoload/togglebg.vim deleted file mode 100644 index 108511f..0000000 --- a/vim/bundle/vim-colors-solarized/autoload/togglebg.vim +++ /dev/null @@ -1,55 +0,0 @@ -" Toggle Background -" Modified: 2011 Apr 29 -" Maintainer: Ethan Schoonover -" License: OSI approved MIT license - -if exists("g:loaded_togglebg") - finish -endif -let g:loaded_togglebg = 1 - -" noremap is a bit misleading here if you are unused to vim mapping. -" in fact, there is remapping, but only of script locally defined remaps, in -" this case TogBG. The