|
|
|
@ -1,93 +1,52 @@
|
|
|
|
|
--[[
|
|
|
|
|
--
|
|
|
|
|
--[[
|
|
|
|
|
-- nicholas nvim config
|
|
|
|
|
-- created from kickstart.nvim
|
|
|
|
|
--
|
|
|
|
|
--
|
|
|
|
|
--
|
|
|
|
|
--]]
|
|
|
|
|
|
|
|
|
|
vim.opt.shiftwidth = 4
|
|
|
|
|
vim.opt.tabstop = 4
|
|
|
|
|
---@diagnostic disable: missing-fields
|
|
|
|
|
|
|
|
|
|
-- Set <space> as the leader key
|
|
|
|
|
-- See `:help mapleader`
|
|
|
|
|
-- NOTE: Must happen before plugins are loaded (otherwise wrong leader will be used)
|
|
|
|
|
vim.g.mapleader = ' '
|
|
|
|
|
vim.g.maplocalleader = ' '
|
|
|
|
|
|
|
|
|
|
-- Set to true if you have a Nerd Font installed and selected in the terminal
|
|
|
|
|
vim.g.have_nerd_font = true
|
|
|
|
|
|
|
|
|
|
-- [[ Setting options ]]
|
|
|
|
|
-- See `:help vim.opt`
|
|
|
|
|
-- NOTE: You can change these options as you wish!
|
|
|
|
|
-- For more options, you can see `:help option-list`
|
|
|
|
|
vim.opt.shiftwidth = 4
|
|
|
|
|
vim.opt.tabstop = 4
|
|
|
|
|
|
|
|
|
|
-- Make line numbers default
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
-- Enable mouse mode, can be useful for resizing splits for example!
|
|
|
|
|
vim.opt.mouse = 'a'
|
|
|
|
|
vim.opt.showmode = true
|
|
|
|
|
|
|
|
|
|
-- Don't show the mode, since it's already in the status line
|
|
|
|
|
vim.opt.showmode = false
|
|
|
|
|
|
|
|
|
|
-- Sync clipboard between OS and Neovim.
|
|
|
|
|
-- Schedule the setting after `UiEnter` because it can increase startup-time.
|
|
|
|
|
-- Remove this option if you want your OS clipboard to remain independent.
|
|
|
|
|
-- See `:help 'clipboard'`
|
|
|
|
|
vim.schedule(function()
|
|
|
|
|
vim.opt.clipboard = 'unnamedplus'
|
|
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
-- Enable break indent
|
|
|
|
|
vim.opt.breakindent = true
|
|
|
|
|
|
|
|
|
|
-- Save undo history
|
|
|
|
|
vim.opt.undofile = true
|
|
|
|
|
|
|
|
|
|
-- Case-insensitive searching UNLESS \C or one or more capital letters in the search term
|
|
|
|
|
vim.opt.ignorecase = true
|
|
|
|
|
vim.opt.smartcase = true
|
|
|
|
|
|
|
|
|
|
-- Keep signcolumn on by default
|
|
|
|
|
vim.opt.signcolumn = 'yes'
|
|
|
|
|
|
|
|
|
|
-- Decrease update time
|
|
|
|
|
vim.opt.updatetime = 250
|
|
|
|
|
|
|
|
|
|
-- Decrease mapped sequence wait time
|
|
|
|
|
-- Displays which-key popup sooner
|
|
|
|
|
vim.opt.timeoutlen = 300
|
|
|
|
|
|
|
|
|
|
-- Configure how new splits should be opened
|
|
|
|
|
vim.opt.splitright = true
|
|
|
|
|
vim.opt.splitbelow = true
|
|
|
|
|
|
|
|
|
|
-- Sets how neovim will display certain whitespace characters in the editor.
|
|
|
|
|
-- See `:help 'list'`
|
|
|
|
|
-- and `:help 'listchars'`
|
|
|
|
|
vim.opt.list = true
|
|
|
|
|
vim.opt.listchars = { tab = '» ', trail = '·', nbsp = '·' }
|
|
|
|
|
|
|
|
|
|
-- Preview substitutions live, as you type!
|
|
|
|
|
vim.opt.inccommand = 'split'
|
|
|
|
|
|
|
|
|
|
-- Show which line your cursor is on
|
|
|
|
|
vim.opt.cursorline = true
|
|
|
|
|
|
|
|
|
|
-- Minimal number of screen lines to keep above and below the cursor.
|
|
|
|
|
vim.opt.scrolloff = 10
|
|
|
|
|
|
|
|
|
|
-- [[ Basic Keymaps ]]
|
|
|
|
|
-- See `:help vim.keymap.set()`
|
|
|
|
|
vim.opt.scrolloff = 6
|
|
|
|
|
|
|
|
|
|
-- Clear highlights on search when pressing <Esc> in normal mode
|
|
|
|
|
-- See `:help hlsearch`
|
|
|
|
|
vim.keymap.set('n', '<Esc>', '<cmd>nohlsearch<CR>')
|
|
|
|
|
|
|
|
|
|
-- Diagnostic keymaps
|
|
|
|
@ -96,32 +55,20 @@ vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagn
|
|
|
|
|
-- Exit terminal mode in the builtin terminal with a shortcut that is a bit easier
|
|
|
|
|
-- for people to discover. Otherwise, you normally need to press <C-\><C-n>, which
|
|
|
|
|
-- is not what someone will guess without a bit more experience.
|
|
|
|
|
--
|
|
|
|
|
-- NOTE: This won't work in all terminal emulators/tmux/etc. Try your own mapping
|
|
|
|
|
-- or just use <C-\><C-n> to exit terminal mode
|
|
|
|
|
vim.keymap.set('t', '<Esc><Esc>', '<C-\\><C-n>', { desc = 'Exit terminal mode' })
|
|
|
|
|
|
|
|
|
|
-- TIP: Disable arrow keys in normal mode
|
|
|
|
|
vim.keymap.set('n', '<left>', '<cmd>echo "Use h to move!!"<CR>')
|
|
|
|
|
vim.keymap.set('n', '<right>', '<cmd>echo "Use l to move!!"<CR>')
|
|
|
|
|
vim.keymap.set('n', '<up>', '<cmd>echo "Use k to move!!"<CR>')
|
|
|
|
|
vim.keymap.set('n', '<down>', '<cmd>echo "Use j to move!!"<CR>')
|
|
|
|
|
|
|
|
|
|
-- Keybinds to make split navigation easier.
|
|
|
|
|
-- Use CTRL+<hjkl> to switch between windows
|
|
|
|
|
--
|
|
|
|
|
-- See `:help wincmd` for a list of all window commands
|
|
|
|
|
vim.keymap.set('n', '<C-h>', '<C-w><C-h>', { desc = 'Move focus to the left window' })
|
|
|
|
|
vim.keymap.set('n', '<C-l>', '<C-w><C-l>', { desc = 'Move focus to the right window' })
|
|
|
|
|
vim.keymap.set('n', '<C-j>', '<C-w><C-j>', { desc = 'Move focus to the lower window' })
|
|
|
|
|
vim.keymap.set('n', '<C-k>', '<C-w><C-k>', { desc = 'Move focus to the upper window' })
|
|
|
|
|
|
|
|
|
|
-- [[ Basic Autocommands ]]
|
|
|
|
|
-- See `:help lua-guide-autocommands`
|
|
|
|
|
|
|
|
|
|
-- Highlight when yanking (copying) text
|
|
|
|
|
-- Try it with `yap` in normal mode
|
|
|
|
|
-- See `:help vim.highlight.on_yank()`
|
|
|
|
|
vim.api.nvim_create_autocmd('TextYankPost', {
|
|
|
|
|
desc = 'Highlight when yanking (copying) text',
|
|
|
|
|
group = vim.api.nvim_create_augroup('kickstart-highlight-yank', { clear = true }),
|
|
|
|
@ -130,8 +77,6 @@ vim.api.nvim_create_autocmd('TextYankPost', {
|
|
|
|
|
end,
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
-- [[ Install `lazy.nvim` plugin manager ]]
|
|
|
|
|
-- See `:help lazy.nvim.txt` or https://github.com/folke/lazy.nvim for more info
|
|
|
|
|
local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim'
|
|
|
|
|
if not (vim.uv or vim.loop).fs_stat(lazypath) then
|
|
|
|
|
local lazyrepo = 'https://github.com/folke/lazy.nvim.git'
|
|
|
|
@ -142,32 +87,10 @@ if not (vim.uv or vim.loop).fs_stat(lazypath) then
|
|
|
|
|
end ---@diagnostic disable-next-line: undefined-field
|
|
|
|
|
vim.opt.rtp:prepend(lazypath)
|
|
|
|
|
|
|
|
|
|
-- [[ Configure and install plugins ]]
|
|
|
|
|
--
|
|
|
|
|
-- To check the current status of your plugins, run
|
|
|
|
|
-- :Lazy
|
|
|
|
|
--
|
|
|
|
|
-- You can press `?` in this menu for help. Use `:q` to close the window
|
|
|
|
|
--
|
|
|
|
|
-- To update plugins you can run
|
|
|
|
|
-- :Lazy update
|
|
|
|
|
--
|
|
|
|
|
-- NOTE: Here is where you install your plugins.
|
|
|
|
|
require('lazy').setup({
|
|
|
|
|
-- NOTE: Plugins can be added with a link (or for a github repo: 'owner/repo' link).
|
|
|
|
|
'tpope/vim-sleuth', -- Detect tabstop and shiftwidth automatically
|
|
|
|
|
|
|
|
|
|
-- NOTE: Plugins can also be added by using a table,
|
|
|
|
|
-- with the first argument being the link and the following
|
|
|
|
|
-- keys can be used to configure plugin behavior/loading/etc.
|
|
|
|
|
--
|
|
|
|
|
-- Use `opts = {}` to force a plugin to be loaded.
|
|
|
|
|
--
|
|
|
|
|
|
|
|
|
|
-- Here is a more advanced example where we pass configuration
|
|
|
|
|
-- options to `gitsigns.nvim`. This is equivalent to the following Lua:
|
|
|
|
|
-- require('gitsigns').setup({ ... })
|
|
|
|
|
--
|
|
|
|
|
-- See `:help gitsigns` to understand what the configuration keys do
|
|
|
|
|
{ -- Adds git related signs to the gutter, as well as utilities for managing changes
|
|
|
|
|
'lewis6991/gitsigns.nvim',
|
|
|
|
@ -182,30 +105,12 @@ require('lazy').setup({
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
-- NOTE: Plugins can also be configured to run Lua code when they are loaded.
|
|
|
|
|
--
|
|
|
|
|
-- This is often very useful to both group configuration, as well as handle
|
|
|
|
|
-- lazy loading plugins that don't need to be loaded immediately at startup.
|
|
|
|
|
--
|
|
|
|
|
-- For example, in the following configuration, we use:
|
|
|
|
|
-- event = 'VimEnter'
|
|
|
|
|
--
|
|
|
|
|
-- which loads which-key before all the UI elements are loaded. Events can be
|
|
|
|
|
-- normal autocommands events (`:help autocmd-events`).
|
|
|
|
|
--
|
|
|
|
|
-- Then, because we use the `config` key, the configuration only runs
|
|
|
|
|
-- after the plugin has been loaded:
|
|
|
|
|
-- config = function() ... end
|
|
|
|
|
|
|
|
|
|
{ -- Useful plugin to show you pending keybinds.
|
|
|
|
|
{
|
|
|
|
|
'folke/which-key.nvim',
|
|
|
|
|
event = 'VimEnter', -- Sets the loading event to 'VimEnter'
|
|
|
|
|
opts = {
|
|
|
|
|
icons = {
|
|
|
|
|
-- set icon mappings to true if you have a Nerd Font
|
|
|
|
|
mappings = vim.g.have_nerd_font,
|
|
|
|
|
-- If you are using a Nerd Font: set icons.keys to an empty table which will use the
|
|
|
|
|
-- default whick-key.nvim defined Nerd Font icons, otherwise define a string table
|
|
|
|
|
keys = vim.g.have_nerd_font and {} or {
|
|
|
|
|
Up = '<Up> ',
|
|
|
|
|
Down = '<Down> ',
|
|
|
|
@ -240,7 +145,7 @@ require('lazy').setup({
|
|
|
|
|
|
|
|
|
|
-- Document existing key chains
|
|
|
|
|
spec = {
|
|
|
|
|
{ '<leader>c', group = '[C]ode', mode = { 'n', 'x' } },
|
|
|
|
|
{ '<leader>c', group = '[C]ode', mode = { 'n', 'x' } },
|
|
|
|
|
{ '<leader>d', group = '[D]ocument' },
|
|
|
|
|
{ '<leader>r', group = '[R]ename' },
|
|
|
|
|
{ '<leader>s', group = '[S]earch' },
|
|
|
|
@ -250,37 +155,21 @@ require('lazy').setup({
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
-- NOTE: Plugins can specify dependencies.
|
|
|
|
|
--
|
|
|
|
|
-- The dependencies are proper plugin specifications as well - anything
|
|
|
|
|
-- you do for a plugin at the top level, you can do for a dependency.
|
|
|
|
|
--
|
|
|
|
|
-- Use the `dependencies` key to specify the dependencies of a particular plugin
|
|
|
|
|
|
|
|
|
|
{ -- Fuzzy Finder (files, lsp, etc)
|
|
|
|
|
'nvim-telescope/telescope.nvim',
|
|
|
|
|
event = 'VimEnter',
|
|
|
|
|
branch = '0.1.x',
|
|
|
|
|
dependencies = {
|
|
|
|
|
'nvim-lua/plenary.nvim',
|
|
|
|
|
{ -- If encountering errors, see telescope-fzf-native README for installation instructions
|
|
|
|
|
{
|
|
|
|
|
'nvim-telescope/telescope-fzf-native.nvim',
|
|
|
|
|
|
|
|
|
|
-- `build` is used to run some command when the plugin is installed/updated.
|
|
|
|
|
-- This is only run then, not every time Neovim starts up.
|
|
|
|
|
build = 'make',
|
|
|
|
|
|
|
|
|
|
-- `cond` is a condition used to determine whether this plugin should be
|
|
|
|
|
-- installed and loaded.
|
|
|
|
|
cond = function()
|
|
|
|
|
return vim.fn.executable 'make' == 1
|
|
|
|
|
end,
|
|
|
|
|
},
|
|
|
|
|
{ 'nvim-telescope/telescope-ui-select.nvim' },
|
|
|
|
|
|
|
|
|
|
-- Useful for getting pretty icons, but requires a Nerd Font.
|
|
|
|
|
{ 'nvim-tree/nvim-web-devicons', enabled = vim.g.have_nerd_font },
|
|
|
|
|
{ 'nvim-tree/nvim-web-devicons', enabled = vim.g.have_nerd_font },
|
|
|
|
|
},
|
|
|
|
|
config = function()
|
|
|
|
|
-- Telescope is a fuzzy finder that comes with a lot of different things that
|
|
|
|
@ -302,18 +191,8 @@ require('lazy').setup({
|
|
|
|
|
-- Telescope picker. This is really useful to discover what Telescope can
|
|
|
|
|
-- do as well as how to actually do it!
|
|
|
|
|
|
|
|
|
|
-- [[ Configure Telescope ]]
|
|
|
|
|
-- See `:help telescope` and `:help telescope.setup()`
|
|
|
|
|
require('telescope').setup {
|
|
|
|
|
-- You can put your default mappings / updates / etc. in here
|
|
|
|
|
-- All the info you're looking for is in `:help telescope.setup()`
|
|
|
|
|
--
|
|
|
|
|
-- defaults = {
|
|
|
|
|
-- mappings = {
|
|
|
|
|
-- i = { ['<c-enter>'] = 'to_fuzzy_refine' },
|
|
|
|
|
-- },
|
|
|
|
|
-- },
|
|
|
|
|
-- pickers = {}
|
|
|
|
|
extensions = {
|
|
|
|
|
['ui-select'] = {
|
|
|
|
|
require('telescope.themes').get_dropdown(),
|
|
|
|
@ -321,7 +200,6 @@ require('lazy').setup({
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
-- Enable Telescope extensions if they are installed
|
|
|
|
|
pcall(require('telescope').load_extension, 'fzf')
|
|
|
|
|
pcall(require('telescope').load_extension, 'ui-select')
|
|
|
|
|
|
|
|
|
@ -376,7 +254,7 @@ require('lazy').setup({
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
{ 'Bilal2453/luvit-meta', lazy = true },
|
|
|
|
|
{ 'Bilal2453/luvit-meta', lazy = true },
|
|
|
|
|
{
|
|
|
|
|
-- Main LSP Configuration
|
|
|
|
|
'neovim/nvim-lspconfig',
|
|
|
|
@ -388,7 +266,7 @@ require('lazy').setup({
|
|
|
|
|
|
|
|
|
|
-- Useful status updates for LSP.
|
|
|
|
|
-- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})`
|
|
|
|
|
{ 'j-hui/fidget.nvim', opts = {} },
|
|
|
|
|
{ 'j-hui/fidget.nvim', opts = {} },
|
|
|
|
|
|
|
|
|
|
-- Allows extra capabilities provided by nvim-cmp
|
|
|
|
|
'hrsh7th/cmp-nvim-lsp',
|
|
|
|
|