Refactor theme and status line into their own file
This commit is contained in:
parent
e15e7f4bda
commit
cdaa750c86
29
init.lua
29
init.lua
@ -122,35 +122,18 @@ require('lazy').setup({
|
|||||||
changedelete = { text = '~' },
|
changedelete = { text = '~' },
|
||||||
},
|
},
|
||||||
on_attach = function(bufnr)
|
on_attach = function(bufnr)
|
||||||
vim.keymap.set('n', '<leader>gp', require('gitsigns').prev_hunk, { buffer = bufnr, desc = '[G]o to [P]revious Hunk' })
|
vim.keymap.set('n', '[c', require('gitsigns').prev_hunk, { buffer = bufnr, desc = 'Go to Previous Hunk' })
|
||||||
vim.keymap.set('n', '<leader>gn', require('gitsigns').next_hunk, { buffer = bufnr, desc = '[G]o to [N]ext Hunk' })
|
vim.keymap.set('n', ']c', require('gitsigns').next_hunk, { buffer = bufnr, desc = 'Go to Next Hunk' })
|
||||||
vim.keymap.set('n', '<leader>ph', require('gitsigns').preview_hunk, { buffer = bufnr, desc = '[P]review [H]unk' })
|
vim.keymap.set('n', '<leader>ph', require('gitsigns').preview_hunk, { buffer = bufnr, desc = '[P]review [H]unk' })
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
-- Theme related configs go here
|
||||||
-- Theme inspired by Atom
|
require 'kickstart.plugins.theme',
|
||||||
'navarasu/onedark.nvim',
|
|
||||||
priority = 1000,
|
|
||||||
config = function()
|
|
||||||
vim.cmd.colorscheme 'onedark'
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
-- Status line related configs go here
|
||||||
-- Set lualine as statusline
|
require 'kickstart.plugins.statusline',
|
||||||
'nvim-lualine/lualine.nvim',
|
|
||||||
-- See `:help lualine.txt`
|
|
||||||
opts = {
|
|
||||||
options = {
|
|
||||||
icons_enabled = false,
|
|
||||||
theme = 'onedark',
|
|
||||||
component_separators = '|',
|
|
||||||
section_separators = '',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
{
|
||||||
-- Add indentation guides even on blank lines
|
-- Add indentation guides even on blank lines
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
'neovim/nvim-lspconfig',
|
'neovim/nvim-lspconfig',
|
||||||
|
|
||||||
config = function()
|
config = function()
|
||||||
-- Switch for controlling whether you want autoformatting.
|
-- Switch for controlling whether you want autoformatting.
|
||||||
-- Use :KickstartFormatToggle to toggle autoformatting on or off
|
-- Use :KickstartFormatToggle to toggle autoformatting on or off
|
||||||
@ -28,11 +29,9 @@ return {
|
|||||||
return _augroups[client.id]
|
return _augroups[client.id]
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Whenever an LSP attaches to a buffer, we will run this function.
|
|
||||||
--
|
|
||||||
-- See `:help LspAttach` for more information about this autocmd event.
|
|
||||||
vim.api.nvim_create_autocmd('LspAttach', {
|
vim.api.nvim_create_autocmd('LspAttach', {
|
||||||
group = vim.api.nvim_create_augroup('kickstart-lsp-attach-format', { clear = true }),
|
group = vim.api.nvim_create_augroup('kickstart-lsp-attach-format', { clear = true }),
|
||||||
|
|
||||||
-- This is where we attach the autoformatting for reasonable clients
|
-- This is where we attach the autoformatting for reasonable clients
|
||||||
callback = function(args)
|
callback = function(args)
|
||||||
local client_id = args.data.client_id
|
local client_id = args.data.client_id
|
||||||
@ -50,8 +49,6 @@ return {
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Create an autocmd that will run *before* we save the buffer.
|
|
||||||
-- Run the formatting command for the LSP that has just attached.
|
|
||||||
vim.api.nvim_create_autocmd('BufWritePre', {
|
vim.api.nvim_create_autocmd('BufWritePre', {
|
||||||
group = get_augroup(client),
|
group = get_augroup(client),
|
||||||
buffer = bufnr,
|
buffer = bufnr,
|
||||||
@ -60,12 +57,7 @@ return {
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
vim.lsp.buf.format {
|
vim.lsp.buf.format { async = false }
|
||||||
async = false,
|
|
||||||
filter = function(c)
|
|
||||||
return c.id == client.id
|
|
||||||
end,
|
|
||||||
}
|
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
end,
|
end,
|
||||||
|
14
lua/kickstart/plugins/statusline.lua
Normal file
14
lua/kickstart/plugins/statusline.lua
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
return {
|
||||||
|
-- Set lualine as statusline
|
||||||
|
'nvim-lualine/lualine.nvim',
|
||||||
|
-- See `:help lualine.txt`
|
||||||
|
opts = {
|
||||||
|
options = {
|
||||||
|
icons_enabled = false,
|
||||||
|
theme = 'tokyonight',
|
||||||
|
component_separators = '|',
|
||||||
|
section_separators = '',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
10
lua/kickstart/plugins/theme.lua
Normal file
10
lua/kickstart/plugins/theme.lua
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
return {
|
||||||
|
"folke/tokyonight.nvim",
|
||||||
|
lazy = false,
|
||||||
|
priority = 1000,
|
||||||
|
opts = {},
|
||||||
|
config = function()
|
||||||
|
vim.cmd.colorscheme 'tokyonight-storm'
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user