Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
116 changes: 65 additions & 51 deletions init.lua
Original file line number Diff line number Diff line change
@@ -1,40 +1,3 @@
--[[

=====================================================================
==================== READ THIS BEFORE CONTINUING ====================
=====================================================================

Kickstart.nvim is *not* a distribution.

Kickstart.nvim is a template for your own configuration.
The goal is that you can read every line of code, top-to-bottom, understand
what your configuration is doing, and modify it to suit your needs.

Once you've done that, you should start exploring, configuring and tinkering to
explore Neovim!

If you don't know anything about Lua, I recommend taking some time to read through
a guide. One possible example:
- https://learnxinyminutes.com/docs/lua/

And then you can explore or search through `:help lua-guide`


Kickstart Guide:

I have left several `:help X` comments throughout the init.lua
You should run that command and read that help section for more information.

In addition, I have some `NOTE:` items throughout the file.
These are for you, the reader to help understand what is happening. Feel free to delete
them once you know what you're doing, but they should serve as a guide for when you
are first encountering a few different constructs in your nvim config.

I hope you enjoy your Neovim journey,
- TJ

P.S. You can delete this when you're done too. It's your config now :)
--]]
-- Set <space> as the leader key
-- See `:help mapleader`
-- NOTE: Must happen before plugins are required (otherwise wrong leader will be used)
Expand Down Expand Up @@ -107,6 +70,9 @@ require('lazy').setup({
},
},

-- Plugin to autopair brackets
{ 'windwp/nvim-autopairs', event = 'InsertEnter', opts = {} },

-- Useful plugin to show you pending keybinds.
{ 'folke/which-key.nvim', opts = {} },
{
Expand All @@ -124,18 +90,20 @@ require('lazy').setup({
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', '<leader>ph', require('gitsigns').preview_hunk, { buffer = bufnr, desc = '[P]review [H]unk' })
vim.keymap.set('n', '<leader>rh', require('gitsigns').reset_hunk, { buffer = bufnr, desc = '[R]eset [H]unk' })
vim.keymap.set('n', '<leader>vh', require('gitsigns').preview_hunk, { buffer = bufnr, desc = 'Pre[v]iew [H]unk' })
end,
},
},

{
-- Theme inspired by Atom
'navarasu/onedark.nvim',
-- theme
{
"catppuccin/nvim",
name = "catppuccin",
priority = 1000,
config = function()
vim.cmd.colorscheme 'onedark'
end,
vim.cmd.colorscheme 'catppuccin' -- 'catppuccin-latte', 'catppuccin-frappe', 'catppuccin-macchiato', 'catppuccin-mocha'
end
},

{
Expand All @@ -145,7 +113,7 @@ require('lazy').setup({
opts = {
options = {
icons_enabled = false,
theme = 'onedark',
theme = 'auto',
component_separators = '|',
section_separators = '',
},
Expand Down Expand Up @@ -210,7 +178,7 @@ require('lazy').setup({
-- NOTE: You can change these options as you wish!

-- Set highlight on search
vim.o.hlsearch = false
vim.o.hlsearch = true

-- Make line numbers default
vim.wo.number = true
Expand All @@ -219,9 +187,30 @@ vim.wo.number = true
vim.o.mouse = 'a'

-- Sync clipboard between OS and Neovim.
-- Remove this option if you want your OS clipboard to remain independent.
-- See `:help 'clipboard'`
vim.o.clipboard = 'unnamedplus'
vim.keymap.set({'n', 'v'}, '<leader>y', '"+y', { desc = 'Yank to system clipboard' })
vim.keymap.set({'n', 'v'}, '<leader>p', '"+p', { desc = 'Paste from system clipboard' })
vim.keymap.set({'n', 'v'}, '<leader>P', '"+P', { desc = 'Paste from system clipboard' })
vim.keymap.set('n', '<leader>yy', '"+yy', { desc = 'Yank line to system clipboard' })
vim.keymap.set('n', '<leader>Y', '"+y$', { desc = 'Yank to end of line to system clipboard' })
vim.keymap.set('v', '<leader>Y', '"+Y', { desc = 'Yank highlighted lines to system clipboard' })

-- Escape terminal mode
vim.keymap.set('t', '<Esc>', '<C-\\><C-n>', { desc = 'Escape terminal mode'})

-- Use ALT+{h,j,k,l} to navigate windows from any mode (see :help terminal)
vim.keymap.set('t', '<A-h>', '<C-\\><C-N><C-w>h')
vim.keymap.set('t', '<A-j>', '<C-\\><C-N><C-w>j')
vim.keymap.set('t', '<A-k>', '<C-\\><C-N><C-w>k')
vim.keymap.set('t', '<A-l>', '<C-\\><C-N><C-w>l')
vim.keymap.set('i', '<A-h>', '<C-\\><C-N><C-w>h')
vim.keymap.set('i', '<A-j>', '<C-\\><C-N><C-w>j')
vim.keymap.set('i', '<A-k>', '<C-\\><C-N><C-w>k')
vim.keymap.set('i', '<A-l>', '<C-\\><C-N><C-w>l')
vim.keymap.set('n', '<A-h>', '<C-w>h')
vim.keymap.set('n', '<A-j>', '<C-w>j')
vim.keymap.set('n', '<A-k>', '<C-w>k')
vim.keymap.set('n', '<A-l>', '<C-w>l')

-- Enable break indent
vim.o.breakindent = true
Expand All @@ -247,6 +236,19 @@ vim.o.completeopt = 'menuone,noselect'
-- NOTE: You should make sure your terminal supports this
vim.o.termguicolors = true

-- Think these are set automatically by a plugin instead
-- vim.o.tabstop = 4
vim.o.shiftwidth = 4
vim.o.expandtab = true

vim.o.scrolloff = 8

-- Folding with treesitter
vim.o.foldmethod = 'expr'
vim.o.foldexpr = 'nvim_treesitter#foldexpr()'
vim.o.foldenable = false -- start with all folds open
vim.o.foldlevel = 99

-- [[ Basic Keymaps ]]

-- Keymaps for better default experience
Expand All @@ -268,6 +270,18 @@ vim.api.nvim_create_autocmd('TextYankPost', {
pattern = '*',
})

require('Comment').setup({
ignore = '^$',
toggler = {
line = '<leader>cc',
block = '<leader>bc',
},
opleader = {
line = '<leader>c',
block = '<leader>b',
},
})

-- [[ Configure Telescope ]]
-- See `:help telescope` and `:help telescope.setup()`
require('telescope').setup {
Expand Down Expand Up @@ -306,7 +320,7 @@ vim.keymap.set('n', '<leader>sd', require('telescope.builtin').diagnostics, { de
-- See `:help nvim-treesitter`
require('nvim-treesitter.configs').setup {
-- Add languages to be installed here that you want installed for treesitter
ensure_installed = { 'c', 'cpp', 'go', 'lua', 'python', 'rust', 'tsx', 'typescript', 'vimdoc', 'vim' },
ensure_installed = { 'c', 'cpp', 'go', 'lua', 'python', 'rust', 'tsx', 'typescript', 'vimdoc', 'vim', 'c_sharp' },

-- Autoinstall languages that are not installed. Defaults to false (but you can change for yourself!)
auto_install = false,
Expand Down Expand Up @@ -425,11 +439,11 @@ end
-- Add any additional override configuration in the following tables. They will be passed to
-- the `settings` field of the server config. You must look up that documentation yourself.
local servers = {
-- clangd = {},
-- gopls = {},
clangd = {},
gopls = {},
-- pyright = {},
-- rust_analyzer = {},
-- tsserver = {},
tsserver = {},

lua_ls = {
Lua = {
Expand Down
Loading