pretty stable
commit while things are pretty much working how I like
This commit is contained in:
parent
4120893b8a
commit
5edfba8462
7 changed files with 254 additions and 185 deletions
317
init.lua
317
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! :)
|
||||
--]]
|
||||
|
||||
-- Set <space> as the leader key
|
||||
-- See `:help mapleader`
|
||||
-- NOTE: Must happen before plugins are loaded (otherwise wrong leader will be used)
|
||||
|
|
@ -91,7 +5,7 @@ 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 = false
|
||||
vim.g.have_nerd_font = true
|
||||
|
||||
-- [[ Setting options ]]
|
||||
-- See `:help vim.opt`
|
||||
|
|
@ -118,6 +32,9 @@ vim.schedule(function()
|
|||
vim.opt.clipboard = 'unnamedplus'
|
||||
end)
|
||||
|
||||
-- Set syntax highlighting for .hujson to json
|
||||
vim.cmd [[au BufNewFile,BufRead *.hujson setf json]]
|
||||
|
||||
-- Enable break indent
|
||||
vim.opt.breakindent = true
|
||||
|
||||
|
|
@ -162,8 +79,27 @@ vim.opt.scrolloff = 10
|
|||
|
||||
-- Clear highlights on search when pressing <Esc> in normal mode
|
||||
-- See `:help hlsearch`
|
||||
|
||||
vim.keymap.set('n', '<Esc>', '<cmd>nohlsearch<CR>')
|
||||
|
||||
-- Buffer keymaps
|
||||
local map = vim.keymap.set
|
||||
map('n', '<leader>bn', '<cmd>enew<CR>', { desc = '[B]uffer [N]ew' })
|
||||
map('n', '<S-tab>', '<Cmd>BufferPrevious<CR>', { desc = 'Cycle Previous Buffer' })
|
||||
map('n', '<tab>', '<Cmd>BufferNext<CR>', { desc = 'Cycle Next Buffer' })
|
||||
map('n', '<leader>bN', '<Cmd>BufferOrderByName<CR>', { desc = '[B]uffer Order by [N]ame' })
|
||||
map('n', '<leader>bc', '<Cmd>BufferClose!<CR>', { desc = '[B]uffer [C]lose' })
|
||||
map('n', '<leader>br', '<Cmd>BufferRestore<CR>', { desc = '[B]uffer [R]estore' })
|
||||
map('n', '<leader>tc', 'gcc', { desc = '[T]oggle [C]omment', remap = true })
|
||||
map('v', '<leader>tc', 'gc', { desc = '[T]oggle [C]omment', remap = true })
|
||||
map('n', ';', ':', { desc = 'CMD enter command mode' })
|
||||
|
||||
-- Floaterm keymaps
|
||||
map('n', '<leader>tt', '<Cmd>FloatermToggle<CR>', { desc = '[T]erminal [T]toggle' })
|
||||
map('n', '<leader>tn', '<Cmd>FloatermNew<CR>', { desc = '[T]erminal [New]' })
|
||||
map('n', '<leader>tN', '<Cmd>FloatermNext<CR>', { desc = 'Cycle Next Terminal' })
|
||||
vim.g.floaterm_title = 'Terminal ($1/$2)'
|
||||
|
||||
-- Diagnostic keymaps
|
||||
vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagnostic [Q]uickfix list' })
|
||||
|
||||
|
|
@ -204,6 +140,15 @@ vim.api.nvim_create_autocmd('TextYankPost', {
|
|||
end,
|
||||
})
|
||||
|
||||
-- Enable concealing characters on certain filetypes
|
||||
-- For markdown this renders inline links, etc
|
||||
vim.api.nvim_create_autocmd('FileType', {
|
||||
pattern = { 'markdown' },
|
||||
callback = function()
|
||||
vim.opt.conceallevel = 3
|
||||
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'
|
||||
|
|
@ -228,6 +173,49 @@ vim.opt.rtp:prepend(lazypath)
|
|||
--
|
||||
-- NOTE: Here is where you install your plugins.
|
||||
require('lazy').setup({
|
||||
-- Automatically check for updates
|
||||
checker = {
|
||||
enabled = true,
|
||||
notify = true,
|
||||
},
|
||||
-- Enable caching
|
||||
performance = {
|
||||
cache = {
|
||||
enabled = true,
|
||||
},
|
||||
-- Disable some rtp plugins for performance
|
||||
rtp = {
|
||||
disabled_plugins = {
|
||||
'2html_plugin',
|
||||
'tohtml',
|
||||
'getscript',
|
||||
'getscriptPlugin',
|
||||
'gzip',
|
||||
'logipat',
|
||||
'netrw',
|
||||
'netrwPlugin',
|
||||
'netrwSettings',
|
||||
'netrwFileHandlers',
|
||||
'matchit',
|
||||
'tar',
|
||||
'tarPlugin',
|
||||
'rrhelper',
|
||||
'spellfile_plugin',
|
||||
'vimball',
|
||||
'vimballPlugin',
|
||||
'zip',
|
||||
'zipPlugin',
|
||||
'tutor',
|
||||
'rplugin',
|
||||
'syntax',
|
||||
'synmenu',
|
||||
'optwin',
|
||||
'compiler',
|
||||
'bugreport',
|
||||
'ftplugin',
|
||||
},
|
||||
},
|
||||
},
|
||||
-- NOTE: Plugins can be added with a link (or for a github repo: 'owner/repo' link).
|
||||
'tpope/vim-sleuth', -- Detect tabstop and shiftwidth automatically
|
||||
|
||||
|
|
@ -243,18 +231,18 @@ require('lazy').setup({
|
|||
-- 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',
|
||||
opts = {
|
||||
signs = {
|
||||
add = { text = '+' },
|
||||
change = { text = '~' },
|
||||
delete = { text = '_' },
|
||||
topdelete = { text = '‾' },
|
||||
changedelete = { text = '~' },
|
||||
},
|
||||
},
|
||||
},
|
||||
-- { -- Adds git related signs to the gutter, as well as utilities for managing changes
|
||||
-- 'lewis6991/gitsigns.nvim',
|
||||
-- opts = {
|
||||
-- signs = {
|
||||
-- add = { text = '+' },
|
||||
-- change = { text = '~' },
|
||||
-- delete = { text = '_' },
|
||||
-- topdelete = { text = '‾' },
|
||||
-- changedelete = { text = '~' },
|
||||
-- },
|
||||
-- },
|
||||
-- },
|
||||
|
||||
-- NOTE: Plugins can also be configured to run Lua code when they are loaded.
|
||||
--
|
||||
|
|
@ -270,6 +258,7 @@ require('lazy').setup({
|
|||
-- Then, because we use the `config` key, the configuration only runs
|
||||
-- after the plugin has been loaded:
|
||||
-- config = function() ... end
|
||||
{ 'voldikss/vim-floaterm' },
|
||||
|
||||
{ -- Useful plugin to show you pending keybinds.
|
||||
'folke/which-key.nvim',
|
||||
|
|
@ -317,9 +306,11 @@ require('lazy').setup({
|
|||
{ '<leader>c', group = '[C]ode', mode = { 'n', 'x' } },
|
||||
{ '<leader>d', group = '[D]ocument' },
|
||||
{ '<leader>r', group = '[R]ename' },
|
||||
{ '<leader>g', group = '[G]it' },
|
||||
{ '<leader>s', group = '[S]earch' },
|
||||
{ '<leader>w', group = '[W]orkspace' },
|
||||
{ '<leader>t', group = '[T]oggle' },
|
||||
{ '<leader>b', group = '[B]uffer' },
|
||||
{ '<leader>h', group = 'Git [H]unk', mode = { 'n', 'v' } },
|
||||
},
|
||||
},
|
||||
|
|
@ -382,11 +373,12 @@ require('lazy').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' },
|
||||
-- },
|
||||
-- },
|
||||
defaults = {
|
||||
layout_config = {
|
||||
prompt_position = 'top',
|
||||
},
|
||||
sorting_strategy = 'ascending',
|
||||
},
|
||||
-- pickers = {}
|
||||
extensions = {
|
||||
['ui-select'] = {
|
||||
|
|
@ -401,6 +393,9 @@ require('lazy').setup({
|
|||
|
||||
-- See `:help telescope.builtin`
|
||||
local builtin = require 'telescope.builtin'
|
||||
vim.keymap.set('n', '<leader>gs', builtin.git_status, { desc = '[G]it [S]tatus' })
|
||||
vim.keymap.set('n', '<leader>gc', builtin.git_commits, { desc = '[G]it [C]ommits' })
|
||||
vim.keymap.set('n', '<leader>gb', builtin.git_branches, { desc = '[G]it [B]ranches' })
|
||||
vim.keymap.set('n', '<leader>sh', builtin.help_tags, { desc = '[S]earch [H]elp' })
|
||||
vim.keymap.set('n', '<leader>sk', builtin.keymaps, { desc = '[S]earch [K]eymaps' })
|
||||
vim.keymap.set('n', '<leader>sf', builtin.find_files, { desc = '[S]earch [F]iles' })
|
||||
|
|
@ -606,8 +601,56 @@ 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 = {},
|
||||
jsonls = {},
|
||||
ansiblels = {
|
||||
settings = {
|
||||
ansible = {
|
||||
validation = {
|
||||
enabled = true,
|
||||
lint = {
|
||||
enabled = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
-- pyright {
|
||||
bashls = {},
|
||||
terraformls = {},
|
||||
yamlls = {
|
||||
settings = {
|
||||
yaml = {
|
||||
keyOrdering = false,
|
||||
},
|
||||
},
|
||||
},
|
||||
pylsp = {
|
||||
settings = {
|
||||
pylsp = {
|
||||
plugins = {
|
||||
-- Formatters
|
||||
autopep8 = { enabled = true },
|
||||
black = { enabled = false },
|
||||
pyls_isort = { enabled = true },
|
||||
yapf = { enabled = false },
|
||||
-- Linters
|
||||
pylint = { enabled = false },
|
||||
pyflakes = { enabled = true },
|
||||
pycodestyle = {
|
||||
ignore = { 'W391' },
|
||||
maxLineLength = 130,
|
||||
},
|
||||
-- Complexity Checkers
|
||||
mccabe = { enabled = true },
|
||||
-- Type Checkers
|
||||
pylsp_mypy = { enabled = true },
|
||||
-- Auto-completers
|
||||
jedi_completion = { fuzzy = true },
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
-- rust_analyzer = {},
|
||||
-- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs
|
||||
--
|
||||
|
|
@ -647,6 +690,11 @@ require('lazy').setup({
|
|||
local ensure_installed = vim.tbl_keys(servers or {})
|
||||
vim.list_extend(ensure_installed, {
|
||||
'stylua', -- Used to format Lua code
|
||||
'python-lsp-server',
|
||||
'terraform-ls',
|
||||
'bash-language-server',
|
||||
'autopep8',
|
||||
'json-lsp',
|
||||
})
|
||||
require('mason-tool-installer').setup { ensure_installed = ensure_installed }
|
||||
|
||||
|
|
@ -699,6 +747,7 @@ require('lazy').setup({
|
|||
end,
|
||||
formatters_by_ft = {
|
||||
lua = { 'stylua' },
|
||||
python = { 'autopep8' },
|
||||
-- Conform can also run multiple formatters sequentially
|
||||
-- python = { "isort", "black" },
|
||||
--
|
||||
|
|
@ -728,12 +777,12 @@ require('lazy').setup({
|
|||
-- `friendly-snippets` contains a variety of premade snippets.
|
||||
-- See the README about individual language/framework/plugin snippets:
|
||||
-- https://github.com/rafamadriz/friendly-snippets
|
||||
-- {
|
||||
-- 'rafamadriz/friendly-snippets',
|
||||
-- config = function()
|
||||
-- require('luasnip.loaders.from_vscode').lazy_load()
|
||||
-- end,
|
||||
-- },
|
||||
{
|
||||
'rafamadriz/friendly-snippets',
|
||||
config = function()
|
||||
require('luasnip.loaders.from_vscode').lazy_load()
|
||||
end,
|
||||
},
|
||||
},
|
||||
},
|
||||
'saadparwaiz1/cmp_luasnip',
|
||||
|
|
@ -779,9 +828,9 @@ require('lazy').setup({
|
|||
|
||||
-- If you prefer more traditional completion keymaps,
|
||||
-- you can uncomment the following lines
|
||||
--['<CR>'] = cmp.mapping.confirm { select = true },
|
||||
--['<Tab>'] = cmp.mapping.select_next_item(),
|
||||
--['<S-Tab>'] = cmp.mapping.select_prev_item(),
|
||||
['<CR>'] = cmp.mapping.confirm { select = true },
|
||||
['<Tab>'] = cmp.mapping.select_next_item(),
|
||||
['<S-Tab>'] = cmp.mapping.select_prev_item(),
|
||||
|
||||
-- Manually trigger a completion from nvim-cmp.
|
||||
-- Generally you don't need this, because nvim-cmp will display
|
||||
|
|
@ -829,13 +878,18 @@ require('lazy').setup({
|
|||
-- 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',
|
||||
priority = 1000, -- Make sure to load this before all the other start plugins.
|
||||
'projekt0n/github-nvim-theme',
|
||||
name = 'github-theme',
|
||||
lazy = false,
|
||||
priority = 1000,
|
||||
config = function()
|
||||
require('github-theme').setup {}
|
||||
end,
|
||||
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 'github_dark'
|
||||
|
||||
-- You can configure highlights by doing something like:
|
||||
vim.cmd.hi 'Comment gui=none'
|
||||
|
|
@ -888,7 +942,24 @@ 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',
|
||||
'diff',
|
||||
'lua',
|
||||
'luadoc',
|
||||
'markdown',
|
||||
'markdown_inline',
|
||||
'vim',
|
||||
'vimdoc',
|
||||
'hcl',
|
||||
'python',
|
||||
'go',
|
||||
'yaml',
|
||||
'markdown',
|
||||
'markdown_inline',
|
||||
'dockerfile',
|
||||
'toml',
|
||||
},
|
||||
-- Autoinstall languages that are not installed
|
||||
auto_install = true,
|
||||
highlight = {
|
||||
|
|
@ -920,16 +991,16 @@ require('lazy').setup({
|
|||
-- require 'kickstart.plugins.debug',
|
||||
-- require 'kickstart.plugins.indent_line',
|
||||
-- require 'kickstart.plugins.lint',
|
||||
-- require 'kickstart.plugins.autopairs',
|
||||
-- require 'kickstart.plugins.neo-tree',
|
||||
-- require 'kickstart.plugins.gitsigns', -- adds gitsigns recommend keymaps
|
||||
require 'kickstart.plugins.autopairs',
|
||||
require 'kickstart.plugins.neo-tree',
|
||||
require 'kickstart.plugins.gitsigns', -- adds gitsigns recommend keymaps
|
||||
|
||||
-- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua`
|
||||
-- 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' },
|
||||
}, {
|
||||
ui = {
|
||||
-- If you are using a Nerd Font: set icons to an empty table which will use the
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue