mirror of
https://github.com/halfdan/dotfiles.git
synced 2025-09-10 19:56:24 +00:00
Migrate plugins from Plug to packer
This commit is contained in:
231
.config/nvim/lua/plugins/galaxyline.lua
Normal file
231
.config/nvim/lua/plugins/galaxyline.lua
Normal file
@@ -0,0 +1,231 @@
|
||||
local vim = vim
|
||||
local gl = require('galaxyline')
|
||||
local utils = require('utils')
|
||||
|
||||
local gls = gl.section
|
||||
gl.short_line_list = { 'defx', 'packager', 'vista' }
|
||||
|
||||
-- Colors
|
||||
local colors = {
|
||||
bg = '#282a36',
|
||||
fg = '#f8f8f2',
|
||||
section_bg = '#38393f',
|
||||
yellow = '#f1fa8c',
|
||||
cyan = '#8be9fd',
|
||||
green = '#50fa7b',
|
||||
orange = '#ffb86c',
|
||||
magenta = '#ff79c6',
|
||||
blue = '#8be9fd',
|
||||
red = '#ff5555'
|
||||
}
|
||||
|
||||
-- Local helper functions
|
||||
local buffer_not_empty = function()
|
||||
return not utils.is_buffer_empty()
|
||||
end
|
||||
|
||||
local in_git_repo = function ()
|
||||
local vcs = require('galaxyline.provider_vcs')
|
||||
local branch_name = vcs.get_git_branch()
|
||||
|
||||
return branch_name ~= nil
|
||||
end
|
||||
|
||||
local checkwidth = function()
|
||||
return utils.has_width_gt(40) and in_git_repo()
|
||||
end
|
||||
|
||||
local mode_color = function()
|
||||
local mode_colors = {
|
||||
n = colors.cyan,
|
||||
i = colors.green,
|
||||
c = colors.orange,
|
||||
V = colors.magenta,
|
||||
[''] = colors.magenta,
|
||||
v = colors.magenta,
|
||||
R = colors.red,
|
||||
}
|
||||
|
||||
local color = mode_colors[vim.fn.mode()]
|
||||
|
||||
if color == nil then
|
||||
color = colors.red
|
||||
end
|
||||
|
||||
return color
|
||||
end
|
||||
|
||||
-- Left side
|
||||
gls.left[1] = {
|
||||
FirstElement = {
|
||||
provider = function() return '▋' end,
|
||||
highlight = { colors.cyan, colors.section_bg }
|
||||
},
|
||||
}
|
||||
gls.left[2] = {
|
||||
ViMode = {
|
||||
provider = function()
|
||||
local alias = {
|
||||
n = 'NORMAL',
|
||||
i = 'INSERT',
|
||||
c = 'COMMAND',
|
||||
V = 'VISUAL',
|
||||
[''] = 'VISUAL',
|
||||
v = 'VISUAL',
|
||||
R = 'REPLACE',
|
||||
}
|
||||
vim.api.nvim_command('hi GalaxyViMode guifg='..mode_color())
|
||||
local alias_mode = alias[vim.fn.mode()]
|
||||
if alias_mode == nil then
|
||||
alias_mode = vim.fn.mode()
|
||||
end
|
||||
return alias_mode..' '
|
||||
end,
|
||||
highlight = { colors.bg, colors.bg },
|
||||
separator = " ",
|
||||
separator_highlight = {colors.bg, colors.section_bg},
|
||||
},
|
||||
}
|
||||
gls.left[3] ={
|
||||
FileIcon = {
|
||||
provider = 'FileIcon',
|
||||
condition = buffer_not_empty,
|
||||
highlight = { require('galaxyline.provider_fileinfo').get_file_icon_color, colors.section_bg },
|
||||
},
|
||||
}
|
||||
gls.left[4] = {
|
||||
FileName = {
|
||||
provider = 'FileName',
|
||||
condition = buffer_not_empty,
|
||||
highlight = { colors.fg, colors.section_bg },
|
||||
separator = " ",
|
||||
separator_highlight = {colors.section_bg, colors.bg},
|
||||
}
|
||||
}
|
||||
gls.left[5] = {
|
||||
GitIcon = {
|
||||
provider = function() return ' ' end,
|
||||
condition = in_git_repo,
|
||||
highlight = {colors.red,colors.bg},
|
||||
}
|
||||
}
|
||||
gls.left[6] = {
|
||||
GitBranch = {
|
||||
provider = function()
|
||||
local vcs = require('galaxyline.provider_vcs')
|
||||
local branch_name = vcs.get_git_branch()
|
||||
if (string.len(branch_name) > 28) then
|
||||
return string.sub(branch_name, 1, 25).."..."
|
||||
end
|
||||
return branch_name .. " "
|
||||
end,
|
||||
condition = in_git_repo,
|
||||
highlight = {colors.fg,colors.bg},
|
||||
}
|
||||
}
|
||||
gls.left[7] = {
|
||||
DiffAdd = {
|
||||
provider = 'DiffAdd',
|
||||
condition = checkwidth,
|
||||
icon = ' ',
|
||||
highlight = { colors.green, colors.bg },
|
||||
}
|
||||
}
|
||||
gls.left[8] = {
|
||||
DiffModified = {
|
||||
provider = 'DiffModified',
|
||||
condition = checkwidth,
|
||||
icon = ' ',
|
||||
highlight = { colors.orange, colors.bg },
|
||||
}
|
||||
}
|
||||
gls.left[9] = {
|
||||
DiffRemove = {
|
||||
provider = 'DiffRemove',
|
||||
condition = checkwidth,
|
||||
icon = ' ',
|
||||
highlight = { colors.red,colors.bg },
|
||||
}
|
||||
}
|
||||
gls.left[10] = {
|
||||
LeftEnd = {
|
||||
provider = function() return ' ' end,
|
||||
condition = buffer_not_empty,
|
||||
highlight = {colors.section_bg,colors.bg}
|
||||
}
|
||||
}
|
||||
gls.left[11] = {
|
||||
DiagnosticError = {
|
||||
provider = 'DiagnosticError',
|
||||
icon = ' ',
|
||||
highlight = {colors.red,colors.section_bg}
|
||||
}
|
||||
}
|
||||
gls.left[12] = {
|
||||
Space = {
|
||||
provider = function () return ' ' end,
|
||||
highlight = {colors.section_bg,colors.section_bg},
|
||||
}
|
||||
}
|
||||
gls.left[13] = {
|
||||
DiagnosticWarn = {
|
||||
provider = 'DiagnosticWarn',
|
||||
icon = ' ',
|
||||
highlight = {colors.orange,colors.section_bg},
|
||||
}
|
||||
}
|
||||
gls.left[14] = {
|
||||
Space = {
|
||||
provider = function () return ' ' end,
|
||||
highlight = {colors.section_bg,colors.section_bg},
|
||||
}
|
||||
}
|
||||
gls.left[15] = {
|
||||
DiagnosticInfo = {
|
||||
provider = 'DiagnosticInfo',
|
||||
icon = ' ',
|
||||
highlight = {colors.blue,colors.section_bg},
|
||||
separator = ' ',
|
||||
separator_highlight = { colors.section_bg, colors.bg },
|
||||
}
|
||||
}
|
||||
|
||||
-- Right side
|
||||
gls.right[1]= {
|
||||
FileFormat = {
|
||||
provider = function() return vim.bo.filetype end,
|
||||
highlight = { colors.fg,colors.section_bg },
|
||||
separator = ' ',
|
||||
separator_highlight = { colors.section_bg,colors.bg },
|
||||
}
|
||||
}
|
||||
gls.right[2] = {
|
||||
LineInfo = {
|
||||
provider = 'LineColumn',
|
||||
highlight = { colors.fg, colors.section_bg },
|
||||
separator = ' | ',
|
||||
separator_highlight = { colors.bg, colors.section_bg },
|
||||
},
|
||||
}
|
||||
|
||||
-- Short status line
|
||||
gls.short_line_left[1] = {
|
||||
BufferType = {
|
||||
provider = 'FileTypeName',
|
||||
highlight = { colors.fg, colors.section_bg },
|
||||
separator = ' ',
|
||||
separator_highlight = { colors.section_bg, colors.bg },
|
||||
}
|
||||
}
|
||||
|
||||
gls.short_line_right[1] = {
|
||||
BufferIcon = {
|
||||
provider= 'BufferIcon',
|
||||
highlight = { colors.yellow, colors.section_bg },
|
||||
separator = ' ',
|
||||
separator_highlight = { colors.section_bg, colors.bg },
|
||||
}
|
||||
}
|
||||
|
||||
-- Force manual load so that nvim boots with a status line
|
||||
gl.load_galaxyline()
|
27
.config/nvim/lua/plugins/lualine.lua
Normal file
27
.config/nvim/lua/plugins/lualine.lua
Normal file
@@ -0,0 +1,27 @@
|
||||
require'lualine'.setup {
|
||||
options = {
|
||||
icons_enabled = true,
|
||||
theme = 'nord',
|
||||
component_separators = {'', ''},
|
||||
section_separators = {'', ''},
|
||||
disabled_filetypes = {}
|
||||
},
|
||||
sections = {
|
||||
lualine_a = {'mode'},
|
||||
lualine_b = {'branch'},
|
||||
lualine_c = {'filename', require'lsp-status'.status},
|
||||
lualine_x = {'encoding', 'fileformat', 'filetype'},
|
||||
lualine_y = {'progress'},
|
||||
lualine_z = {'location'}
|
||||
},
|
||||
inactive_sections = {
|
||||
lualine_a = {},
|
||||
lualine_b = {},
|
||||
lualine_c = {'filename'},
|
||||
lualine_x = {'location'},
|
||||
lualine_y = {},
|
||||
lualine_z = {}
|
||||
},
|
||||
tabline = {},
|
||||
extensions = {}
|
||||
}
|
3
.config/nvim/lua/plugins/sneak.lua
Normal file
3
.config/nvim/lua/plugins/sneak.lua
Normal file
@@ -0,0 +1,3 @@
|
||||
vim.cmd([[
|
||||
let g:sneak#label = 1
|
||||
]])
|
1
.config/nvim/lua/plugins/tagbar.lua
Normal file
1
.config/nvim/lua/plugins/tagbar.lua
Normal file
@@ -0,0 +1 @@
|
||||
vim.g.tagbar_ctags_bin = '/usr/local/bin/ctags'
|
@@ -7,8 +7,8 @@ require('telescope').setup {
|
||||
find_command = {'rg', '--no-heading', '--with-filename', '--line-number', '--column', '--smart-case'},
|
||||
prompt_position = "bottom",
|
||||
-- prompt_prefix = " ",
|
||||
prompt_prefix = " ",
|
||||
selection_caret = " ",
|
||||
prompt_prefix = " ",
|
||||
selection_caret = " ",
|
||||
entry_prefix = " ",
|
||||
initial_mode = "insert",
|
||||
selection_strategy = "reset",
|
||||
@@ -43,7 +43,7 @@ require('telescope').setup {
|
||||
-- To disable a keymap, put [map] = false
|
||||
-- So, to not map "<C-n>", just put
|
||||
-- ["<c-x>"] = false,
|
||||
["<esc>"] = actions.close,
|
||||
|
||||
|
||||
-- Otherwise, just set the mapping to the function that you want it to be.
|
||||
-- ["<C-i>"] = actions.select_horizontal,
|
||||
@@ -58,6 +58,7 @@ require('telescope').setup {
|
||||
["<C-j>"] = actions.move_selection_next,
|
||||
["<C-k>"] = actions.move_selection_previous,
|
||||
["<C-q>"] = actions.smart_send_to_qflist + actions.open_qflist,
|
||||
["<esc>"] = actions.close,
|
||||
-- ["<C-i>"] = my_cool_custom_action,
|
||||
}
|
||||
}
|
||||
|
@@ -50,18 +50,25 @@ vim.g.mapleader = ' '
|
||||
-- explorer
|
||||
vim.api.nvim_set_keymap('n', '<Leader>e', ':NERDTreeToggle<CR>', {noremap = true, silent = true})
|
||||
|
||||
-- dashboard
|
||||
vim.api.nvim_set_keymap('n', '<Leader>;', ':Dashboard<CR>', {noremap = true, silent = true})
|
||||
|
||||
-- TODO create entire treesitter section
|
||||
|
||||
local mappings = {
|
||||
["/"] = "Comment",
|
||||
["e"] = "Explorer",
|
||||
f = {
|
||||
f = {":Telescope find_files<CR>", "Find File"}
|
||||
["c"] = "NERDCommenter",
|
||||
b = {
|
||||
name = "+Buffers",
|
||||
b = {"<C-^>", "Toggle Buffer"},
|
||||
d = {"<cmd>bd<cr>", "Close Buffer"},
|
||||
k = {"<cmd>bd!<cr>", "Kill Buffer"},
|
||||
},
|
||||
f = {
|
||||
name = "Find",
|
||||
f = {"<cmd>Telescope find_files<cr>", "Find File"},
|
||||
p = {"<cmd>lua require'telescope'.extensions.project.project{}<CR>", "Project"},
|
||||
g = {"<cmd>lua require'telescope.builtin'.live_grep()<cr>", "Grep files"},
|
||||
b = {"<cmd>lua require'telescope.builtin'.buffers{}<cr>", "Buffers"},
|
||||
t = {"<cmd>lua require'telescope.builtin'.help_tags{}<cr>", "Tags"},
|
||||
},
|
||||
["f"] = "Find File",
|
||||
g = {
|
||||
name = "+Git",
|
||||
j = {"<cmd>NextHunk<cr>", "Next Hunk"},
|
||||
@@ -94,7 +101,9 @@ local mappings = {
|
||||
s = {"<cmd>Telescope lsp_document_symbols<cr>", "Document Symbols"},
|
||||
S = {"<cmd>Telescope lsp_workspace_symbols<cr>", "Workspace Symbols"}
|
||||
},
|
||||
|
||||
d = {
|
||||
f = {":lua require'functions'.edit_dotfiles()<cr>", "Dotfiles search"}
|
||||
},
|
||||
s = {
|
||||
name = "+Search",
|
||||
b = {"<cmd>Telescope git_branches<cr>", "Checkout branch"},
|
||||
@@ -112,6 +121,10 @@ local mappings = {
|
||||
name = "+Session",
|
||||
s = {"<cmd>SessionSave<cr>", "Save Session"},
|
||||
l = {"<cmd>SessionLoad<cr>", "Load Session"}
|
||||
},
|
||||
t = {
|
||||
name = "+Tagbar",
|
||||
t = {"<cmd>TagbarToggle<cr>", "Toggle Tagbar"},
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user