aboutsummaryrefslogtreecommitdiff
path: root/vim
diff options
context:
space:
mode:
Diffstat (limited to 'vim')
-rw-r--r--vim/autoload/detect_background.vim37
m---------vim/bundle/big_file_options0
m---------vim/bundle/copy_linebreak0
m---------vim/bundle/juvenile0
m---------vim/bundle/mail_mutt0
m---------vim/bundle/sahara0
m---------vim/bundle/strip_trailing_whitespace0
m---------vim/bundle/surround0
m---------vim/bundle/uncap_ex0
m---------vim/bundle/unimpaired0
-rw-r--r--vim/config/syntax.vim15
-rw-r--r--vim/doc/big_file_options.txt28
-rw-r--r--vim/doc/command_typos.txt28
-rw-r--r--vim/doc/copy_linebreak.txt56
-rw-r--r--vim/doc/detect_background.txt37
-rw-r--r--vim/doc/mail_mutt.txt66
-rw-r--r--vim/doc/strip_trailing_whitespace.txt46
-rw-r--r--vim/plugin/big_file_options.vim66
-rw-r--r--vim/plugin/command_typos.vim45
-rw-r--r--vim/plugin/copy_linebreak.vim68
-rw-r--r--vim/plugin/mail_mutt.vim56
-rw-r--r--vim/plugin/strip_trailing_whitespace.vim75
22 files changed, 5 insertions, 618 deletions
diff --git a/vim/autoload/detect_background.vim b/vim/autoload/detect_background.vim
deleted file mode 100644
index e4163a43..00000000
--- a/vim/autoload/detect_background.vim
+++ /dev/null
@@ -1,37 +0,0 @@
-"
-" detect_background.vim: Invert Vim's built-in logic for choosing dark or
-" light backgrounds; we'll default to choosing a dark background unless we
-" find some reason *not* to.
-"
-" Return the string to which we think the option should be set, to allow the
-" caller to use it as they see fit.
-"
-" Author: Tom Ryder <tom@sanctum.geek.nz>
-" License: Same as Vim itself
-"
-if exists('g:loaded_detect_background') || &compatible
- finish
-endif
-let g:loaded_detect_background = 1
-
-" Declare autoload function for 'background' set
-function! detect_background#DetectBackground() abort
-
- " Split up the value of $COLORFGBG (if any) by semicolons
- let l:colorfgbg = split($COLORFGBG, ';')
-
- " Get the background color value, or an empty string if none
- let l:bg = len(l:colorfgbg)
- \ ? l:colorfgbg[-1]
- \ : ''
-
- " Choose the background setting based on this value
- if l:bg ==# 'default'
- \ || l:bg == 7
- \ || l:bg == 15
- return 'light'
- else
- return 'dark'
- endif
-
-endfunction
diff --git a/vim/bundle/big_file_options b/vim/bundle/big_file_options
new file mode 160000
+Subproject e70de13287c7a7a0a408075b7954e9d14ed606b
diff --git a/vim/bundle/copy_linebreak b/vim/bundle/copy_linebreak
new file mode 160000
+Subproject 3448f6ae2bc974af48fb16aaabff85fe1bc250e
diff --git a/vim/bundle/juvenile b/vim/bundle/juvenile
-Subproject bf57417175c40c060fde63f020559f3483c3c9e
+Subproject bf56b15638d60102fbb1a6931a0da44ebd53394
diff --git a/vim/bundle/mail_mutt b/vim/bundle/mail_mutt
new file mode 160000
+Subproject 8f417d2ac92b1247b24103963e64bf63d627de3
diff --git a/vim/bundle/sahara b/vim/bundle/sahara
-Subproject 4f85b7c8fe1953479a2253cadd1ab82017a4d7e
+Subproject 162e27eeb0e30345ec62862a38f08b1c9352a04
diff --git a/vim/bundle/strip_trailing_whitespace b/vim/bundle/strip_trailing_whitespace
new file mode 160000
+Subproject d64a7405e3bbfcb10cef99eb2795130504bce3a
diff --git a/vim/bundle/surround b/vim/bundle/surround
-Subproject e49d6c2459e0f5569ff2d533b4df995dd7f9831
+Subproject 643a42454bc8c2b2735de14f309523ce733a535
diff --git a/vim/bundle/uncap_ex b/vim/bundle/uncap_ex
new file mode 160000
+Subproject 2fceff8fe5ff7cd0d2282c5f46b448443438e66
diff --git a/vim/bundle/unimpaired b/vim/bundle/unimpaired
-Subproject 86823a13a7b6dd70afd2316a3cf469192de7963
+Subproject fe7d2241df475de631b8891fdccd20bf9a7574d
diff --git a/vim/config/syntax.vim b/vim/config/syntax.vim
index 2322db5b..a2186b1f 100644
--- a/vim/config/syntax.vim
+++ b/vim/config/syntax.vim
@@ -5,17 +5,12 @@ if has('syntax') && !has('g:syntax_on')
silent! syntax enable
silent! syntax sync minlines=100
- " If we can, detect a light background, but default to a dark one. This is
- " only because it's more likely the author of this configuration will be
- " using one.
- if v:version >= 701
- silent! let &background = detect_background#DetectBackground()
- else
- set background=dark
- endif
+ " Opinionated; if the author is using color at all, it will probably be with
+ " a dark background
+ set background=dark
- " The 'sahara' colorscheme only works for dark backgrounds with 256 colors
- if &background ==# 'dark' && (has('gui_running') || &t_Co == 256)
+ " The 'sahara' colorscheme only works in the GUI or with 256 colors
+ if has('gui_running') || &t_Co >= 256
silent! colorscheme sahara
endif
diff --git a/vim/doc/big_file_options.txt b/vim/doc/big_file_options.txt
deleted file mode 100644
index cab0664e..00000000
--- a/vim/doc/big_file_options.txt
+++ /dev/null
@@ -1,28 +0,0 @@
-*big_file_options.txt* For Vim version 7.0 Last change: 2017 November 12
-
-DESCRIPTION *big_file_options*
-
-This plugin adds an |autocmd| hook to check the file size of an incoming
-buffer, and if it's over a certain threshold, disables certain options in order
-to make the file a bit easier to edit.
-
-REQUIREMENTS *big_file_options-requirements*
-
-This plugin is only available if 'compatible' is not set.
-
-AUTHOR *big_file_options-author*
-
-Written and maintained by Tom Ryder <tom@sanctum.geek.nz>.
-
-LICENSE *big_file_options-license*
-
-Licensed for distribution under the same terms as Vim itself (see |license|).
-
-DISTRIBUTION *big_file_options-distribution*
-
-This plugin lives in Tom Ryder's "dotfiles" suite, and may eventually be spun
-off into a separate distribution as it solidifies and this documentation
-improves. See <https://sanctum.geek.nz/cgit/dotfiles.git/about/> for more
-information.
-
- vim:tw=78:ts=8:ft=help:norl:
diff --git a/vim/doc/command_typos.txt b/vim/doc/command_typos.txt
deleted file mode 100644
index 938fef27..00000000
--- a/vim/doc/command_typos.txt
+++ /dev/null
@@ -1,28 +0,0 @@
-*command_typos.txt* For Vim version 7.0 Last change: 2017 November 12
-
-DESCRIPTION *command_typos*
-
-This plugin defines custom commands like :W, :Qa, and :Wq to match their
-lowercase analogues, to forgive me when my pinky finger doesn't roll off the
-Shift key quite soon enough after pressing the colon key.
-
-REQUIREMENTS *command_typos-requirements*
-
-This plugin is only available if 'compatible' is not set.
-
-AUTHOR *command_typos-author*
-
-Written and maintained by Tom Ryder <tom@sanctum.geek.nz>.
-
-LICENSE *command_typos-license*
-
-Licensed for distribution under the same terms as Vim itself (see |license|).
-
-DISTRIBUTION *command_typos-distribution*
-
-This plugin lives in Tom Ryder's "dotfiles" suite, and may eventually be spun
-off into a separate distribution as it solidifies and this documentation
-improves. See <https://sanctum.geek.nz/cgit/dotfiles.git/about/> for more
-information.
-
- vim:tw=78:ts=8:ft=help:norl:
diff --git a/vim/doc/copy_linebreak.txt b/vim/doc/copy_linebreak.txt
deleted file mode 100644
index 581c6166..00000000
--- a/vim/doc/copy_linebreak.txt
+++ /dev/null
@@ -1,56 +0,0 @@
-*copy_linebreak.txt* For Vim version 7.0 Last change: 2017 November 12
-
-DESCRIPTION *copy_linebreak*
-
-This plugin provides mapping targets for a user to set, unset, or toggle
-|'linebreak'|-related settings when |'wrap'| is enabled, to switch between
-human-readable output and a format friendly for copy-pasting with terminal
-emulators or screen/tmux.
-
-REQUIREMENTS *copy_linebreak-requirements*
-
-This plugin is only available if 'compatible' is not set.
-
-MAPPINGS *copy_linebreak-mappings*
-
-Mapping targets provided are:
-
-|<Plug>CopyLinebreakEnable|: *<Plug>CopyLinebreakEnable*
- Enable copy-paste friendly line break options.
-|<Plug>CopyLinebreakDisable|: *<Plug>CopyLinebreakDisable*
- Revert to human-readable line break options.
-|<Plug>CopyLinebreakToggle|: *<Plug>CopyLinebreakToggle*
- Toggle between the above two states.
-
-There are no default key mappings to any of these targers; you should define
-them yourself in your |vimrc|. For example:
->
- :nmap <Leader>b <Plug>CopyLinebreakToggle
-<
-COMMANDS *copy_linebreak-commands*
-
-If the |+user_commands| feature is available, commands provided are:
-
-`:CopyLinebreakEnable`: *:CopyLinebreakEnable*
- Enable copy-paste friendly line break options.
-`:CopyLinebreakDisable`: *:CopyLinebreakDisable*
- Revert to human-readable line break options.
-`:CopyLinebreakToggle`: *:CopyLinebreakToggle*
- Toggle between the above two states.
-
-AUTHOR *copy_linebreak-author*
-
-Written and maintained by Tom Ryder <tom@sanctum.geek.nz>.
-
-LICENSE *copy_linebreak-license*
-
-Licensed for distribution under the same terms as Vim itself (see |license|).
-
-DISTRIBUTION *copy_linebreak-distribution*
-
-This plugin lives in Tom Ryder's "dotfiles" suite, and may eventually be spun
-off into a separate distribution as it solidifies and this documentation
-improves. See <https://sanctum.geek.nz/cgit/dotfiles.git/about/> for more
-information.
-
- vim:tw=78:ts=8:ft=help:norl:
diff --git a/vim/doc/detect_background.txt b/vim/doc/detect_background.txt
deleted file mode 100644
index 570ac47b..00000000
--- a/vim/doc/detect_background.txt
+++ /dev/null
@@ -1,37 +0,0 @@
-*detect_background.txt* For Vim version 7.0 Last change: 2017 November 12
-
-DESCRIPTION *detect_background*
- *detect_background#DetectBackground()*
-
-The |detect_background#DetectBackground()| function provided by this plugin
-inspects the $COLORFGBG environment variable to determine whether the user is
-using a terminal with a light background, and returns the word "dark" or
-"light" accordingly, for use in setting 'background'.
-
-The function does roughly the reverse of Vim's built-in heuristics to set the
-'background' option, which default to a light background in the absence of
-hints otherwise.
-
-Note that this plugin does not inspect the value of the $TERM environment
-variable or the |'term'| option at all, nor the |'t_RB'| option.
-
-REQUIREMENTS *detect_background-requirements*
-
-This plugin is only available if 'compatible' is not set.
-
-AUTHOR *detect_background-author*
-
-Written and maintained by Tom Ryder <tom@sanctum.geek.nz>.
-
-LICENSE *detect_background-license*
-
-Licensed for distribution under the same terms as Vim itself (see |license|).
-
-DISTRIBUTION *detect_background-distribution*
-
-This plugin lives in Tom Ryder's "dotfiles" suite, and may eventually be spun
-off into a separate distribution as it solidifies and this documentation
-improves. See <https://sanctum.geek.nz/cgit/dotfiles.git/about/> for more
-information.
-
- vim:tw=78:ts=8:ft=help:norl:
diff --git a/vim/doc/mail_mutt.txt b/vim/doc/mail_mutt.txt
deleted file mode 100644
index 1129651d..00000000
--- a/vim/doc/mail_mutt.txt
+++ /dev/null
@@ -1,66 +0,0 @@
-*mail_mutt.txt* For Vim version 7.0 Last change: 2017 November 12
-
-DESCRIPTION *mail_mutt*
-
-This plugin allows you to quickly start writing an email message in Mutt with
-a range of lines from the current buffer as the initial mail content.
-
-REQUIREMENTS *mail_mutt-requirements*
-
-This plugin is only available if 'compatible' is not set.
-
-You will want to have the mutt(1) command from the Mutt distribution installed
-to use this plugin. Mutt is available from <http://www.mutt.org/>.
-
-COMMANDS *mail_mutt-commands* *:MailMutt*
-
-This plugin provides a single command `:MailMutt` command which accepts a line
-range prefix defaulting to the entire buffer, writing these lines to a
-temporary file that is then provided to the -i option of the Mutt mail user
-agent, as the initial content of a new message.
->
- :MailMutt
- :.MailMutt
- :3,6MailMutt
- :95,$MailMutt
-<
-MAPPINGS *mail_mutt-mappings*
-
-Three <Plug> mapping targets are also provided for convenience. No attempt is
-made to map key sequences to these mappings within the plugin; you must do
-this explicitly in your |vimrc|.
-
- *<Plug>MailMuttLine*
-Th <Plug>MailMuttLine mapping runs `:MailMutt` on the current line in normal
-mode. A binding example might be:
->
- :nmap <Leader>ml <Plug>MailMuttLine
-<
- *<Plug>MailMuttBuffer*
-The <Plug>MailMuttBuffer mapping runs `:MailMutt` on the whole buffer in
-normal mode. A binding example might be:
->
- :nmap <Leader>mb <Plug>MailMuttBuffer
-<
- *<Plug>MailMuttSelected*
-The <Plug>MailMuttSelected mapping runs `:MailMutt` on the selected lines in
-visual or selection mode. A binding example might be:
->
- :vmap <Leader>ms <Plug>MailMuttSelected
-<
-AUTHOR *mail_mutt-author*
-
-Written and maintained by Tom Ryder <tom@sanctum.geek.nz>.
-
-LICENSE *mail_mutt-license*
-
-Licensed for distribution under the same terms as Vim itself (see |license|).
-
-DISTRIBUTION *mail_mutt-distribution*
-
-This plugin lives in Tom Ryder's "dotfiles" suite, and may eventually be spun
-off into a separate distribution as it solidifies and this documentation
-improves. See <https://sanctum.geek.nz/cgit/dotfiles.git/about/> for more
-information.
-
- vim:tw=78:ts=8:ft=help:norl:
diff --git a/vim/doc/strip_trailing_whitespace.txt b/vim/doc/strip_trailing_whitespace.txt
deleted file mode 100644
index 2b220231..00000000
--- a/vim/doc/strip_trailing_whitespace.txt
+++ /dev/null
@@ -1,46 +0,0 @@
-*strip_trailing_whitespace.txt* For Vim version 7.0 Last change: 2017 November 12
-
-DESCRIPTION *strip_trailing_whitespace*
-
-This plugin provides a mapping target and an optional custom command with the
-author's approach to stripping trailing whitespace from an entire buffer,
-including removing empty or whitespace-only lines at the end of the buffer,
-without making command noise and without moving the cursor from its current
-position.
-
-REQUIREMENTS *strip_trailing_whitespace-requirements*
-
-This plugin is only available if 'compatible' is not set.
-
-COMMANDS *strip_trailing_whitespace-commands*
-
- *:StripTrailingWhitespace*
-The plugin provides a single `:StripTrailingWhitespace` command if Vim has the
-|+user_commands| feature, but this is not required. It operates on the entire
-buffer, and accepts neither a range nor arguments.
-
-MAPPINGS *strip_trailing_whitespace-mappings*
-
- *<Plug>StripTrailingWhitespace*
-The single mapping target provided is |<Plug>StripTrailingWhitespace|,
-mappable in any mode. There is no default key mapping to the target; you
-should define this yourself in your |vimrc|. For example:
->
- :nmap <Leader>x <Plug>StripTrailingWhitespace>
-<
-AUTHOR *strip_trailing_whitespace-author*
-
-Written and maintained by Tom Ryder <tom@sanctum.geek.nz>.
-
-LICENSE *strip_trailing_whitespace-license*
-
-Licensed for distribution under the same terms as Vim itself (see |license|).
-
-DISTRIBUTION *strip_trailing_whitespace-distribution*
-
-This plugin lives in Tom Ryder's "dotfiles" suite, and may eventually be spun
-off into a separate distribution as it solidifies and this documentation
-improves. See <https://sanctum.geek.nz/cgit/dotfiles.git/about/> for more
-information.
-
- vim:tw=78:ts=8:ft=help:norl:
diff --git a/vim/plugin/big_file_options.vim b/vim/plugin/big_file_options.vim
deleted file mode 100644
index f7fa0281..00000000
--- a/vim/plugin/big_file_options.vim
+++ /dev/null
@@ -1,66 +0,0 @@
-"
-" big_file_options.vim: When opening a large file, take some measures to keep
-" things loading quickly.
-"
-" Author: Tom Ryder <tom@sanctum.geek.nz>
-" License: Same as Vim itself
-"
-if exists('g:loaded_big_file_options') || &compatible
- finish
-endif
-if !has('autocmd')
- finish
-endif
-let g:loaded_big_file_options = 1
-
-" Default threshold is 10 MiB
-if !exists('g:big_file_size')
- let g:big_file_size = 10 * 1024 * 1024
-endif
-
-" Default to leaving syntax highlighting off
-if !exists('g:big_file_syntax')
- let g:big_file_syntax = 0
-endif
-
-" Cut 'synmaxcol' down to this or smaller for big files
-if !exists('g:big_file_synmaxcol')
- let g:big_file_synmaxcol = 256
-endif
-
-" Declare function for turning off slow options
-function! s:BigFileOptions()
-
- " Don't do anything if the buffer size is under the threshold
- if line2byte(line('$') + 1) <= g:big_file_size
- return
- endif
-
- " Turn off backups, swap files, and undo files
- setlocal nobackup
- setlocal nowritebackup
- setlocal noswapfile
- if has('persistent_undo')
- setlocal noundofile
- endif
-
- " Limit the number of columns of syntax highlighting
- if exists('+synmaxcol')
- \ && &synmaxcol > g:big_file_synmaxcol
- execute 'setlocal synmaxcol=' . g:big_file_synmaxcol
- endif
-
- " Disable syntax highlighting if configured to do so
- if !g:big_file_syntax
- setlocal syntax=OFF
- endif
-
-endfunction
-
-" Define autocmd for calling to check filesize
-augroup big_file_options_bufreadpost
- autocmd!
- autocmd BufReadPost
- \ *
- \ call s:BigFileOptions()
-augroup end
diff --git a/vim/plugin/command_typos.vim b/vim/plugin/command_typos.vim
deleted file mode 100644
index 6f34c680..00000000
--- a/vim/plugin/command_typos.vim
+++ /dev/null
@@ -1,45 +0,0 @@
-"
-" command_typos.vim: Tolerate typos like :Wq, :Q, or :Qa and do what I mean,
-" including any arguments or modifiers; I fat-finger these commands a lot
-" because I type them so rapidly, and they don't correspond to any other
-" commands I use
-"
-" Author: Tom Ryder <tom@sanctum.geek.nz>
-" License: Same as Vim itself
-"
-if exists('g:loaded_command_typos') || &compatible
- finish
-endif
-if !has('user_commands')
- finish
-endif
-let g:loaded_command_typos = 1
-
-" Define commands
-command -bang -complete=file -nargs=?
- \ E
- \ edit<bang> <args>
-command -bang -complete=file -nargs=?
- \ W
- \ write<bang> <args>
-command -bang -complete=file -nargs=?
- \ WQ
- \ wq<bang> <args>
-command -bang -complete=file -nargs=?
- \ Wq
- \ wq<bang> <args>
-command -bang
- \ Q
- \ quit<bang>
-command -bang
- \ Qa
- \ qall<bang>
-command -bang
- \ QA
- \ qall<bang>
-command -bang
- \ Wa
- \ wall<bang>
-command -bang
- \ WA
- \ wa<bang>
diff --git a/vim/plugin/copy_linebreak.vim b/vim/plugin/copy_linebreak.vim
deleted file mode 100644
index a7d8a3e5..00000000
--- a/vim/plugin/copy_linebreak.vim
+++ /dev/null
@@ -1,68 +0,0 @@
-"
-" copy_linebreak.vim: Bind user-defined key sequences to toggle a group of
-" options that make text wrapped with 'wrap' copy-paste friendly. Also creates
-" user commands if it can.
-"
-" Author: Tom Ryder <tom@sanctum.geek.nz>
-" License: Same as Vim itself
-"
-if exists('g:loaded_copy_linebreak') || &compatible
- finish
-endif
-if !has('linebreak')
- finish
-endif
-let g:loaded_copy_linebreak = 1
-
-" Enable copy-friendly linebreak options
-function! s:CopyLinebreakEnable()
- setlocal nolinebreak linebreak?
- let s:showbreak_save = &showbreak
- set showbreak=
- if exists('+breakindent')
- setlocal nobreakindent
- endif
-endfunction
-
-" Disable copy-friendly linebreak options
-function! s:CopyLinebreakDisable()
- setlocal linebreak linebreak?
- let &showbreak = s:showbreak_save
- if exists('+breakindent')
- setlocal breakindent<
- endif
-endfunction
-
-" Toggle copy-friendly linebreak options, using the current setting for the
-" 'linebreak' option as the pivot
-function! s:CopyLinebreakToggle()
- if &linebreak
- call <SID>CopyLinebreakEnable()
- else
- call <SID>CopyLinebreakDisable()
- endif
-endfunction
-
-" Provide mappings to the function just defined
-noremap <silent> <unique>
- \ <Plug>CopyLinebreakEnable
- \ :<C-U>call <SID>CopyLinebreakEnable()<CR>
-noremap <silent> <unique>
- \ <Plug>CopyLinebreakDisable
- \ :<C-U>call <SID>CopyLinebreakDisable()<CR>
-noremap <silent> <unique>
- \ <Plug>CopyLinebreakToggle
- \ :<C-U>call <SID>CopyLinebreakToggle()<CR>
-
-" Provide user commands if we can
-if has('user_commands')
- command -nargs=0
- \ CopyLinebreakEnable
- \ call <SID>CopyLinebreakEnable
- command -nargs=0
- \ CopyLinebreakDisable
- \ call <SID>CopyLinebreakDisable
- command -nargs=0
- \ CopyLinebreakToggle
- \ call <SID>CopyLinebreakToggle
-endif
diff --git a/vim/plugin/mail_mutt.vim b/vim/plugin/mail_mutt.vim
deleted file mode 100644
index 63cae2f6..00000000
--- a/vim/plugin/mail_mutt.vim
+++ /dev/null
@@ -1,56 +0,0 @@
-"
-" mail_mutt.vim: Start a mutt(1) message with the lines in the given range,
-" defaulting to the entire buffer.
-"
-" Author: Tom Ryder <tom@sanctum.geek.nz>
-" License: Same as Vim itself
-"
-if exists('g:loaded_mail_mutt') || &compatible
- finish
-endif
-if !has('user_commands')
- finish
-endif
-let g:loaded_mail_mutt = 1
-
-" Declare function
-function! s:MailMutt(start, end)
-
- " Check we'll have mutt(1) to execute
- if !executable('mutt')
- echoerr 'mutt not found in $PATH'
- finish
- endif
-
- " Create a temporary file
- let l:tf = tempname()
-
- " Write the contents of the buffer to it
- let l:range = a:start . ',' . a:end
- let l:command = 'write ' . fnameescape(l:tf)
- execute l:range . l:command
-
- " Run mutt(1) with that file as its input
- execute '!mutt -i ' . shellescape(l:tf)
-
-endfunction
-
-" Create a command to wrap around that function
-command -nargs=0 -range=%
- \ MailMutt
- \ call <SID>MailMutt(<line1>, <line2>)
-
-" Mapping to mail current line in normal mode
-nnoremap <silent> <unique>
- \ <Plug>MailMuttLine
- \ :<C-U>.MailMutt<CR>
-
-" Mapping to mail whole buffer in normal mode
-nnoremap <silent> <unique>
- \ <Plug>MailMuttBuffer
- \ :<C-U>%MailMutt<CR>
-
-" Mapping to mail selected lines in visual/select mode
-vnoremap <silent> <unique>
- \ <Plug>MailMuttSelected
- \ :MailMutt<CR>
diff --git a/vim/plugin/strip_trailing_whitespace.vim b/vim/plugin/strip_trailing_whitespace.vim
deleted file mode 100644
index 1b6d2f38..00000000
--- a/vim/plugin/strip_trailing_whitespace.vim
+++ /dev/null
@@ -1,75 +0,0 @@
-"
-" strip_trailing_whitespace.vim: User-defined key mapping and optional command
-" to strip trailing whitespace in the whole document.
-"
-" Author: Tom Ryder <tom@sanctum.geek.nz>
-" License: Same as Vim itself
-"
-if exists('g:loaded_strip_trailing_whitespace') || &compatible
- finish
-endif
-let g:loaded_strip_trailing_whitespace = 1
-
-" Define function for stripping whitespace
-function! s:StripTrailingWhitespace()
-
- " Iterating line number
- let l:li = 1
-
- " Line number of last line that had non-whitespace characters on it
- let l:lw = 0
-
- " Line number of the file's last line
- let l:ll = line('$')
-
- " Iterate over the lines
- while l:li <= l:ll
-
- " Get the line text
- let l:line = getline(l:li)
-
- " Replace the line with a subsitution of its text stripping extraneous
- " whitespace
- call setline(l:li, substitute(l:line, '\m\C\s\+$', '', 'g'))
-
- " If this line has any non-whitespace characters on it, update l:lw with
- " its index
- if l:line =~# '\m\S'
- let l:lw = l:li
- endif
-
- " Increment the line counter for the next iteration
- let l:li = l:li + 1
-
- endwhile
-
- " If the last non-whitespace line was before the last line proper, we can
- " delete all lines after it
- if l:lw < l:ll
-
- " Get the current line and column so we can return to it
- " (Yes I know about winsaveview() and winrestview(); I want this to work
- " even on very old versions of Vim if possible)
- let l:lc = line('.')
- let l:cc = col('.')
-
- " Delete the lines, which will move the cursor
- silent execute l:lw + 1 . ',$ delete'
-
- " Return the cursor to the saved position
- call cursor(l:lc, l:cc)
- endif
-
-endfunction
-
-" Create mapping proxy to the function just defined
-noremap <silent> <unique>
- \ <Plug>StripTrailingWhitespace
- \ :<C-U>call <SID>StripTrailingWhitespace()<CR>
-
-" Define a user command too, if we can
-if has('user_commands')
- command -nargs=0
- \ StripTrailingWhiteSpace
- \ call <SID>StripTrailingWhitespace()
-endif