/usr/lib/vim-command-t/ruby/command-t/settings.rb is in vim-command-t 4.0-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 | # Copyright 2010-present Greg Hurrell. All rights reserved.
# Licensed under the terms of the BSD 2-clause license.
module CommandT
# Convenience class for saving and restoring global settings.
class Settings
# Settings which apply globally and so must be manually saved and restored
GLOBAL_SETTINGS = %w[
equalalways
hlsearch
insertmode
report
showcmd
scrolloff
sidescroll
sidescrolloff
timeout
timeoutlen
updatetime
]
# Settings which can be made locally to the Command-T buffer or window
LOCAL_SETTINGS = %w[
bufhidden
buflisted
buftype
colorcolumn
concealcursor
conceallevel
cursorline
filetype
foldcolumn
foldlevel
list
modifiable
number
readonly
relativenumber
spell
swapfile
synmaxcol
textwidth
wrap
]
KNOWN_SETTINGS = GLOBAL_SETTINGS + LOCAL_SETTINGS
def initialize
@settings = []
end
def set(setting, value)
raise "Unknown setting #{setting}" unless KNOWN_SETTINGS.include?(setting)
case value
when TrueClass, FalseClass
@settings.push([setting, VIM::get_bool("&#{setting}")]) if global?(setting)
set_bool setting, value
when Numeric
@settings.push([setting, VIM::get_number("&#{setting}")]) if global?(setting)
set_number setting, value
when String
@settings.push([setting, VIM::get_string("&#{setting}")]) if global?(setting)
set_string setting, value
end
end
def restore
@settings.each do |setting, value|
case value
when TrueClass, FalseClass
set_bool setting, value
when Numeric
set_number setting, value
when String
set_string setting, value
end
end
end
private
def global?(setting)
GLOBAL_SETTINGS.include?(setting)
end
def set_bool(setting, value)
command = global?(setting) ? 'set' : 'setlocal'
setting = value ? setting : "no#{setting}"
::VIM::command "#{command} #{setting}"
end
def set_number(setting, value)
command = global?(setting) ? 'set' : 'setlocal'
::VIM::command "#{command} #{setting}=#{value}"
end
alias set_string set_number
end
end
|