Compare commits
2 Commits
helpgrep
...
b0cfb31645
| Author | SHA1 | Date | |
|---|---|---|---|
| b0cfb31645 | |||
|
|
aba1664d09 |
@@ -75,7 +75,7 @@ local function special(group, name, title)
|
||||
end
|
||||
|
||||
-- Construct a statusline for generic buffer types.
|
||||
local function generic(group, name, show_lsp)
|
||||
local function generic(group, name)
|
||||
-- Display current mode with dynamic highlights.
|
||||
local line = '%#' .. group .. '# ' .. name .. ' '
|
||||
-- Display spell or paste if set with dusk highlights in a group to swallow
|
||||
@@ -131,11 +131,11 @@ function _G.statusline_active()
|
||||
return special('StatusLineLight', 'Terminal', '%f')
|
||||
elseif vim.o.previewwindow then
|
||||
if mode == 'Normal' then mode = 'Preview' end
|
||||
return generic('StatusLineLight', mode, false)
|
||||
return generic('StatusLineLight', mode)
|
||||
elseif vim.o.filetype == 'man' then
|
||||
return special('StatusLineDusk', 'Manual', '%f')
|
||||
end
|
||||
return generic('StatusLineLight', mode, true)
|
||||
return generic('StatusLineLight', mode)
|
||||
end
|
||||
|
||||
function _G.statusline_inactive()
|
||||
@@ -152,11 +152,11 @@ function _G.statusline_inactive()
|
||||
elseif vim.o.buftype == 'terminal' then
|
||||
line = special('StatusLineDusk', 'Terminal', '%f')
|
||||
elseif vim.o.previewwindow then
|
||||
line = generic('StatusLineDusk', 'Preview', false)
|
||||
line = generic('StatusLineDusk', 'Preview')
|
||||
elseif vim.o.filetype == 'man' then
|
||||
line = special('StatusLineDusk', 'Manual', '%f')
|
||||
else
|
||||
line = generic('StatusLineDusk', 'Idle', false)
|
||||
line = generic('StatusLineDusk', 'Idle')
|
||||
end
|
||||
return line
|
||||
end
|
||||
|
||||
59
snippets/go.lua
Normal file
59
snippets/go.lua
Normal file
@@ -0,0 +1,59 @@
|
||||
# Go LuaSnip Snippets
|
||||
|
||||
local luasnip = require('luasnip')
|
||||
local snip = luasnip.snippet
|
||||
local text = luasnip.text_node
|
||||
local ins = luasnip.insert_node
|
||||
local func = luasnip.function_node
|
||||
local node = luasnip.snippet_node
|
||||
local key = require("luasnip.nodes.key_indexer").new_key
|
||||
|
||||
local function short_name(name)
|
||||
local short = string.lower(string.sub(name, 1, 1))
|
||||
for i = 2, #name do
|
||||
local char = string.sub(name, i, i)
|
||||
if char == string.upper(char) then
|
||||
short = short .. char
|
||||
end
|
||||
end
|
||||
return string.lower(short)
|
||||
end
|
||||
|
||||
local snippets = {
|
||||
|
||||
snip('func', {
|
||||
text('func '),
|
||||
node(1, {
|
||||
func(function(args)
|
||||
if string.len(args[1][1]) > 0 then
|
||||
return '(' .. short_name(args[1][1]) .. ' *'
|
||||
end
|
||||
return ''
|
||||
end, key('type')),
|
||||
ins(1, '', { key = 'type' }),
|
||||
func(function(args)
|
||||
if string.len(args[1][1]) > 0 then
|
||||
return ') '
|
||||
end
|
||||
return ''
|
||||
end, key('type')),
|
||||
}),
|
||||
ins(2, 'name'),
|
||||
text('('),
|
||||
ins(3, ''),
|
||||
text(') '),
|
||||
ins(4, '', { key = 'return' }),
|
||||
func(function(args)
|
||||
if string.len(args[1][1]) > 0 then
|
||||
return ' '
|
||||
end
|
||||
return ''
|
||||
end, key('return')),
|
||||
text({ '{', '\t' }),
|
||||
ins(0, ''),
|
||||
text({ '', '}' }),
|
||||
}),
|
||||
|
||||
}
|
||||
|
||||
return snippets
|
||||
Reference in New Issue
Block a user