nvim_conf 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +63 -7
- data/lib/nvim_conf/commenter.rb +23 -0
- data/lib/nvim_conf/configuration_builder.rb +2 -2
- data/lib/nvim_conf/core.rb +37 -18
- data/lib/nvim_conf/generators/code/commands/lua.rb +37 -0
- data/lib/nvim_conf/generators/code/globals/lua.rb +47 -0
- data/lib/nvim_conf/generators/code/mappings/lua.rb +43 -11
- data/lib/nvim_conf/generators/code/plugins/packer.rb +4 -16
- data/lib/nvim_conf/generators/code/plugins/paq.rb +57 -0
- data/lib/nvim_conf/generators/code/requires/lua.rb +23 -0
- data/lib/nvim_conf/generators/code/settings/lua.rb +34 -12
- data/lib/nvim_conf/managers/commands.rb +38 -0
- data/lib/nvim_conf/{compiler_configurations/manager.rb → managers/compiler_configurations.rb} +4 -4
- data/lib/nvim_conf/managers/globals.rb +46 -0
- data/lib/nvim_conf/{mappings/manager.rb → managers/mappings.rb} +23 -8
- data/lib/nvim_conf/{plugins/manager.rb → managers/plugins.rb} +13 -6
- data/lib/nvim_conf/managers/requires.rb +34 -0
- data/lib/nvim_conf/{settings/manager.rb → managers/settings.rb} +22 -6
- data/lib/nvim_conf/models/command.rb +15 -0
- data/lib/nvim_conf/{compiler_configurations → models}/compiler_configuration.rb +1 -1
- data/lib/nvim_conf/models/global.rb +12 -0
- data/lib/nvim_conf/{mappings → models}/mapping.rb +2 -1
- data/lib/nvim_conf/{plugins → models}/plugin.rb +6 -1
- data/lib/nvim_conf/models/require.rb +11 -0
- data/lib/nvim_conf/{settings → models}/setting.rb +1 -1
- data/lib/nvim_conf/utils/io_operator.rb +21 -0
- data/lib/nvim_conf/utils/markdown_formatter.rb +35 -0
- data/lib/nvim_conf/version.rb +1 -1
- data/lib/nvim_conf/writer.rb +1 -1
- data/lib/nvim_conf/writers/code/commands.rb +36 -0
- data/lib/nvim_conf/writers/code/globals.rb +36 -0
- data/lib/nvim_conf/writers/code/mappings.rb +0 -1
- data/lib/nvim_conf/writers/code/orchestrator.rb +31 -6
- data/lib/nvim_conf/writers/code/plugins/configuration.rb +25 -0
- data/lib/nvim_conf/writers/code/plugins/handler.rb +25 -0
- data/lib/nvim_conf/writers/code/plugins/packer.rb +94 -0
- data/lib/nvim_conf/writers/code/plugins/paq.rb +49 -0
- data/lib/nvim_conf/writers/code/requires.rb +36 -0
- data/lib/nvim_conf/writers/documentation/globals.rb +45 -0
- data/lib/nvim_conf/writers/documentation/mappings.rb +5 -18
- data/lib/nvim_conf/writers/documentation/orchestrator.rb +26 -7
- data/lib/nvim_conf/writers/documentation/plugins.rb +54 -0
- data/lib/nvim_conf/writers/documentation/settings.rb +11 -18
- data/lib/nvim_conf.rb +11 -6
- metadata +32 -13
- data/lib/nvim_conf/generators/generator.rb +0 -6
- data/lib/nvim_conf/manager.rb +0 -6
- data/lib/nvim_conf/writers/code/plugins.rb +0 -86
@@ -0,0 +1,94 @@
|
|
1
|
+
require "nvim_conf/models/plugin"
|
2
|
+
|
3
|
+
module NvimConf
|
4
|
+
module Writers
|
5
|
+
module Code
|
6
|
+
module Plugins
|
7
|
+
class Packer
|
8
|
+
BOOTSTRAP_HEADER = <<~BOOTSTRAP_HEADER
|
9
|
+
local fn = vim.fn
|
10
|
+
local install_path = fn.stdpath('data')..'/site/pack/packer/start/packer.nvim'
|
11
|
+
if fn.empty(fn.glob(install_path)) > 0 then
|
12
|
+
packer_bootstrap = fn.system({'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path})
|
13
|
+
end\n
|
14
|
+
BOOTSTRAP_HEADER
|
15
|
+
|
16
|
+
BOOTSTRAP_TAIL = <<~BOOTSTRAP_TAIL
|
17
|
+
if packer_bootstrap then
|
18
|
+
require('packer').sync()
|
19
|
+
end
|
20
|
+
BOOTSTRAP_TAIL
|
21
|
+
|
22
|
+
BLOCK_START = <<~START
|
23
|
+
require('packer').startup(function(use)\n
|
24
|
+
START
|
25
|
+
|
26
|
+
BLOCK_END = <<~END
|
27
|
+
end)
|
28
|
+
END
|
29
|
+
|
30
|
+
def initialize(manager, io, configuration)
|
31
|
+
@manager = manager
|
32
|
+
@io = io
|
33
|
+
@configuration = configuration
|
34
|
+
@plugins = install_self(manager.plugins)
|
35
|
+
end
|
36
|
+
|
37
|
+
def write
|
38
|
+
write_start_of_bootstrap
|
39
|
+
@io.write(
|
40
|
+
BLOCK_START
|
41
|
+
)
|
42
|
+
|
43
|
+
@plugins.each do |plugin|
|
44
|
+
@io.write(
|
45
|
+
"#{plugin_indent(@configuration[:generator].new(plugin).generate)}\n"
|
46
|
+
)
|
47
|
+
end
|
48
|
+
|
49
|
+
write_tail_of_bootstrap
|
50
|
+
|
51
|
+
@io.write(
|
52
|
+
BLOCK_END
|
53
|
+
)
|
54
|
+
end
|
55
|
+
|
56
|
+
private
|
57
|
+
|
58
|
+
def write_start_of_bootstrap
|
59
|
+
return unless bootstrap?
|
60
|
+
|
61
|
+
@io.write(
|
62
|
+
BOOTSTRAP_HEADER
|
63
|
+
)
|
64
|
+
end
|
65
|
+
|
66
|
+
def install_self(plugins)
|
67
|
+
[Models::Plugin.new("wbthomason/packer.nvim")] + plugins
|
68
|
+
end
|
69
|
+
|
70
|
+
def write_tail_of_bootstrap
|
71
|
+
return unless bootstrap?
|
72
|
+
|
73
|
+
@io.write("\n")
|
74
|
+
@io.write(
|
75
|
+
plugin_indent(BOOTSTRAP_TAIL)
|
76
|
+
)
|
77
|
+
@io.write("\n")
|
78
|
+
end
|
79
|
+
|
80
|
+
def bootstrap?
|
81
|
+
@manager.bootstraped
|
82
|
+
end
|
83
|
+
|
84
|
+
def plugin_indent(content)
|
85
|
+
[
|
86
|
+
" " * @configuration[:indent],
|
87
|
+
content
|
88
|
+
].join
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
module NvimConf
|
2
|
+
module Writers
|
3
|
+
module Code
|
4
|
+
module Plugins
|
5
|
+
class Paq
|
6
|
+
BLOCK_START = <<~START
|
7
|
+
require "paq" {
|
8
|
+
START
|
9
|
+
|
10
|
+
BLOCK_END = <<~END
|
11
|
+
}
|
12
|
+
END
|
13
|
+
|
14
|
+
def initialize(manager, io, configuration)
|
15
|
+
@manager = manager
|
16
|
+
@io = io
|
17
|
+
@configuration = configuration
|
18
|
+
@plugins = manager.plugins
|
19
|
+
end
|
20
|
+
|
21
|
+
def write
|
22
|
+
@io.write(
|
23
|
+
BLOCK_START
|
24
|
+
)
|
25
|
+
|
26
|
+
@plugins.each do |plugin|
|
27
|
+
@io.write(
|
28
|
+
"#{plugin_indent(@configuration[:generator].new(plugin).generate)}\n"
|
29
|
+
)
|
30
|
+
end
|
31
|
+
|
32
|
+
@io.write(
|
33
|
+
BLOCK_END
|
34
|
+
)
|
35
|
+
end
|
36
|
+
|
37
|
+
private
|
38
|
+
|
39
|
+
def plugin_indent(content)
|
40
|
+
[
|
41
|
+
" " * @configuration[:indent],
|
42
|
+
content
|
43
|
+
].join
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require "nvim_conf/generators/code/requires/lua"
|
2
|
+
|
3
|
+
module NvimConf
|
4
|
+
module Writers
|
5
|
+
module Code
|
6
|
+
class RequiresWriter
|
7
|
+
REQUIRE_GENERATOR_MAPPING = {
|
8
|
+
lua: Generators::Requires::Code::Lua
|
9
|
+
}
|
10
|
+
|
11
|
+
def initialize(manager, io, format: :lua, commented: false)
|
12
|
+
@manager = manager
|
13
|
+
@io = io
|
14
|
+
@format = format
|
15
|
+
end
|
16
|
+
|
17
|
+
def write
|
18
|
+
@manager.requires.each do |require|
|
19
|
+
@io.write(
|
20
|
+
[
|
21
|
+
generator_class.new(require).generate,
|
22
|
+
"\n"
|
23
|
+
].join
|
24
|
+
)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
private
|
29
|
+
|
30
|
+
def generator_class
|
31
|
+
REQUIRE_GENERATOR_MAPPING[@format]
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
module NvimConf
|
2
|
+
module Writers
|
3
|
+
module Documentation
|
4
|
+
class Globals
|
5
|
+
def initialize(managers, io)
|
6
|
+
@managers = managers
|
7
|
+
@io = io
|
8
|
+
end
|
9
|
+
|
10
|
+
def aggregate_writes
|
11
|
+
return if @managers.nil? || @managers.empty?
|
12
|
+
|
13
|
+
@io.write(
|
14
|
+
Utils::MarkdownFormatter.format_title(
|
15
|
+
"Globals",
|
16
|
+
level: 2
|
17
|
+
)
|
18
|
+
)
|
19
|
+
|
20
|
+
write_globals
|
21
|
+
end
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
def write_globals
|
26
|
+
@managers.map(&:globals).flatten.each do |global|
|
27
|
+
@io.write(
|
28
|
+
[
|
29
|
+
"- #{global.name}",
|
30
|
+
transformed_value(global.value)
|
31
|
+
].join(" => ") + "\n"
|
32
|
+
)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def transformed_value(value)
|
37
|
+
return value.join(", ") if value.is_a?(Array)
|
38
|
+
return value unless value.nil?
|
39
|
+
|
40
|
+
value
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -2,9 +2,6 @@ module NvimConf
|
|
2
2
|
module Writers
|
3
3
|
module Documentation
|
4
4
|
class Mappings
|
5
|
-
MAIN_HEADER_PREFIX = "##"
|
6
|
-
MAPPING_HEADER_PREFIX = "###"
|
7
|
-
|
8
5
|
def initialize(managers, io)
|
9
6
|
@managers = managers
|
10
7
|
@io = io
|
@@ -14,9 +11,9 @@ module NvimConf
|
|
14
11
|
return if @managers.empty?
|
15
12
|
|
16
13
|
@io.write(
|
17
|
-
|
14
|
+
Utils::MarkdownFormatter.format_title(
|
18
15
|
"Mappings",
|
19
|
-
|
16
|
+
level: 2
|
20
17
|
)
|
21
18
|
)
|
22
19
|
|
@@ -27,12 +24,12 @@ module NvimConf
|
|
27
24
|
|
28
25
|
def write_mappings(grouped_mappings)
|
29
26
|
grouped_mappings.each do |operator, mappings|
|
30
|
-
write_separator
|
27
|
+
@io.write_separator
|
31
28
|
|
32
29
|
@io.write(
|
33
|
-
|
30
|
+
Utils::MarkdownFormatter.format_title(
|
34
31
|
operator,
|
35
|
-
|
32
|
+
level: 3
|
36
33
|
)
|
37
34
|
)
|
38
35
|
|
@@ -50,16 +47,6 @@ module NvimConf
|
|
50
47
|
def all_mappings
|
51
48
|
@managers.map(&:mappings).flatten
|
52
49
|
end
|
53
|
-
|
54
|
-
def write_separator
|
55
|
-
@io.write(
|
56
|
-
"\n\n"
|
57
|
-
)
|
58
|
-
end
|
59
|
-
|
60
|
-
def title(text, prefix)
|
61
|
-
"#{prefix} #{text}\n"
|
62
|
-
end
|
63
50
|
end
|
64
51
|
end
|
65
52
|
end
|
@@ -1,11 +1,13 @@
|
|
1
1
|
require "nvim_conf/writers/documentation/mappings"
|
2
|
+
require "nvim_conf/writers/documentation/globals"
|
2
3
|
require "nvim_conf/writers/documentation/settings"
|
4
|
+
require "nvim_conf/writers/documentation/plugins"
|
3
5
|
|
4
6
|
module NvimConf
|
5
7
|
module Writers
|
6
8
|
module Documentation
|
7
9
|
class Orchestrator
|
8
|
-
NON_WRITABLE_MANAGER = NvimConf::CompilerConfigurations
|
10
|
+
NON_WRITABLE_MANAGER = NvimConf::Managers::CompilerConfigurations
|
9
11
|
|
10
12
|
def initialize(managers, io, configuration = nil)
|
11
13
|
@managers = managers
|
@@ -18,16 +20,33 @@ module NvimConf
|
|
18
20
|
|
19
21
|
write_main_header
|
20
22
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
23
|
+
writers = [
|
24
|
+
[
|
25
|
+
NvimConf::Writers::Documentation::Settings, NvimConf::Managers::Settings
|
26
|
+
],
|
27
|
+
[
|
28
|
+
NvimConf::Writers::Documentation::Mappings, NvimConf::Managers::Mappings
|
29
|
+
],
|
30
|
+
[
|
31
|
+
NvimConf::Writers::Documentation::Plugins, NvimConf::Managers::Plugins
|
32
|
+
],
|
33
|
+
[
|
34
|
+
NvimConf::Writers::Documentation::Globals, NvimConf::Managers::Globals
|
35
|
+
]
|
36
|
+
]
|
37
|
+
|
38
|
+
writers.each_with_index do |relevant_classes, index|
|
39
|
+
writer_class, manager_class = *relevant_classes
|
40
|
+
managers = @managers.select { |manager| manager.instance_of?(manager_class) }
|
41
|
+
|
42
|
+
next if managers.length.zero?
|
43
|
+
|
25
44
|
writer_class.new(
|
26
|
-
|
45
|
+
managers,
|
27
46
|
@io
|
28
47
|
).aggregate_writes
|
29
48
|
|
30
|
-
@io.write("\n\n")
|
49
|
+
@io.write("\n\n") if index != (writers.length - 1)
|
31
50
|
end
|
32
51
|
end
|
33
52
|
|
@@ -0,0 +1,54 @@
|
|
1
|
+
module NvimConf
|
2
|
+
module Writers
|
3
|
+
module Documentation
|
4
|
+
class Plugins
|
5
|
+
def initialize(managers, io)
|
6
|
+
@managers = managers
|
7
|
+
@io = io
|
8
|
+
end
|
9
|
+
|
10
|
+
def aggregate_writes
|
11
|
+
return if @managers.empty?
|
12
|
+
|
13
|
+
@io.write(
|
14
|
+
Utils::MarkdownFormatter.format_title(
|
15
|
+
"Plugins",
|
16
|
+
level: 2
|
17
|
+
)
|
18
|
+
)
|
19
|
+
|
20
|
+
write_plugins
|
21
|
+
end
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
def write_plugins
|
26
|
+
@managers.each do |manager|
|
27
|
+
@io.write(
|
28
|
+
Utils::MarkdownFormatter.format_title(
|
29
|
+
manager.name.capitalize,
|
30
|
+
level: 3
|
31
|
+
)
|
32
|
+
)
|
33
|
+
|
34
|
+
manager.plugins.each do |plugin|
|
35
|
+
@io.write(
|
36
|
+
Utils::MarkdownFormatter.collapisible(
|
37
|
+
plugin.name,
|
38
|
+
plugin_url(plugin.name)
|
39
|
+
)
|
40
|
+
)
|
41
|
+
@io.write("\n")
|
42
|
+
end
|
43
|
+
|
44
|
+
@io.write_separator
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
def plugin_url(name)
|
49
|
+
"https://github.com/#{name}"
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
@@ -2,8 +2,6 @@ module NvimConf
|
|
2
2
|
module Writers
|
3
3
|
module Documentation
|
4
4
|
class Settings
|
5
|
-
MAIN_HEADER_PREFIX = "##"
|
6
|
-
|
7
5
|
def initialize(managers, io)
|
8
6
|
@managers = managers
|
9
7
|
@io = io
|
@@ -13,9 +11,9 @@ module NvimConf
|
|
13
11
|
return if @managers.empty?
|
14
12
|
|
15
13
|
@io.write(
|
16
|
-
|
14
|
+
Utils::MarkdownFormatter.format_title(
|
17
15
|
"Settings",
|
18
|
-
|
16
|
+
level: 2
|
19
17
|
)
|
20
18
|
)
|
21
19
|
|
@@ -26,12 +24,12 @@ module NvimConf
|
|
26
24
|
|
27
25
|
def write_settings_groups(groups)
|
28
26
|
groups.each do |operation, settings|
|
29
|
-
write_separator
|
27
|
+
@io.write_separator
|
30
28
|
|
31
29
|
@io.write(
|
32
|
-
|
30
|
+
Utils::MarkdownFormatter.format_title(
|
33
31
|
operation.capitalize,
|
34
|
-
|
32
|
+
level: 3
|
35
33
|
)
|
36
34
|
)
|
37
35
|
|
@@ -40,13 +38,18 @@ module NvimConf
|
|
40
38
|
[
|
41
39
|
"- #{setting.key}",
|
42
40
|
transformed_value(setting, setting.value)
|
43
|
-
].join(
|
41
|
+
].join(operator(setting)) + "\n"
|
44
42
|
)
|
45
43
|
end
|
46
44
|
end
|
47
45
|
end
|
48
46
|
|
47
|
+
def operator(setting)
|
48
|
+
%i[set unset].include?(setting.operation) ? " => " : " += "
|
49
|
+
end
|
50
|
+
|
49
51
|
def transformed_value(setting, value)
|
52
|
+
return value.join(", ") if value.is_a?(Array)
|
50
53
|
return value unless value.nil?
|
51
54
|
|
52
55
|
setting.operation == :set
|
@@ -55,16 +58,6 @@ module NvimConf
|
|
55
58
|
def all_settings
|
56
59
|
@managers.map(&:settings).flatten
|
57
60
|
end
|
58
|
-
|
59
|
-
def write_separator
|
60
|
-
@io.write(
|
61
|
-
"\n\n"
|
62
|
-
)
|
63
|
-
end
|
64
|
-
|
65
|
-
def title(text, prefix)
|
66
|
-
"#{prefix} #{text}\n"
|
67
|
-
end
|
68
61
|
end
|
69
62
|
end
|
70
63
|
end
|
data/lib/nvim_conf.rb
CHANGED
@@ -1,17 +1,22 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require "nvim_conf/version"
|
4
|
-
require "set"
|
5
4
|
require "nvim_conf/core"
|
6
5
|
require "nvim_conf/writer"
|
7
|
-
require "nvim_conf/
|
6
|
+
require "nvim_conf/commenter"
|
8
7
|
require "nvim_conf/configuration_builder"
|
9
|
-
require "nvim_conf/plugins
|
10
|
-
require "nvim_conf/settings
|
11
|
-
require "nvim_conf/mappings
|
12
|
-
require "nvim_conf/
|
8
|
+
require "nvim_conf/managers/plugins"
|
9
|
+
require "nvim_conf/managers/settings"
|
10
|
+
require "nvim_conf/managers/mappings"
|
11
|
+
require "nvim_conf/managers/requires"
|
12
|
+
require "nvim_conf/managers/globals"
|
13
|
+
require "nvim_conf/managers/commands"
|
14
|
+
require "nvim_conf/managers/compiler_configurations"
|
15
|
+
require "nvim_conf/utils/markdown_formatter"
|
16
|
+
require "nvim_conf/utils/io_operator"
|
13
17
|
require "nvim_conf/generators/code/settings/lua"
|
14
18
|
require "nvim_conf/generators/code/plugins/packer"
|
19
|
+
require "nvim_conf/generators/code/plugins/paq"
|
15
20
|
require "nvim_conf/generators/code/settings/vim"
|
16
21
|
require "nvim_conf/generators/code/mappings/lua"
|
17
22
|
require "nvim_conf/generators/code/mappings/vim"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nvim_conf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Liberatys
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-12-
|
11
|
+
date: 2021-12-28 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: A ruby dsl to generate a nvim configuration
|
14
14
|
email:
|
@@ -22,31 +22,50 @@ files:
|
|
22
22
|
- README.md
|
23
23
|
- bin/nvim_conf
|
24
24
|
- lib/nvim_conf.rb
|
25
|
-
- lib/nvim_conf/
|
26
|
-
- lib/nvim_conf/compiler_configurations/manager.rb
|
25
|
+
- lib/nvim_conf/commenter.rb
|
27
26
|
- lib/nvim_conf/configuration_builder.rb
|
28
27
|
- lib/nvim_conf/core.rb
|
28
|
+
- lib/nvim_conf/generators/code/commands/lua.rb
|
29
|
+
- lib/nvim_conf/generators/code/globals/lua.rb
|
29
30
|
- lib/nvim_conf/generators/code/mappings/lua.rb
|
30
31
|
- lib/nvim_conf/generators/code/mappings/vim.rb
|
31
32
|
- lib/nvim_conf/generators/code/plugins/packer.rb
|
33
|
+
- lib/nvim_conf/generators/code/plugins/paq.rb
|
34
|
+
- lib/nvim_conf/generators/code/requires/lua.rb
|
32
35
|
- lib/nvim_conf/generators/code/settings/lua.rb
|
33
36
|
- lib/nvim_conf/generators/code/settings/vim.rb
|
34
|
-
- lib/nvim_conf/
|
35
|
-
- lib/nvim_conf/
|
36
|
-
- lib/nvim_conf/
|
37
|
-
- lib/nvim_conf/mappings
|
38
|
-
- lib/nvim_conf/plugins
|
39
|
-
- lib/nvim_conf/
|
40
|
-
- lib/nvim_conf/settings
|
41
|
-
- lib/nvim_conf/
|
37
|
+
- lib/nvim_conf/managers/commands.rb
|
38
|
+
- lib/nvim_conf/managers/compiler_configurations.rb
|
39
|
+
- lib/nvim_conf/managers/globals.rb
|
40
|
+
- lib/nvim_conf/managers/mappings.rb
|
41
|
+
- lib/nvim_conf/managers/plugins.rb
|
42
|
+
- lib/nvim_conf/managers/requires.rb
|
43
|
+
- lib/nvim_conf/managers/settings.rb
|
44
|
+
- lib/nvim_conf/models/command.rb
|
45
|
+
- lib/nvim_conf/models/compiler_configuration.rb
|
46
|
+
- lib/nvim_conf/models/global.rb
|
47
|
+
- lib/nvim_conf/models/mapping.rb
|
48
|
+
- lib/nvim_conf/models/plugin.rb
|
49
|
+
- lib/nvim_conf/models/require.rb
|
50
|
+
- lib/nvim_conf/models/setting.rb
|
51
|
+
- lib/nvim_conf/utils/io_operator.rb
|
52
|
+
- lib/nvim_conf/utils/markdown_formatter.rb
|
42
53
|
- lib/nvim_conf/version.rb
|
43
54
|
- lib/nvim_conf/writer.rb
|
55
|
+
- lib/nvim_conf/writers/code/commands.rb
|
56
|
+
- lib/nvim_conf/writers/code/globals.rb
|
44
57
|
- lib/nvim_conf/writers/code/mappings.rb
|
45
58
|
- lib/nvim_conf/writers/code/orchestrator.rb
|
46
|
-
- lib/nvim_conf/writers/code/plugins.rb
|
59
|
+
- lib/nvim_conf/writers/code/plugins/configuration.rb
|
60
|
+
- lib/nvim_conf/writers/code/plugins/handler.rb
|
61
|
+
- lib/nvim_conf/writers/code/plugins/packer.rb
|
62
|
+
- lib/nvim_conf/writers/code/plugins/paq.rb
|
63
|
+
- lib/nvim_conf/writers/code/requires.rb
|
47
64
|
- lib/nvim_conf/writers/code/settings.rb
|
65
|
+
- lib/nvim_conf/writers/documentation/globals.rb
|
48
66
|
- lib/nvim_conf/writers/documentation/mappings.rb
|
49
67
|
- lib/nvim_conf/writers/documentation/orchestrator.rb
|
68
|
+
- lib/nvim_conf/writers/documentation/plugins.rb
|
50
69
|
- lib/nvim_conf/writers/documentation/settings.rb
|
51
70
|
homepage: https://github.com/Liberatys/nvim_conf
|
52
71
|
licenses:
|
data/lib/nvim_conf/manager.rb
DELETED
@@ -1,86 +0,0 @@
|
|
1
|
-
# TODO: This code needs to be refactored.... Bad CODE :D will be done during the addition of the second plugin manager!
|
2
|
-
module NvimConf
|
3
|
-
module Writers
|
4
|
-
module Code
|
5
|
-
class PluginsWriter
|
6
|
-
PLUGIN_MAP = {
|
7
|
-
packer: NvimConf::Generators::Plugins::Code::Packer
|
8
|
-
}
|
9
|
-
|
10
|
-
INDENT_MAP = {
|
11
|
-
packer: 2
|
12
|
-
}
|
13
|
-
|
14
|
-
def initialize(manager, io, _params)
|
15
|
-
@manager = manager
|
16
|
-
@io = io
|
17
|
-
end
|
18
|
-
|
19
|
-
def write
|
20
|
-
send("surround_#{@manager.name}") do |plugin|
|
21
|
-
@io.write(
|
22
|
-
[
|
23
|
-
plugin_indent(PLUGIN_MAP[@manager.name.to_sym].new(
|
24
|
-
plugin
|
25
|
-
).generate),
|
26
|
-
"\n"
|
27
|
-
].join
|
28
|
-
)
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
private
|
33
|
-
|
34
|
-
def surround_packer(&block)
|
35
|
-
if bootstrap?
|
36
|
-
@io.write(
|
37
|
-
<<~BOOTSTRAP
|
38
|
-
local fn = vim.fn
|
39
|
-
local install_path = fn.stdpath('data')..'/site/pack/packer/start/packer.nvim'
|
40
|
-
if fn.empty(fn.glob(install_path)) > 0 then
|
41
|
-
packer_bootstrap = fn.system({'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path})
|
42
|
-
end\n
|
43
|
-
BOOTSTRAP
|
44
|
-
)
|
45
|
-
end
|
46
|
-
|
47
|
-
@io.write(
|
48
|
-
"return require('packer').startup(function()\n"
|
49
|
-
)
|
50
|
-
|
51
|
-
@manager.plugins.each(&block)
|
52
|
-
|
53
|
-
if bootstrap?
|
54
|
-
@io.write("\n")
|
55
|
-
@io.write(plugin_indent(
|
56
|
-
<<~BOOTSTRAP
|
57
|
-
if packer_bootstrap then
|
58
|
-
require('packer').sync()
|
59
|
-
end\n
|
60
|
-
BOOTSTRAP
|
61
|
-
))
|
62
|
-
end
|
63
|
-
|
64
|
-
@io.write(
|
65
|
-
"end)\n"
|
66
|
-
)
|
67
|
-
end
|
68
|
-
|
69
|
-
def bootstrap?
|
70
|
-
@manager.bootstraped
|
71
|
-
end
|
72
|
-
|
73
|
-
def plugin_indent(content)
|
74
|
-
[
|
75
|
-
" " * INDENT_MAP[@manager.name.to_sym],
|
76
|
-
content
|
77
|
-
].join
|
78
|
-
end
|
79
|
-
|
80
|
-
def generator_class
|
81
|
-
PLUGIN_MAP[@manager.name.to_sym]
|
82
|
-
end
|
83
|
-
end
|
84
|
-
end
|
85
|
-
end
|
86
|
-
end
|