Skip to content

Commit

Permalink
Refactor theme and status line into their own file
Browse files Browse the repository at this point in the history
  • Loading branch information
feoh committed Jun 3, 2023
1 parent e15e7f4 commit cdaa750
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 34 deletions.
29 changes: 6 additions & 23 deletions init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -122,35 +122,18 @@ require('lazy').setup({
changedelete = { text = '~' },
},
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', '<leader>gn', require('gitsigns').next_hunk, { buffer = bufnr, desc = '[G]o to [N]ext Hunk' })
vim.keymap.set('n', '[c', require('gitsigns').prev_hunk, { buffer = bufnr, desc = 'Go to Previous 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' })
end,
},
},

{
-- Theme inspired by Atom
'navarasu/onedark.nvim',
priority = 1000,
config = function()
vim.cmd.colorscheme 'onedark'
end,
},
-- Theme related configs go here
require 'kickstart.plugins.theme',

{
-- Set lualine as statusline
'nvim-lualine/lualine.nvim',
-- See `:help lualine.txt`
opts = {
options = {
icons_enabled = false,
theme = 'onedark',
component_separators = '|',
section_separators = '',
},
},
},
-- Status line related configs go here
require 'kickstart.plugins.statusline',

{
-- Add indentation guides even on blank lines
Expand Down
14 changes: 3 additions & 11 deletions lua/kickstart/plugins/autoformat.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

return {
'neovim/nvim-lspconfig',

config = function()
-- Switch for controlling whether you want autoformatting.
-- Use :KickstartFormatToggle to toggle autoformatting on or off
Expand All @@ -28,11 +29,9 @@ return {
return _augroups[client.id]
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', {
group = vim.api.nvim_create_augroup('kickstart-lsp-attach-format', { clear = true }),

-- This is where we attach the autoformatting for reasonable clients
callback = function(args)
local client_id = args.data.client_id
Expand All @@ -50,8 +49,6 @@ return {
return
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', {
group = get_augroup(client),
buffer = bufnr,
Expand All @@ -60,12 +57,7 @@ return {
return
end

vim.lsp.buf.format {
async = false,
filter = function(c)
return c.id == client.id
end,
}
vim.lsp.buf.format { async = false }
end,
})
end,
Expand Down
14 changes: 14 additions & 0 deletions lua/kickstart/plugins/statusline.lua
Original file line number Diff line number Diff line change
@@ -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 changes: 10 additions & 0 deletions lua/kickstart/plugins/theme.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
return {
"folke/tokyonight.nvim",
lazy = false,
priority = 1000,
opts = {},
config = function()
vim.cmd.colorscheme 'tokyonight-storm'
end,
}

0 comments on commit cdaa750

Please sign in to comment.