Skip to content

Commit cdaa750

Browse files
committed
Refactor theme and status line into their own file
1 parent e15e7f4 commit cdaa750

File tree

4 files changed

+33
-34
lines changed

4 files changed

+33
-34
lines changed

init.lua

Lines changed: 6 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -122,35 +122,18 @@ require('lazy').setup({
122122
changedelete = { text = '~' },
123123
},
124124
on_attach = function(bufnr)
125-
vim.keymap.set('n', '<leader>gp', require('gitsigns').prev_hunk, { buffer = bufnr, desc = '[G]o to [P]revious Hunk' })
126-
vim.keymap.set('n', '<leader>gn', require('gitsigns').next_hunk, { buffer = bufnr, desc = '[G]o to [N]ext Hunk' })
125+
vim.keymap.set('n', '[c', require('gitsigns').prev_hunk, { buffer = bufnr, desc = 'Go to Previous Hunk' })
126+
vim.keymap.set('n', ']c', require('gitsigns').next_hunk, { buffer = bufnr, desc = 'Go to Next Hunk' })
127127
vim.keymap.set('n', '<leader>ph', require('gitsigns').preview_hunk, { buffer = bufnr, desc = '[P]review [H]unk' })
128128
end,
129129
},
130130
},
131131

132-
{
133-
-- Theme inspired by Atom
134-
'navarasu/onedark.nvim',
135-
priority = 1000,
136-
config = function()
137-
vim.cmd.colorscheme 'onedark'
138-
end,
139-
},
132+
-- Theme related configs go here
133+
require 'kickstart.plugins.theme',
140134

141-
{
142-
-- Set lualine as statusline
143-
'nvim-lualine/lualine.nvim',
144-
-- See `:help lualine.txt`
145-
opts = {
146-
options = {
147-
icons_enabled = false,
148-
theme = 'onedark',
149-
component_separators = '|',
150-
section_separators = '',
151-
},
152-
},
153-
},
135+
-- Status line related configs go here
136+
require 'kickstart.plugins.statusline',
154137

155138
{
156139
-- Add indentation guides even on blank lines

lua/kickstart/plugins/autoformat.lua

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
return {
77
'neovim/nvim-lspconfig',
8+
89
config = function()
910
-- Switch for controlling whether you want autoformatting.
1011
-- Use :KickstartFormatToggle to toggle autoformatting on or off
@@ -28,11 +29,9 @@ return {
2829
return _augroups[client.id]
2930
end
3031

31-
-- Whenever an LSP attaches to a buffer, we will run this function.
32-
--
33-
-- See `:help LspAttach` for more information about this autocmd event.
3432
vim.api.nvim_create_autocmd('LspAttach', {
3533
group = vim.api.nvim_create_augroup('kickstart-lsp-attach-format', { clear = true }),
34+
3635
-- This is where we attach the autoformatting for reasonable clients
3736
callback = function(args)
3837
local client_id = args.data.client_id
@@ -50,8 +49,6 @@ return {
5049
return
5150
end
5251

53-
-- Create an autocmd that will run *before* we save the buffer.
54-
-- Run the formatting command for the LSP that has just attached.
5552
vim.api.nvim_create_autocmd('BufWritePre', {
5653
group = get_augroup(client),
5754
buffer = bufnr,
@@ -60,12 +57,7 @@ return {
6057
return
6158
end
6259

63-
vim.lsp.buf.format {
64-
async = false,
65-
filter = function(c)
66-
return c.id == client.id
67-
end,
68-
}
60+
vim.lsp.buf.format { async = false }
6961
end,
7062
})
7163
end,

lua/kickstart/plugins/statusline.lua

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
return {
2+
-- Set lualine as statusline
3+
'nvim-lualine/lualine.nvim',
4+
-- See `:help lualine.txt`
5+
opts = {
6+
options = {
7+
icons_enabled = false,
8+
theme = 'tokyonight',
9+
component_separators = '|',
10+
section_separators = '',
11+
},
12+
},
13+
}
14+

lua/kickstart/plugins/theme.lua

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
return {
2+
"folke/tokyonight.nvim",
3+
lazy = false,
4+
priority = 1000,
5+
opts = {},
6+
config = function()
7+
vim.cmd.colorscheme 'tokyonight-storm'
8+
end,
9+
}
10+

0 commit comments

Comments
 (0)