init
This commit is contained in:
parent
f0a2108ed5
commit
f2115e20e0
146
init.lua
146
init.lua
|
|
@ -1,89 +1,3 @@
|
||||||
--[[
|
|
||||||
|
|
||||||
=====================================================================
|
|
||||||
==================== 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! :)
|
|
||||||
--]]
|
|
||||||
|
|
||||||
-- ============================================================
|
-- ============================================================
|
||||||
-- SECTION 1: OPTIONS
|
-- SECTION 1: OPTIONS
|
||||||
-- Core Neovim settings, leaders, options, basic keymaps, basic autocmds
|
-- Core Neovim settings, leaders, options, basic keymaps, basic autocmds
|
||||||
|
|
@ -186,7 +100,7 @@ do
|
||||||
vim.keymap.set('n', '<Esc>', '<cmd>nohlsearch<CR>')
|
vim.keymap.set('n', '<Esc>', '<cmd>nohlsearch<CR>')
|
||||||
|
|
||||||
-- Diagnostic Config & Keymaps
|
-- Diagnostic Config & Keymaps
|
||||||
-- See `:help vim.diagnostic.Opts`
|
-- See :help vim.diagnostic.Opts
|
||||||
vim.diagnostic.config {
|
vim.diagnostic.config {
|
||||||
update_in_insert = false,
|
update_in_insert = false,
|
||||||
severity_sort = true,
|
severity_sort = true,
|
||||||
|
|
@ -471,7 +385,7 @@ do
|
||||||
-- a corresponding preview of the help.
|
-- a corresponding preview of the help.
|
||||||
--
|
--
|
||||||
-- Two important keymaps to use while in Telescope are:
|
-- Two important keymaps to use while in Telescope are:
|
||||||
-- - Insert mode: <c-/>
|
-- - Insert mode: <c-/>\
|
||||||
-- - Normal mode: ?
|
-- - Normal mode: ?
|
||||||
--
|
--
|
||||||
-- This opens a window that shows you all of the keymaps for the current
|
-- This opens a window that shows you all of the keymaps for the current
|
||||||
|
|
@ -519,7 +433,7 @@ do
|
||||||
vim.keymap.set('n', '<leader>sg', builtin.live_grep, { desc = '[S]earch by [G]rep' })
|
vim.keymap.set('n', '<leader>sg', builtin.live_grep, { desc = '[S]earch by [G]rep' })
|
||||||
vim.keymap.set('n', '<leader>sd', builtin.diagnostics, { desc = '[S]earch [D]iagnostics' })
|
vim.keymap.set('n', '<leader>sd', builtin.diagnostics, { desc = '[S]earch [D]iagnostics' })
|
||||||
vim.keymap.set('n', '<leader>sr', builtin.resume, { desc = '[S]earch [R]esume' })
|
vim.keymap.set('n', '<leader>sr', builtin.resume, { desc = '[S]earch [R]esume' })
|
||||||
vim.keymap.set('n', '<leader>s.', builtin.oldfiles, { desc = '[S]earch Recent Files ("." for repeat)' })
|
vim.keymap.set('n', '<leader>s.', builtin.oldfiles, { desc = '[S]earch Recent Files (".") for repeat)' })
|
||||||
vim.keymap.set('n', '<leader>sc', builtin.commands, { desc = '[S]earch [C]ommands' })
|
vim.keymap.set('n', '<leader>sc', builtin.commands, { desc = '[S]earch [C]ommands' })
|
||||||
vim.keymap.set('n', '<leader><leader>', builtin.buffers, { desc = '[ ] Find existing buffers' })
|
vim.keymap.set('n', '<leader><leader>', builtin.buffers, { desc = '[ ] Find existing buffers' })
|
||||||
|
|
||||||
|
|
@ -851,7 +765,7 @@ do
|
||||||
-- <c-e>: Hide menu
|
-- <c-e>: Hide menu
|
||||||
-- <c-k>: Toggle signature help
|
-- <c-k>: Toggle signature help
|
||||||
--
|
--
|
||||||
-- See `:help blink-cmp-config-keymap` for defining your own keymap
|
-- See :h blink-cmp-config-keymap for defining your own keymap
|
||||||
preset = 'default',
|
preset = 'default',
|
||||||
|
|
||||||
-- For more advanced Luasnip keymaps (e.g. selecting choice nodes, expansion) see:
|
-- For more advanced Luasnip keymaps (e.g. selecting choice nodes, expansion) see:
|
||||||
|
|
@ -882,7 +796,7 @@ do
|
||||||
-- By default, we use the Lua implementation instead, but you may enable
|
-- By default, we use the Lua implementation instead, but you may enable
|
||||||
-- the rust implementation via `'prefer_rust_with_warning'`
|
-- the rust implementation via `'prefer_rust_with_warning'`
|
||||||
--
|
--
|
||||||
-- See `:help blink-cmp-config-fuzzy` for more information
|
-- See :h blink-cmp-config-fuzzy for more information
|
||||||
fuzzy = { implementation = 'lua' },
|
fuzzy = { implementation = 'lua' },
|
||||||
|
|
||||||
-- Shows a signature help window while you type arguments for a function
|
-- Shows a signature help window while you type arguments for a function
|
||||||
|
|
@ -967,17 +881,55 @@ do
|
||||||
-- Uncomment any of the lines below to enable them (you will need to restart nvim).
|
-- Uncomment any of the lines below to enable them (you will need to restart nvim).
|
||||||
--
|
--
|
||||||
-- require 'kickstart.plugins.debug'
|
-- require 'kickstart.plugins.debug'
|
||||||
-- require 'kickstart.plugins.indent_line'
|
--require 'kickstart.plugins.indent_line'
|
||||||
-- require 'kickstart.plugins.lint'
|
--require 'kickstart.plugins.lint'
|
||||||
-- require 'kickstart.plugins.autopairs'
|
--require 'kickstart.plugins.autopairs'
|
||||||
-- require 'kickstart.plugins.neo-tree'
|
--require 'kickstart.plugins.neo-tree'
|
||||||
-- require 'kickstart.plugins.gitsigns' -- adds gitsigns recommended keymaps
|
--require 'kickstart.plugins.gitsigns' -- adds gitsigns recommended keymaps
|
||||||
|
|
||||||
-- NOTE: You can add your own plugins, configuration, etc from `lua/custom/plugins/*.lua`
|
-- NOTE: You can add your own plugins, configuration, etc from `lua/custom/plugins/*.lua`
|
||||||
--
|
--
|
||||||
-- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going.
|
-- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going.
|
||||||
-- require 'custom.plugins'
|
--require 'custom.plugins'
|
||||||
end
|
end
|
||||||
|
|
||||||
-- The line beneath this is called `modeline`. See `:help modeline`
|
-- The line beneath this is called `modeline`. See `:help modeline`
|
||||||
-- vim: ts=2 sts=2 sw=2 et
|
-- vim: ts=2 sts=2 sw=2 et
|
||||||
|
|
||||||
|
-- [[ Custom Keymaps ]]
|
||||||
|
-- Page up/down scrolling
|
||||||
|
vim.keymap.set(
|
||||||
|
'n',
|
||||||
|
'<PageUp>',
|
||||||
|
function() vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes('<C-u>', true, true, true), 'n', true) end,
|
||||||
|
{ desc = 'Page Up' }
|
||||||
|
)
|
||||||
|
|
||||||
|
vim.keymap.set(
|
||||||
|
'n',
|
||||||
|
'<PageDown>',
|
||||||
|
function() vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes('<C-d>', true, true, true), 'n', true) end,
|
||||||
|
{ desc = 'Page Down' }
|
||||||
|
)
|
||||||
|
|
||||||
|
-- Save current file with Ctrl+S in insert and normal mode
|
||||||
|
vim.api.nvim_set_keymap('i', '<C-s>', '<Esc>:w<CR>a', { noremap = true, silent = true })
|
||||||
|
vim.api.nvim_set_keymap('n', '<C-s>', '<Esc>:w<CR>', { noremap = true, silent = true })
|
||||||
|
|
||||||
|
-- Custom highlight groups for better syntax highlighting
|
||||||
|
vim.api.nvim_set_hl(0, '@function', { fg = '#EBCB8B', bold = true })
|
||||||
|
vim.api.nvim_set_hl(0, '@function.builtin', { fg = '#EBCB8B' })
|
||||||
|
vim.api.nvim_set_hl(0, '@method', { fg = '#EBCB8B' })
|
||||||
|
vim.api.nvim_set_hl(0, '@type', { fg = '#82AAFF', italic = true })
|
||||||
|
|
||||||
|
-- Enable bicep LSP with specific configuration
|
||||||
|
vim.filetype.add { extension = { bicep = 'bicep', bicepparam = 'bicepparam' } }
|
||||||
|
|
||||||
|
pcall(vim.treesitter.language.register, 'bicep', 'bicepparam')
|
||||||
|
|
||||||
|
vim.lsp.config('bicep', {
|
||||||
|
cmd = { vim.fn.expand '~/.local/share/nvim/mason/bin/bicep-lsp' },
|
||||||
|
filetypes = { 'bicep', 'bicep-params' },
|
||||||
|
root_markers = { '.git', 'bicepconfig.json' },
|
||||||
|
workspace_required = false,
|
||||||
|
})
|
||||||
|
|
|
||||||
|
|
@ -3,11 +3,4 @@
|
||||||
--
|
--
|
||||||
-- See the kickstart.nvim README for more information
|
-- See the kickstart.nvim README for more information
|
||||||
|
|
||||||
-- Iterate over all Lua files in the plugins directory and load them
|
return {}
|
||||||
local plugins_dir = vim.fs.joinpath(vim.fn.stdpath 'config', 'lua', 'custom', 'plugins')
|
|
||||||
for file_name, type in vim.fs.dir(plugins_dir, { follow = true }) do
|
|
||||||
if (type == 'file' or type == 'link') and file_name:match '%.lua$' and file_name ~= 'init.lua' then
|
|
||||||
local module = file_name:gsub('%.lua$', '')
|
|
||||||
require('custom.plugins.' .. module)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
@ -1,20 +1,132 @@
|
||||||
-- Neo-tree is a Neovim plugin to browse the file system
|
-- Neo-tree is a Neovim plugin to browse the file system
|
||||||
-- https://github.com/nvim-neo-tree/neo-tree.nvim
|
-- https://github.com/nvim-neo-tree/neo-tree.nvim
|
||||||
|
|
||||||
vim.pack.add {
|
local neo_tree_spec = {
|
||||||
{ src = 'https://github.com/nvim-neo-tree/neo-tree.nvim', version = vim.version.range '*' },
|
src = 'https://github.com/nvim-neo-tree/neo-tree.nvim',
|
||||||
'https://github.com/nvim-lua/plenary.nvim',
|
version = vim.version.range '*',
|
||||||
'https://github.com/MunifTanjim/nui.nvim',
|
dependencies = {
|
||||||
}
|
'nvim-lua/plenary.nvim',
|
||||||
|
'MunifTanjim/nui.nvim',
|
||||||
vim.keymap.set('n', '\\', '<Cmd>Neotree reveal<CR>', { desc = 'NeoTree reveal', silent = true })
|
|
||||||
|
|
||||||
require('neo-tree').setup {
|
|
||||||
filesystem = {
|
|
||||||
window = {
|
|
||||||
mappings = {
|
|
||||||
['\\'] = 'close_window',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
vim.pack.add(neo_tree_spec)
|
||||||
|
|
||||||
|
require('neo-tree').setup {
|
||||||
|
-- Show file explorer by default on NeoTree open
|
||||||
|
default_file_explorer = true,
|
||||||
|
|
||||||
|
-- Components which are displayed in the neo-tree window
|
||||||
|
components = {
|
||||||
|
'file_icons', -- File icons
|
||||||
|
'filename', -- File names
|
||||||
|
'modified', -- Modified file indicators
|
||||||
|
'git_status', -- Git status (when available via gitsigns)
|
||||||
|
'group_empty', -- Empty folder markers
|
||||||
|
'buffers_indicator' -- Buffer indicator icons
|
||||||
|
},
|
||||||
|
|
||||||
|
window = {
|
||||||
|
position = 'left', -- Position: left | right | bottom | top
|
||||||
|
width = 35, -- Width of the neo-tree window
|
||||||
|
close_if_last_window = true, -- Close neo-tree if it's the only window
|
||||||
|
float = {
|
||||||
|
enabled = true, -- Enable floating windows (for file creation)
|
||||||
|
padding = 2, -- Padding around floating windows
|
||||||
|
border = 'single', -- Border style
|
||||||
|
position = '50%', -- Position: 50% center
|
||||||
|
size = {
|
||||||
|
width = '50%', -- Width percentage of floating window
|
||||||
|
height = '80%' -- Height percentage of floating window
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
-- Configuration for filesystem source (files, folders)
|
||||||
|
filesystem = {
|
||||||
|
filtered_items = {
|
||||||
|
visibility = 'all', -- Show: all | visible_filtered | filtered
|
||||||
|
hide_dotfiles = false, -- Hide files starting with .
|
||||||
|
hide_gitignored = false, -- Hide git-ignored files
|
||||||
|
always_show_path = true, -- Always show file paths in the tree view
|
||||||
|
always_show_root = true -- Always show root directory when entering it
|
||||||
|
},
|
||||||
|
|
||||||
|
default_component_config = {
|
||||||
|
indent_markers = {
|
||||||
|
enable = true,
|
||||||
|
highlight_groups = {
|
||||||
|
folder_open = function(_, item_data)
|
||||||
|
local group_name = 'NeoTreeIndentMarker'
|
||||||
|
if item_data.item.type == 'directory' then
|
||||||
|
return group_name .. '.open'
|
||||||
|
end
|
||||||
|
return group_name .. '.closed'
|
||||||
|
end,
|
||||||
|
folder_closed = function(_, item_data)
|
||||||
|
local group_name = 'NeoTreeIndentMarker'
|
||||||
|
if item_data.item.type == 'directory' then
|
||||||
|
return group_name .. '.closed'
|
||||||
|
end
|
||||||
|
return group_name .. '.open'
|
||||||
|
end,
|
||||||
|
default = 'NeoTreeIndentMarker'
|
||||||
|
},
|
||||||
|
},
|
||||||
|
icons = {
|
||||||
|
folder_open = '',
|
||||||
|
folder_closed = '',
|
||||||
|
default = '', -- empty string for non-folder items
|
||||||
|
git = {
|
||||||
|
modified = '↗︎', -- Git modified file icon
|
||||||
|
unstaged = '✗', -- Git unstaged changes
|
||||||
|
staged = '↙︎', -- Git staged changes
|
||||||
|
ignored = '↖︎' -- Git ignored file
|
||||||
|
}
|
||||||
|
},
|
||||||
|
indent_guides = true, -- Show indentation guides for tree structure
|
||||||
|
},
|
||||||
|
|
||||||
|
use_default_document_colors = false,
|
||||||
|
auto_clean_after_buffer_close = true, -- Automatically clean up after closing files
|
||||||
|
},
|
||||||
|
|
||||||
|
buffers = {
|
||||||
|
show_unloaded = true, -- Show unloaded buffers in the tree
|
||||||
|
mapped_names = true, -- Use mapped names for buffer icons/names
|
||||||
|
get_buffer_icon = function(buffer)
|
||||||
|
if vim.bo[buffer].modified then return '✹' end
|
||||||
|
if vim.bo[buffer].readonly then return '📖' end
|
||||||
|
if vim.bo[buffer].filetype == 'NERDTree' then return '' end
|
||||||
|
return ''
|
||||||
|
end,
|
||||||
|
get_buffer_name = function(buffer)
|
||||||
|
local bufname = vim.api.nvim_buf_get_name(buffer)
|
||||||
|
-- Get short path by removing prefix up to first slash
|
||||||
|
if bufname:find('/') then
|
||||||
|
return bufname:gsub('.*(%p)[^-]*-', '')
|
||||||
|
end
|
||||||
|
return bufname
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
git_status = {
|
||||||
|
use_icons_for_git_status = true,
|
||||||
|
icons = {
|
||||||
|
unstaged_changes = { symbol = '✗', color = 'red' },
|
||||||
|
staged_changes = { symbol = '↙︎', color = 'green' },
|
||||||
|
ignored_files = { symbol = '↖︎', color = 'gray' }
|
||||||
|
},
|
||||||
|
file_icons = {
|
||||||
|
modified = 'M',
|
||||||
|
added = '+',
|
||||||
|
deleted = 'D',
|
||||||
|
ignored = 'i'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
-- Add convenient mappings for neo-tree using which-key
|
||||||
|
vim.keymap.set('n', '<leader>ff', ':Neotree filesystem toggle<CR>', { desc = 'Toggle file explorer' })
|
||||||
|
vim.keymap.set('n', '<leader>fb', ':Neotree buffers toggle<CR>', { desc = 'Toggle buffer explorer' })
|
||||||
|
vim.keymap.set('n', '<leader>fF', ':Neotree float open<CR>', { desc = 'Open floating window' })
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue