Skip to content

Commit 7e40805

Browse files
committed
init.lua: add basic custom configuration
1 parent 4120893 commit 7e40805

File tree

1 file changed

+124
-95
lines changed

1 file changed

+124
-95
lines changed

init.lua

Lines changed: 124 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -1,97 +1,11 @@
1-
--[[
2-
3-
=====================================================================
4-
==================== READ THIS BEFORE CONTINUING ====================
5-
=====================================================================
6-
======== .-----. ========
7-
======== .----------------------. | === | ========
8-
======== |.-""""""""""""""""""-.| |-----| ========
9-
======== || || | === | ========
10-
======== || KICKSTART.NVIM || |-----| ========
11-
======== || || | === | ========
12-
======== || || |-----| ========
13-
======== ||:Tutor || |:::::| ========
14-
======== |'-..................-'| |____o| ========
15-
======== `"")----------------(""` ___________ ========
16-
======== /::::::::::| |::::::::::\ \ no mouse \ ========
17-
======== /:::========| |==hjkl==:::\ \ required \ ========
18-
======== '""""""""""""' '""""""""""""' '""""""""""' ========
19-
======== ========
20-
=====================================================================
21-
=====================================================================
22-
23-
What is Kickstart?
24-
25-
Kickstart.nvim is *not* a distribution.
26-
27-
Kickstart.nvim is a starting point for your own configuration.
28-
The goal is that you can read every line of code, top-to-bottom, understand
29-
what your configuration is doing, and modify it to suit your needs.
30-
31-
Once you've done that, you can start exploring, configuring and tinkering to
32-
make Neovim your own! That might mean leaving Kickstart just the way it is for a while
33-
or immediately breaking it into modular pieces. It's up to you!
34-
35-
If you don't know anything about Lua, I recommend taking some time to read through
36-
a guide. One possible example which will only take 10-15 minutes:
37-
- https://learnxinyminutes.com/docs/lua/
38-
39-
After understanding a bit more about Lua, you can use `:help lua-guide` as a
40-
reference for how Neovim integrates Lua.
41-
- :help lua-guide
42-
- (or HTML version): https://neovim.io/doc/user/lua-guide.html
43-
44-
Kickstart Guide:
45-
46-
TODO: The very first thing you should do is to run the command `:Tutor` in Neovim.
47-
48-
If you don't know what this means, type the following:
49-
- <escape key>
50-
- :
51-
- Tutor
52-
- <enter key>
53-
54-
(If you already know the Neovim basics, you can skip this step.)
55-
56-
Once you've completed that, you can continue working through **AND READING** the rest
57-
of the kickstart init.lua.
58-
59-
Next, run AND READ `:help`.
60-
This will open up a help window with some basic information
61-
about reading, navigating and searching the builtin help documentation.
62-
63-
This should be the first place you go to look when you're stuck or confused
64-
with something. It's one of my favorite Neovim features.
65-
66-
MOST IMPORTANTLY, we provide a keymap "<space>sh" to [s]earch the [h]elp documentation,
67-
which is very useful when you're not exactly sure of what you're looking for.
68-
69-
I have left several `:help X` comments throughout the init.lua
70-
These are hints about where to find more information about the relevant settings,
71-
plugins or Neovim features used in Kickstart.
72-
73-
NOTE: Look for lines like this
74-
75-
Throughout the file. These are for you, the reader, to help you understand what is happening.
76-
Feel free to delete them once you know what you're doing, but they should serve as a guide
77-
for when you are first encountering a few different constructs in your Neovim config.
78-
79-
If you experience any errors while trying to install kickstart, run `:checkhealth` for more info.
80-
81-
I hope you enjoy your Neovim journey,
82-
- TJ
83-
84-
P.S. You can delete this when you're done too. It's your config now! :)
85-
--]]
86-
871
-- Set <space> as the leader key
882
-- See `:help mapleader`
893
-- NOTE: Must happen before plugins are loaded (otherwise wrong leader will be used)
904
vim.g.mapleader = ' '
915
vim.g.maplocalleader = ' '
926

937
-- Set to true if you have a Nerd Font installed and selected in the terminal
94-
vim.g.have_nerd_font = false
8+
vim.g.have_nerd_font = true
959

9610
-- [[ Setting options ]]
9711
-- See `:help vim.opt`
@@ -102,7 +16,7 @@ vim.g.have_nerd_font = false
10216
vim.opt.number = true
10317
-- You can also add relative line numbers, to help with jumping.
10418
-- Experiment for yourself to see if you like it!
105-
-- vim.opt.relativenumber = true
19+
vim.opt.relativenumber = true
10620

10721
-- Enable mouse mode, can be useful for resizing splits for example!
10822
vim.opt.mouse = 'a'
@@ -115,7 +29,7 @@ vim.opt.showmode = false
11529
-- Remove this option if you want your OS clipboard to remain independent.
11630
-- See `:help 'clipboard'`
11731
vim.schedule(function()
118-
vim.opt.clipboard = 'unnamedplus'
32+
-- vim.opt.clipboard = 'unnamedplus'
11933
end)
12034

12135
-- Enable break indent
@@ -176,10 +90,10 @@ vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagn
17690
vim.keymap.set('t', '<Esc><Esc>', '<C-\\><C-n>', { desc = 'Exit terminal mode' })
17791

17892
-- TIP: Disable arrow keys in normal mode
179-
-- vim.keymap.set('n', '<left>', '<cmd>echo "Use h to move!!"<CR>')
180-
-- vim.keymap.set('n', '<right>', '<cmd>echo "Use l to move!!"<CR>')
181-
-- vim.keymap.set('n', '<up>', '<cmd>echo "Use k to move!!"<CR>')
182-
-- vim.keymap.set('n', '<down>', '<cmd>echo "Use j to move!!"<CR>')
93+
vim.keymap.set('n', '<left>', '<cmd>echo "Use h to move!!"<CR>')
94+
vim.keymap.set('n', '<right>', '<cmd>echo "Use l to move!!"<CR>')
95+
vim.keymap.set('n', '<up>', '<cmd>echo "Use k to move!!"<CR>')
96+
vim.keymap.set('n', '<down>', '<cmd>echo "Use j to move!!"<CR>')
18397

18498
-- Keybinds to make split navigation easier.
18599
-- Use CTRL+<hjkl> to switch between windows
@@ -190,6 +104,9 @@ vim.keymap.set('n', '<C-l>', '<C-w><C-l>', { desc = 'Move focus to the right win
190104
vim.keymap.set('n', '<C-j>', '<C-w><C-j>', { desc = 'Move focus to the lower window' })
191105
vim.keymap.set('n', '<C-k>', '<C-w><C-k>', { desc = 'Move focus to the upper window' })
192106

107+
vim.keymap.set('n', '<C-u>', '<C-u>zz', { noremap = true, desc = 'Map C-u to C-uzz' })
108+
vim.keymap.set('n', '<C-d>', '<C-d>zz', { noremap = true, desc = 'Map C-d to C-dzz' })
109+
193110
-- [[ Basic Autocommands ]]
194111
-- See `:help lua-guide-autocommands`
195112

@@ -231,9 +148,96 @@ require('lazy').setup({
231148
-- NOTE: Plugins can be added with a link (or for a github repo: 'owner/repo' link).
232149
'tpope/vim-sleuth', -- Detect tabstop and shiftwidth automatically
233150

151+
{
152+
'ThePrimeagen/harpoon',
153+
requires = { 'nvim-lua/plenary.nvim' }, -- Harpoon requires plenary
154+
config = function()
155+
require('harpoon').setup {
156+
-- Configuration options go here
157+
-- For example, set the menu to open with a specific size
158+
menu = {
159+
width = vim.api.nvim_win_get_width(0) - 4,
160+
height = 10,
161+
},
162+
}
163+
164+
-- Keybindings for Harpoon
165+
vim.keymap.set('n', '<leader>a', require('harpoon.mark').add_file, { desc = 'Add file to Harpoon' })
166+
vim.keymap.set('n', '<leader>h', require('harpoon.ui').toggle_quick_menu, { desc = 'Toggle Harpoon menu' })
167+
vim.keymap.set('n', '<leader>j', function()
168+
require('harpoon.ui').nav_file(1)
169+
end, { desc = 'Harpoon: go to mark 1' })
170+
vim.keymap.set('n', '<leader>k', function()
171+
require('harpoon.ui').nav_file(2)
172+
end, { desc = 'Harpoon: go to mark 2' })
173+
vim.keymap.set('n', '<leader>l', function()
174+
require('harpoon.ui').nav_file(3)
175+
end, { desc = 'Harpoon: go to mark 3' })
176+
vim.keymap.set('n', '<leader>;', function()
177+
require('harpoon.ui').nav_file(4)
178+
end, { desc = 'Harpoon: go to mark 4' })
179+
end,
180+
},
181+
182+
{
183+
'tpope/vim-fugitive',
184+
vim.keymap.set('n', '<leader>gs', ':Git<CR>', { desc = 'Git status' }),
185+
vim.keymap.set('n', '<leader>gc', ':Git commit<CR>', { desc = 'Git commit' }),
186+
vim.keymap.set('n', '<leader>gp', ':Git push<CR>', { desc = 'Git push' }),
187+
vim.keymap.set('n', '<leader>gpl', ':Git pull<CR>', { desc = 'Git pull' }),
188+
vim.keymap.set('n', '<leader>gd', ':Gvdiffsplit<CR>', { desc = 'Git diff' }),
189+
vim.keymap.set('n', '<leader>gb', ':Git blame<CR>', { desc = 'Git blame' }),
190+
vim.keymap.set('n', '<leader>gl', ':Git log<CR>', { desc = 'Git log' }),
191+
vim.keymap.set('n', '<leader>gr', ':Gread<CR>', { desc = 'Git read (checkout file)' }),
192+
vim.keymap.set('n', '<leader>gw', ':Gwrite<CR>', { desc = 'Git write (stage file)' }),
193+
vim.keymap.set('n', '<leader>gsh', ':G! push<CR>', { desc = 'Git push (force)' }),
194+
vim.keymap.set('n', '<leader>gf', ':Git fetch<CR>', { desc = 'Git fetch' }),
195+
vim.keymap.set('n', '<leader>gm', ':Git mergetool<CR>', { desc = 'Git mergetool' }),
196+
},
197+
198+
{
199+
'mbbill/undotree',
200+
lazy = false,
201+
-- keys = { '<leader>u', ':UndotreeToggle<CR>' }, -- Correct key binding
202+
vim.keymap.set('n', '<leader>u', ':UndotreeToggle<CR>', { noremap = true, desc = 'UndotreeToggle' }),
203+
-- keys = { '<leader>u', 'vim.cmd.UndotreeToggle' },
204+
config = function()
205+
-- Configuration settings for undotree
206+
vim.g.undotree_WindowLayout = 2
207+
vim.g.undotree_SetFocusWhenToggle = 1
208+
end,
209+
},
210+
211+
{ -- Treesitter with added nvim-treesitter-context
212+
'nvim-treesitter/nvim-treesitter',
213+
build = ':TSUpdate',
214+
opts = {
215+
ensure_installed = { 'bash', 'c', 'html', 'lua', 'luadoc', 'markdown', 'vim', 'vimdoc' },
216+
auto_install = true,
217+
highlight = {
218+
enable = true,
219+
additional_vim_regex_highlighting = { 'ruby' },
220+
},
221+
indent = { enable = true, disable = { 'ruby' } },
222+
},
223+
dependencies = {
224+
{ 'nvim-treesitter/nvim-treesitter-context' },
225+
-- any other dependencies if needed
226+
},
227+
config = function(_, opts)
228+
require('nvim-treesitter.configs').setup(opts)
229+
require('treesitter-context').setup {
230+
enable = true, -- Enable this plugin (Can be enabled/disabled later via commands)
231+
-- further configuration options
232+
}
233+
end,
234+
},
235+
234236
-- NOTE: Plugins can also be added by using a table,
235237
-- with the first argument being the link and the following
236238
-- keys can be used to configure plugin behavior/loading/etc.
239+
240+
--
237241
--
238242
-- Use `opts = {}` to force a plugin to be loaded.
239243
--
@@ -606,8 +610,17 @@ require('lazy').setup({
606610
-- For example, to see the options for `lua_ls`, you could go to: https://luals.github.io/wiki/settings/
607611
local servers = {
608612
-- clangd = {},
609-
-- gopls = {},
610-
-- pyright = {},
613+
bashls = {},
614+
-- clojure_lsp = {},
615+
dockerls = {},
616+
gopls = {},
617+
helm_ls = {},
618+
marksman = {},
619+
-- nushell = {},
620+
-- postgres_lsp = {},
621+
pyright = {},
622+
ruff_lsp = {},
623+
terraformls = {},
611624
-- rust_analyzer = {},
612625
-- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs
613626
--
@@ -632,6 +645,9 @@ require('lazy').setup({
632645
},
633646
},
634647
},
648+
649+
--
650+
-- ruff_lsp = {},
635651
}
636652

637653
-- Ensure the servers and tools above are installed
@@ -907,6 +923,19 @@ require('lazy').setup({
907923
-- - Show your current context: https://github.com/nvim-treesitter/nvim-treesitter-context
908924
-- - Treesitter + textobjects: https://github.com/nvim-treesitter/nvim-treesitter-textobjects
909925
},
926+
-- {
927+
-- 'sourcegraph/sg.nvim',
928+
-- dependencies = { 'nvim-lua/plenary.nvim' },
929+
-- config = function()
930+
-- require('sg').setup {
931+
-- -- Pass your own custom attach function
932+
-- -- If you do not pass your own attach function, then the following maps are provide:
933+
-- -- - gd -> goto definition
934+
-- -- - gr -> goto references
935+
-- -- on_attach = your_custom_lsp_attach_function,
936+
-- }
937+
-- end,
938+
-- },
910939

911940
-- The following two comments only work if you have downloaded the kickstart repo, not just copy pasted the
912941
-- init.lua. If you want these files, they are in the repository, so you can just download them and

0 commit comments

Comments
 (0)