diff options
Diffstat (limited to 'vim')
-rw-r--r-- | vim/mini.lua | 177 |
1 files changed, 177 insertions, 0 deletions
diff --git a/vim/mini.lua b/vim/mini.lua new file mode 100644 index 0000000..1f4ee45 --- /dev/null +++ b/vim/mini.lua | |||
@@ -0,0 +1,177 @@ | |||
1 | -- vim: foldmethod=marker foldmarker={{{,}}} | ||
2 | |||
3 | -- Install mini.nvim -{{{ | ||
4 | -- Put this at the top of 'init.lua' | ||
5 | local path_package = vim.fn.stdpath('data') .. '/site' | ||
6 | vim.o.packpath=path_package | ||
7 | local mini_path = path_package .. '/pack/deps/start/mini.nvim' | ||
8 | if not vim.loop.fs_stat(mini_path) then | ||
9 | vim.cmd('echo "Installing `mini.nvim`" | redraw') | ||
10 | local clone_cmd = { | ||
11 | 'git', 'clone', '--filter=blob:none', | ||
12 | -- Uncomment next line to use 'stable' branch | ||
13 | -- '--branch', 'stable', | ||
14 | 'https://github.com/echasnovski/mini.nvim', mini_path | ||
15 | } | ||
16 | vim.fn.system(clone_cmd) | ||
17 | vim.cmd('packadd mini.nvim | helptags ALL') | ||
18 | end | ||
19 | -- }}} | ||
20 | require('mini.base16').setup({ --{{{ | ||
21 | palette = { | ||
22 | -- Default Background | ||
23 | base00 = "#2d2a2e", | ||
24 | -- Lighter Background (Used for status bars, line number and folding marks) | ||
25 | base01 = "#37343a", | ||
26 | -- Selection Background | ||
27 | base02 = "#423f46", | ||
28 | -- Comments, Invisible, Line Highlighting | ||
29 | base03 = "#848089", | ||
30 | -- Dark Foreground (Used for status bars) | ||
31 | base04 = "#66d9ef", | ||
32 | -- Default Foreground, Caret, Delimiters, Operators | ||
33 | base05 = "#e3e1e4", | ||
34 | -- Light Foreground (Not often used) | ||
35 | base06 = "#a1efe4", | ||
36 | -- Light Background (Not often used) | ||
37 | base07 = "#f8f8f2", | ||
38 | -- Variables, XML Tags, Markup Link Text, Markup Lists, Diff Deleted | ||
39 | base08 = "#f85e84", | ||
40 | -- Integers, Boolean, Constants, XML Attributes, Markup Link Url | ||
41 | base09 = "#ef9062", | ||
42 | -- Classes, Markup Bold, Search Text Background | ||
43 | base0A = "#a6e22e", | ||
44 | -- Strings, Inherited Class, Markup Code, Diff Inserted | ||
45 | base0B = "#e5c463", | ||
46 | -- Support, Regular Expressions, Escape Characters, Markup Quotes | ||
47 | base0C = "#66d9ef", | ||
48 | -- Functions, Methods, Attribute IDs, Headings | ||
49 | base0D = "#9ecd6f", | ||
50 | -- Keywords, Storage, Selector, Markup Italic, Diff Changed | ||
51 | base0E = "#a1efe4", | ||
52 | -- Deprecated, Opening/Closing Embedded Language Tags, e.g. <?php ?> | ||
53 | base0F = "#f9f8f5", | ||
54 | }, | ||
55 | use_cterm = true, | ||
56 | }) --}}} | ||
57 | require('mini.misc').setup({ --{{{ | ||
58 | make_global = { 'put', 'put_text', 'zoom'} | ||
59 | }) --}}} | ||
60 | require('mini.statusline').setup({--{{{ | ||
61 | content = { | ||
62 | active = status_config | ||
63 | }, | ||
64 | }) | ||
65 | function diagnostics_table(args) | ||
66 | local info = vim.b.coc_diagnostic_info | ||
67 | if MiniStatusline.is_truncated(args.trunc_width) or info == nil then | ||
68 | return {} | ||
69 | end | ||
70 | local table = {} | ||
71 | table.e = (info['error'] or 0) > 0 and 'E'..info['error'] or '' | ||
72 | table.w = (info['warning'] or 0) > 0 and 'W'..info['warning'] or '' | ||
73 | table.h = (info['hint'] or 0) > 0 and 'H'..info['hint'] or '' | ||
74 | table.i = (info['information'] or 0) > 0 and 'I'..info['information'] or '' | ||
75 | table.s = vim.g.coc_status | ||
76 | return table | ||
77 | end | ||
78 | function status_config() | ||
79 | local mode, mode_hl = MiniStatusline.section_mode({ trunc_width = 120 }) | ||
80 | local git = MiniStatusline.section_git({ trunc_width = 75 }) | ||
81 | local diagnostics = diagnostics_table({ trunc_width = 75 }) | ||
82 | local filename = MiniStatusline.section_filename({ trunc_width = 140 }) | ||
83 | local fileinfo = MiniStatusline.section_fileinfo({ trunc_width = 120 }) | ||
84 | local location = MiniStatusline.section_location({ trunc_width = 75 }) | ||
85 | |||
86 | return MiniStatusline.combine_groups({ | ||
87 | { hl = mode_hl, strings = { mode } }, | ||
88 | { hl = 'MiniStatuslineDevinfo', strings = { git, diagnostics['s'] } }, | ||
89 | { hl = 'MiniStatuslineError', strings = { diagnostics['e'] } }, | ||
90 | { hl = 'MiniStatuslineWarning', strings = { diagnostics['w'] } }, | ||
91 | { hl = 'MiniStatuslineInfo', strings = { diagnostics['i'] } }, | ||
92 | { hl = 'MiniStatuslineHint', strings = { diagnostics['h'] } }, | ||
93 | '%<', -- Mark general truncate point | ||
94 | { hl = 'MiniStatuslineFilename', strings = { filename } }, | ||
95 | '%=', -- End left alignment | ||
96 | { hl = 'MiniStatuslineFileinfo', strings = { fileinfo } }, | ||
97 | { hl = mode_hl, strings = { location } }, | ||
98 | }) | ||
99 | end | ||
100 | -- }}} | ||
101 | require('mini.animate').setup()--{{{ | ||
102 | -- }}} | ||
103 | require('mini.basics').setup()--{{{ | ||
104 | -- }}} | ||
105 | -- require('mini.bufremove').setup() --{{{ | ||
106 | --}}} | ||
107 | require('mini.clue') --{{{ | ||
108 | local miniclue = require('mini.clue') | ||
109 | miniclue.setup({ | ||
110 | triggers = { | ||
111 | -- Leader triggers | ||
112 | { mode = 'n', keys = '<Leader>' }, | ||
113 | { mode = 'x', keys = '<Leader>' }, | ||
114 | |||
115 | -- Built-in completion | ||
116 | { mode = 'i', keys = '<C-x>' }, | ||
117 | |||
118 | -- `g` key | ||
119 | { mode = 'n', keys = 'g' }, | ||
120 | { mode = 'x', keys = 'g' }, | ||
121 | |||
122 | -- Marks | ||
123 | { mode = 'n', keys = "'" }, | ||
124 | { mode = 'n', keys = '`' }, | ||
125 | { mode = 'x', keys = "'" }, | ||
126 | { mode = 'x', keys = '`' }, | ||
127 | |||
128 | -- Registers | ||
129 | { mode = 'n', keys = '"' }, | ||
130 | { mode = 'x', keys = '"' }, | ||
131 | { mode = 'i', keys = '<C-r>' }, | ||
132 | { mode = 'c', keys = '<C-r>' }, | ||
133 | |||
134 | -- Window commands | ||
135 | { mode = 'n', keys = '<C-w>' }, | ||
136 | |||
137 | -- `z` key | ||
138 | { mode = 'n', keys = 'z' }, | ||
139 | { mode = 'x', keys = 'z' }, | ||
140 | }, | ||
141 | |||
142 | clues = { | ||
143 | -- Enhance this by adding descriptions for <Leader> mapping groups | ||
144 | miniclue.gen_clues.builtin_completion(), | ||
145 | miniclue.gen_clues.g(), | ||
146 | miniclue.gen_clues.marks(), | ||
147 | miniclue.gen_clues.registers(), | ||
148 | miniclue.gen_clues.windows(), | ||
149 | miniclue.gen_clues.z(), | ||
150 | }, | ||
151 | })-- }}} | ||
152 | require('mini.colors').setup()-- {{{ | ||
153 | -- }}} | ||
154 | require('mini.comment').setup({-- {{{ | ||
155 | -- Module mappings. Use `''` (empty string) to disable one. | ||
156 | mappings = { | ||
157 | -- Toggle comment (like `gcip` - comment inner paragraph) for both | ||
158 | -- Normal and Visual modes | ||
159 | comment = 'gc', | ||
160 | |||
161 | -- Toggle comment on current line | ||
162 | comment_line = '<C-/>', | ||
163 | |||
164 | -- Toggle comment on visual selection | ||
165 | comment_visual = '<C-/>', | ||
166 | |||
167 | -- Define 'comment' textobject (like `dgc` - delete whole comment block) | ||
168 | -- Works also in Visual mode if mapping differs from `comment_visual` | ||
169 | textobject = 'gc', | ||
170 | }, | ||
171 | })-- }}} | ||
172 | require('mini.cursorword').setup()-- {{{ | ||
173 | -- }}} | ||
174 | require('mini.cursorword').setup()-- {{{ | ||
175 | -- }}} | ||
176 | require('mini.diff').setup()-- {{{ | ||
177 | -- }}} | ||