feat: my config
This commit is contained in:
parent
5aeddfdd5d
commit
6c46e10106
173
init.lua
173
init.lua
|
@ -1,37 +1,5 @@
|
||||||
--[[
|
--[[
|
||||||
|
|
||||||
=====================================================================
|
|
||||||
==================== 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
|
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:
|
a guide. One possible example which will only take 10-15 minutes:
|
||||||
- https://learnxinyminutes.com/docs/lua/
|
- https://learnxinyminutes.com/docs/lua/
|
||||||
|
@ -90,8 +58,14 @@ P.S. You can delete this when you're done too. It's your config now! :)
|
||||||
vim.g.mapleader = ' '
|
vim.g.mapleader = ' '
|
||||||
vim.g.maplocalleader = ' '
|
vim.g.maplocalleader = ' '
|
||||||
|
|
||||||
|
-- Remap Esc key
|
||||||
|
vim.api.nvim_set_keymap('i', ';;', '<Esc>', { noremap = true, silent = true })
|
||||||
|
|
||||||
|
-- Toggle floating lspsaga term (my own)
|
||||||
|
vim.keymap.set('n', 't', '<cmd>Lspsaga term_toggle<CR>')
|
||||||
|
|
||||||
-- Set to true if you have a Nerd Font installed and selected in the terminal
|
-- 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 ]]
|
-- [[ Setting options ]]
|
||||||
-- See `:help vim.opt`
|
-- See `:help vim.opt`
|
||||||
|
@ -154,6 +128,11 @@ vim.opt.cursorline = true
|
||||||
-- Minimal number of screen lines to keep above and below the cursor.
|
-- Minimal number of screen lines to keep above and below the cursor.
|
||||||
vim.opt.scrolloff = 10
|
vim.opt.scrolloff = 10
|
||||||
|
|
||||||
|
-- folding
|
||||||
|
vim.opt.foldmethod = 'expr'
|
||||||
|
vim.opt.foldexpr = 'nvim_treesitter#foldexpr()'
|
||||||
|
vim.cmd 'set nofoldenable'
|
||||||
|
|
||||||
-- [[ Basic Keymaps ]]
|
-- [[ Basic Keymaps ]]
|
||||||
-- See `:help vim.keymap.set()`
|
-- See `:help vim.keymap.set()`
|
||||||
|
|
||||||
|
@ -204,6 +183,20 @@ vim.api.nvim_create_autocmd('TextYankPost', {
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
-- for entering neovim terminal in insert mode
|
||||||
|
vim.api.nvim_create_autocmd({ 'TermOpen', 'WinEnter' }, { pattern = 'term://*', command = 'startinsert' })
|
||||||
|
|
||||||
|
-- -- Mine: For ray-x go nvim plugin
|
||||||
|
-- -- Run gofmt + goimports on save
|
||||||
|
-- local format_sync_grp = vim.api.nvim_create_augroup('goimports', {})
|
||||||
|
-- vim.api.nvim_create_autocmd('BufWritePre', {
|
||||||
|
-- pattern = '*.go',
|
||||||
|
-- callback = function()
|
||||||
|
-- require('go.format').goimports()
|
||||||
|
-- end,
|
||||||
|
-- group = format_sync_grp,
|
||||||
|
-- })
|
||||||
|
|
||||||
-- [[ Install `lazy.nvim` plugin manager ]]
|
-- [[ Install `lazy.nvim` plugin manager ]]
|
||||||
-- See `:help lazy.nvim.txt` or https://github.com/folke/lazy.nvim for more info
|
-- See `:help lazy.nvim.txt` or https://github.com/folke/lazy.nvim for more info
|
||||||
local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim'
|
local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim'
|
||||||
|
@ -237,7 +230,8 @@ require('lazy').setup({
|
||||||
-- This is equivalent to:
|
-- This is equivalent to:
|
||||||
-- require('Comment').setup({})
|
-- require('Comment').setup({})
|
||||||
|
|
||||||
-- "gc" to comment visual regions/lines
|
-- "gc" in VISUAL mode to comment visual regions/lines
|
||||||
|
-- "gcc" in NORMAL mode to toggle comment for single line
|
||||||
{ 'numToStr/Comment.nvim', opts = {} },
|
{ 'numToStr/Comment.nvim', opts = {} },
|
||||||
|
|
||||||
-- Here is a more advanced example where we pass configuration
|
-- Here is a more advanced example where we pass configuration
|
||||||
|
@ -257,6 +251,22 @@ require('lazy').setup({
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
-- {
|
||||||
|
-- -- my own: lspsaga
|
||||||
|
-- 'nvimdev/lspsaga.nvim',
|
||||||
|
-- opts = {
|
||||||
|
-- lightbulb = {
|
||||||
|
-- enable = false,
|
||||||
|
-- },
|
||||||
|
-- },
|
||||||
|
-- config = function()
|
||||||
|
-- require('lspsaga').setup {}
|
||||||
|
-- end,
|
||||||
|
-- dependencies = {
|
||||||
|
-- 'nvim-treesitter/nvim-treesitter', -- optional
|
||||||
|
-- 'nvim-tree/nvim-web-devicons', -- optional
|
||||||
|
-- },
|
||||||
|
-- },
|
||||||
|
|
||||||
-- NOTE: Plugins can also be configured to run Lua code when they are loaded.
|
-- NOTE: Plugins can also be configured to run Lua code when they are loaded.
|
||||||
--
|
--
|
||||||
|
@ -353,11 +363,14 @@ require('lazy').setup({
|
||||||
-- You can put your default mappings / updates / etc. in here
|
-- You can put your default mappings / updates / etc. in here
|
||||||
-- All the info you're looking for is in `:help telescope.setup()`
|
-- All the info you're looking for is in `:help telescope.setup()`
|
||||||
--
|
--
|
||||||
-- defaults = {
|
defaults = {
|
||||||
-- mappings = {
|
mappings = {
|
||||||
-- i = { ['<c-enter>'] = 'to_fuzzy_refine' },
|
i = {
|
||||||
-- },
|
['<c-enter>'] = 'to_fuzzy_refine',
|
||||||
-- },
|
['<c-d>'] = 'delete_buffer',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
-- pickers = {}
|
-- pickers = {}
|
||||||
extensions = {
|
extensions = {
|
||||||
['ui-select'] = {
|
['ui-select'] = {
|
||||||
|
@ -566,16 +579,16 @@ require('lazy').setup({
|
||||||
-- For example, to see the options for `lua_ls`, you could go to: https://luals.github.io/wiki/settings/
|
-- For example, to see the options for `lua_ls`, you could go to: https://luals.github.io/wiki/settings/
|
||||||
local servers = {
|
local servers = {
|
||||||
-- clangd = {},
|
-- clangd = {},
|
||||||
-- gopls = {},
|
gopls = {},
|
||||||
-- pyright = {},
|
-- pyright = {},
|
||||||
-- rust_analyzer = {},
|
rust_analyzer = {},
|
||||||
-- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs
|
-- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs
|
||||||
--
|
--
|
||||||
-- Some languages (like typescript) have entire language plugins that can be useful:
|
-- Some languages (like typescript) have entire language plugins that can be useful:
|
||||||
-- https://github.com/pmizio/typescript-tools.nvim
|
-- https://github.com/pmizio/typescript-tools.nvim
|
||||||
--
|
--
|
||||||
-- But for many setups, the LSP (`tsserver`) will work just fine
|
-- But for many setups, the LSP (`tsserver`) will work just fine
|
||||||
-- tsserver = {},
|
tsserver = {},
|
||||||
--
|
--
|
||||||
|
|
||||||
lua_ls = {
|
lua_ls = {
|
||||||
|
@ -653,6 +666,7 @@ require('lazy').setup({
|
||||||
formatters_by_ft = {
|
formatters_by_ft = {
|
||||||
lua = { 'stylua' },
|
lua = { 'stylua' },
|
||||||
-- Conform can also run multiple formatters sequentially
|
-- Conform can also run multiple formatters sequentially
|
||||||
|
go = { 'goimports', 'gofmt' },
|
||||||
-- python = { "isort", "black" },
|
-- python = { "isort", "black" },
|
||||||
--
|
--
|
||||||
-- You can use a sub-list to tell conform to run *until* a formatter
|
-- You can use a sub-list to tell conform to run *until* a formatter
|
||||||
|
@ -773,21 +787,33 @@ require('lazy').setup({
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
{ -- You can easily change to a different colorscheme.
|
-- { -- You can easily change to a different colorscheme.
|
||||||
-- Change the name of the colorscheme plugin below, and then
|
-- -- Change the name of the colorscheme plugin below, and then
|
||||||
-- change the command in the config to whatever the name of that colorscheme is.
|
-- -- 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.
|
||||||
|
-- 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'
|
||||||
--
|
--
|
||||||
-- If you want to see what colorschemes are already installed, you can use `:Telescope colorscheme`.
|
-- -- You can configure highlights by doing something like:
|
||||||
'folke/tokyonight.nvim',
|
-- vim.cmd.hi 'Comment gui=none'
|
||||||
priority = 1000, -- Make sure to load this before all the other start plugins.
|
-- 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'
|
|
||||||
|
|
||||||
-- You can configure highlights by doing something like:
|
{
|
||||||
vim.cmd.hi 'Comment gui=none'
|
'ribru17/bamboo.nvim',
|
||||||
|
lazy = false,
|
||||||
|
priority = 1000,
|
||||||
|
config = function()
|
||||||
|
require('bamboo').setup {
|
||||||
|
-- optional configuration here
|
||||||
|
}
|
||||||
|
require('bamboo').load()
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -863,7 +889,30 @@ require('lazy').setup({
|
||||||
-- - Treesitter + textobjects: https://github.com/nvim-treesitter/nvim-treesitter-textobjects
|
-- - Treesitter + textobjects: https://github.com/nvim-treesitter/nvim-treesitter-textobjects
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
'ray-x/go.nvim',
|
||||||
|
dependencies = { -- optional packages
|
||||||
|
'ray-x/guihua.lua',
|
||||||
|
'neovim/nvim-lspconfig',
|
||||||
|
'nvim-treesitter/nvim-treesitter',
|
||||||
|
},
|
||||||
|
config = function()
|
||||||
|
require('go').setup()
|
||||||
|
end,
|
||||||
|
event = { 'CmdlineEnter' },
|
||||||
|
ft = { 'go', 'gomod' },
|
||||||
|
build = ':lua require("go.install").update_all_sync()', -- if you need to install/update all binaries
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'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,
|
||||||
|
},
|
||||||
-- The following two comments only work if you have downloaded the kickstart repo, not just copy pasted the
|
-- The following two comments only work if you have downloaded the kickstart repo, not just copy pasted the
|
||||||
-- init.lua. If you want these files, they are in the repository, so you can just download them and
|
-- init.lua. If you want these files, they are in the repository, so you can just download them and
|
||||||
-- place them in the correct locations.
|
-- place them in the correct locations.
|
||||||
|
@ -873,12 +922,12 @@ require('lazy').setup({
|
||||||
-- Here are some example plugins that I've included in the Kickstart repository.
|
-- Here are some example plugins that I've included in the Kickstart repository.
|
||||||
-- 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 recommend keymaps
|
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`
|
-- 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.
|
-- This is the easiest way to modularize your config.
|
||||||
|
|
Loading…
Reference in New Issue