Skip to content
Closed
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## Introduction


A starting point for Neovim that is:

* Small
Expand Down
268 changes: 179 additions & 89 deletions init.lua
Original file line number Diff line number Diff line change
@@ -1,89 +1,37 @@
--[[

=====================================================================
==================== READ THIS BEFORE CONTINUING ====================
=====================================================================
======== .-----. ========
======== .----------------------. | === | ========
======== |.-""""""""""""""""""-.| |-----| ========
======== || || | === | ========
======== || KICKSTART.NVIM || |-----| ========
======== || || | === | ========
======== || || |-----| ========
======== ||:Tutor || |:::::| ========
======== |'-..................-'| |____o| ========
======== `"")----------------(""` ___________ ========
======== /::::::::::| |::::::::::\ \ no mouse \ ========
======== /:::========| |==hjkl==:::\ \ required \ ========
======== '""""""""""""' '""""""""""""' '""""""""""' ========
======== ========
=====================================================================
=====================================================================

What is Kickstart?

Kickstart.nvim is *not* a distribution.

Kickstart.nvim is a starting point 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 can start exploring, configuring and tinkering to
make Neovim your own! That might mean leaving Kickstart just the way it is for a while
or immediately breaking it into modular pieces. It's up to you!

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

After understanding a bit more about Lua, you can use `:help lua-guide` as a
reference for how Neovim integrates Lua.
- :help lua-guide
- (or HTML version): https://neovim.io/doc/user/lua-guide.html

Kickstart Guide:

TODO: The very first thing you should do is to run the command `:Tutor` in Neovim.

If you don't know what this means, type the following:
- <escape key>
- :
- Tutor
- <enter key>

(If you already know the Neovim basics, you can skip this step.)

Once you've completed that, you can continue working through **AND READING** the rest
of the kickstart init.lua.

Next, run AND READ `:help`.
This will open up a help window with some basic information
about reading, navigating and searching the builtin help documentation.

This should be the first place you go to look when you're stuck or confused
with something. It's one of my favorite Neovim features.

MOST IMPORTANTLY, we provide a keymap "<space>sh" to [s]earch the [h]elp documentation,
which is very useful when you're not exactly sure of what you're looking for.

I have left several `:help X` comments throughout the init.lua
These are hints about where to find more information about the relevant settings,
plugins or Neovim features used in Kickstart.

NOTE: Look for lines like this

Throughout the file. These are for you, the reader, to help you 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 Neovim config.

If you experience any errors while trying to install kickstart, run `:checkhealth` for more info.

I hope you enjoy your Neovim journey,
- TJ

P.S. You can delete this when you're done too. It's your config now! :)
--]]

vim.api.nvim_set_keymap('n', 'Ø', ':E<CR>', { noremap = true, silent = true })
-- command line height standard 1
vim.opt.cmdheight = 1
vim.api.nvim_set_keymap('n', 'ø', ':call feedkeys("\\r")<CR>', { noremap = true, silent = true })
vim.api.nvim_set_keymap('v', 'ø', ':call feedkeys("\\r")<CR>', { noremap = true, silent = true })
vim.api.nvim_set_keymap('o', 'ø', ':call feedkeys("\\r")<CR>', { noremap = true, silent = true })
-- vim.api.nvim_set_keymap('n', 'ø', ":call feedkeys('\\<CR>')<CR>", { noremap = true, silent = true })
-- vim.api.nvim_set_keymap('v', 'ø', ":call feedkeys('\\<CR>')<CR>", { noremap = true, silent = true })
-- vim.api.nvim_set_keymap('o', 'ø', ":call feedkeys('\\<CR>')<CR>", { noremap = true, silent = true })
-- vim.api.nvim_set_keymap('n', 'ø', ":call feedkeys('\\'..'<CR>'..')<CR>", { noremap = true, silent = true })
-- vim.api.nvim_set_keymap('v', 'ø', ":call feedkeys('\\'..'<CR>'..')<CR>", { noremap = true, silent = true })
-- vim.api.nvim_set_keymap('o', 'ø', ":call feedkeys('\\'..'<CR>'..')<CR>", { noremap = true, silent = true })
-- Remap ø to <CR> in normal, visual, and operator-pending modes

-- Remap ø to <CR> in insert mode
vim.api.nvim_set_keymap('i', 'ø', '<CR>', { noremap = true, silent = true })

-- Remap æ to <Esc> in normal, visual, and operator-pending modes
vim.api.nvim_set_keymap('n', 'æ', '<Esc>', { noremap = true, silent = true })
vim.api.nvim_set_keymap('v', 'æ', '<Esc>', { noremap = true, silent = true })
vim.api.nvim_set_keymap('o', 'æ', '<Esc>', { noremap = true, silent = true })

-- Remap æ to <Esc> in insert mode
vim.api.nvim_set_keymap('i', 'æ', '<Esc>', { noremap = true, silent = true })

-- remap shift æ to delete and fn æ to backspace

-- Set <space> as the leader key
-- See `:help mapleader`
-- NOTE: Must happen before plugins are loaded (otherwise wrong leader will be used)
Expand All @@ -102,7 +50,7 @@ vim.g.have_nerd_font = false
vim.opt.number = true
-- You can also add relative line numbers, to help with jumping.
-- Experiment for yourself to see if you like it!
-- vim.opt.relativenumber = true
vim.opt.relativenumber = false

-- Enable mouse mode, can be useful for resizing splits for example!
vim.opt.mouse = 'a'
Expand Down Expand Up @@ -226,10 +174,27 @@ vim.opt.rtp:prepend(lazypath)
-- To update plugins you can run
-- :Lazy update
--

-- NOTE: Here is where you install your plugins.
require('lazy').setup({

{
'kylechui/nvim-surround',
version = '*', -- Use for stability; omit to use `main` branch for the latest features
event = 'VeryLazy',
config = function()
require('nvim-surround').setup {
-- Configuration here, or leave empty to use defaults
}
end,
},
-- NOTE: Plugins can be added with a link (or for a github repo: 'owner/repo' link).
'tpope/vim-sleuth', -- Detect tabstop and shiftwidth automatically
'sainnhe/gruvbox-material',
-- 'segeljakt/vim-silicon',

{ 'numToStr/Comment.nvim', opts = {} },
-- { 'tris203/precognition.nvim', opts = {} },

-- NOTE: Plugins can also be added by using a table,
-- with the first argument being the link and the following
Expand All @@ -238,6 +203,95 @@ require('lazy').setup({
-- Use `opts = {}` to force a plugin to be loaded.
--

-- This is equivalent to:
-- require('Comment').setup({})
{
'ThePrimeagen/harpoon',
branch = 'harpoon2',
dependencies = { 'nvim-lua/plenary.nvim' },
config = function()
local harpoon = require 'harpoon'

-- REQUIRED
harpoon:setup()
-- REQUIRED

vim.keymap.set('n', '<leader>a', function()
harpoon:list():add()
end)
vim.keymap.set('n', '<leader>h', function()
harpoon.ui:toggle_quick_menu(harpoon:list())
end)

vim.keymap.set('n', '<C-h>', function()
harpoon:list():select(1)
end)
vim.keymap.set('n', '<C-j>', function()
harpoon:list():select(2)
end)
vim.keymap.set('n', '<C-k>', function()
harpoon:list():select(3)
end)
vim.keymap.set('n', '<C-l>', function()
harpoon:list():select(4)
end)

-- Toggle previous & next buffers stored within Harpoon list
vim.keymap.set('n', '<C-S-P>', function()
harpoon:list():prev()
end)
vim.keymap.set('n', '<C-S-N>', function()
harpoon:list():next()
end)
local conf = require('telescope.config').values
local function toggle_telescope(harpoon_files)
local file_paths = {}
for _, item in ipairs(harpoon_files.items) do
table.insert(file_paths, item.value)
end

require('telescope.pickers')
.new({}, {
prompt_title = 'Harpoon',
finder = require('telescope.finders').new_table {
results = file_paths,
},
previewer = conf.file_previewer {},
sorter = conf.generic_sorter {},
})
:find()
end

vim.keymap.set('n', '<C-e>', function()
toggle_telescope(harpoon:list())
end, { desc = 'Open harpoon window' })
end,
},
-- "gc" to comment visual regions/lines
{ 'numToStr/Comment.nvim', opts = {} },


-- better editing for directories/files etc
{
'stevearc/oil.nvim',
---@module 'oil'
---@type oil.SetupOpts
opts = {},
-- Optional dependencies
dependencies = { { 'echasnovski/mini.icons', opts = {} } },
config = function()
require('oil').setup {
delete_to_trash = true,
view_options = {
-- Show files and directories that start with "."
show_hidden = true,
},
}
vim.keymap.set('n', '-', '<CMD>Oil<CR>', { desc = 'Open parent directory' })
end,
-- dependencies = { "nvim-tree/nvim-web-devicons" }, -- use if prefer nvim-web-devicons
},

-- Here is a more advanced example where we pass configuration
-- options to `gitsigns.nvim`. This is equivalent to the following Lua:
-- require('gitsigns').setup({ ... })
Expand Down Expand Up @@ -615,8 +669,16 @@ require('lazy').setup({
-- For example, to see the options for `lua_ls`, you could go to: https://luals.github.io/wiki/settings/
local servers = {
-- clangd = {},
-- gopls = {},
-- pyright = {},
gopls = {},
pyright = {},
html = {},
intelephense = {},
tsserver = {},
cssls = {},
vls = {},
volar = {
filetypes = { 'vue' }, -- Use volar specifically for Vue files
},
-- rust_analyzer = {},
-- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs
--
Expand Down Expand Up @@ -690,6 +752,17 @@ require('lazy').setup({
},
opts = {
notify_on_error = false,
keys = {
{
-- Customize or remove this keymap to your liking
'<leader>f',
function()
require('conform').format { async = true }
end,
mode = '',
desc = '[f]ormat buffer',
},
},
format_on_save = function(bufnr)
-- Disable "format_on_save lsp_fallback" for languages that don't
-- have a well standardized coding style. You can add additional
Expand All @@ -708,6 +781,8 @@ require('lazy').setup({
end,
formatters_by_ft = {
lua = { 'stylua' },
ocaml = { 'ocamlformat', 'ocp-indent' },
-- html = { { 'superhtml', 'djlint', 'htmlbeautifier' } },
-- Conform can also run multiple formatters sequentially
-- python = { "isort", "black" },
--
Expand Down Expand Up @@ -765,7 +840,11 @@ require('lazy').setup({
luasnip.lsp_expand(args.body)
end,
},
completion = { completeopt = 'menu,menuone,noinsert' },
completion = {
-- removes automatic autocomplete popup, just remove if regret(keep completeopt):
autocomplete = false,
completeopt = 'menu,menuone,noinsert',
},

-- For an understanding of why these mappings were
-- chosen, you will need to read `:help ins-completion`
Expand Down Expand Up @@ -832,20 +911,25 @@ require('lazy').setup({
}
end,
},

{ 'miikanissi/modus-themes.nvim', priority = 1000 },
{ -- You can easily change to a different colorscheme.
-- This is where i config colorscheme / theme of nvim
-- Change the name of the colorscheme plugin below, and then
-- change the command in the config to whatever the name of that colorscheme is.
--
-- If you want to see what colorschemes are already installed, you can use `:Telescope colorscheme`.
'folke/tokyonight.nvim',

'rebelot/kanagawa.nvim',
-- 'catppuccin/nvim',
priority = 1000, -- Make sure to load this before all the other start plugins.
init = function()
-- Load the colorscheme here.
-- Like many other themes, this one has different styles, and you could load
-- any other, such as 'tokyonight-storm', 'tokyonight-moon', or 'tokyonight-day'.
vim.cmd.colorscheme 'tokyonight-night'

-- vim.cmd.colorscheme 'kanagawa-dragon'
vim.cmd.colorscheme 'modus_vivendi'
-- vim.cmd.colorscheme 'rose-pine-dawn'
-- You can configure highlights by doing something like:
vim.cmd.hi 'Comment gui=none'
end,
Expand All @@ -867,7 +951,7 @@ require('lazy').setup({

-- Add/delete/replace surroundings (brackets, quotes, etc.)
--
-- - saiw) - [S]urround [A]dd [I]nner [W]ord [)]Paren
-- - siw) - [S]urround [A]dd [I]nner [W]ord [)]Paren
-- - sd' - [S]urround [D]elete [']quotes
-- - sr)' - [S]urround [R]eplace [)] [']
require('mini.surround').setup()
Expand Down Expand Up @@ -897,15 +981,16 @@ require('lazy').setup({
main = 'nvim-treesitter.configs', -- Sets main module to use for opts
-- [[ Configure Treesitter ]] See `:help nvim-treesitter`
opts = {
ensure_installed = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'markdown_inline', 'query', 'vim', 'vimdoc' },

ensure_installed = { 'bash', 'c', 'html', 'lua', 'markdown', 'vim', 'vimdoc', 'css', 'javascript', 'ocaml', 'diff',, 'markdown_inline', 'query' },
-- Autoinstall languages that are not installed
auto_install = true,
highlight = {
enable = true,
-- Some languages depend on vim's regex highlighting system (such as Ruby) for indent rules.
-- If you are experiencing weird indenting issues, add the language to
-- the list of additional_vim_regex_highlighting and disabled languages for indent.
additional_vim_regex_highlighting = { 'ruby' },
additional_vim_regex_highlighting = { 'ruby', 'ocaml' },
},
indent = { enable = true, disable = { 'ruby' } },
},
Expand Down Expand Up @@ -937,12 +1022,17 @@ require('lazy').setup({
-- This is the easiest way to modularize your config.
--
-- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going.

-- For additional information, see `:help lazy.nvim-lazy.nvim-structuring-your-plugins`
-- { import = 'custom.plugins' }

-- { import = 'custom.plugins' },
--
-- For additional information with loading, sourcing and examples see `:help lazy.nvim-🔌-plugin-spec`
-- Or use telescope!
-- In normal mode type `<space>sh` then write `lazy.nvim-plugin`
-- you can continue same window with `<space>sr` which resumes last telescope search

}, {
ui = {
-- If you are using a Nerd Font: set icons to an empty table which will use the
Expand Down
Loading
Loading