feat: added start golang and react js (ts/js) confs
This commit is contained in:
parent
3338d39206
commit
afe6cded22
123
init.lua
123
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)
|
||||
|
@ -100,6 +14,20 @@ vim.g.have_nerd_font = false
|
|||
|
||||
-- Make line numbers default
|
||||
vim.o.number = true
|
||||
vim.o.expandtab = true
|
||||
vim.o.tabstop = 4
|
||||
vim.o.shiftwidth = 4
|
||||
vim.o.softtabstop = 4
|
||||
vim.opt.relativenumber = true
|
||||
|
||||
vim.diagnostic.config {
|
||||
virtual_text = true, -- shows inline
|
||||
signs = true, -- shows signs in gutter
|
||||
update_in_insert = false,
|
||||
}
|
||||
|
||||
-- " make back‑spacing feel like 4 spaces
|
||||
-- set =4
|
||||
-- You can also add relative line numbers, to help with jumping.
|
||||
-- Experiment for yourself to see if you like it!
|
||||
-- vim.o.relativenumber = true
|
||||
|
@ -437,6 +365,22 @@ require('lazy').setup({
|
|||
vim.keymap.set('n', '<leader>s.', builtin.oldfiles, { desc = '[S]earch Recent Files ("." for repeat)' })
|
||||
vim.keymap.set('n', '<leader><leader>', builtin.buffers, { desc = '[ ] Find existing buffers' })
|
||||
|
||||
vim.keymap.set('n', '<leader>gf', require('telescope.builtin').git_status, { desc = 'Git changed files' })
|
||||
|
||||
vim.keymap.set('n', '<leader>gr', ':GoRun<CR>', { desc = '[Go] Run' })
|
||||
vim.keymap.set('n', '<leader>gt', ':GoTestFunc<CR>', { desc = '[Go] Test Function' })
|
||||
vim.keymap.set('n', '<leader>gi', ':GoImpl<CR>', { desc = '[Go] Implement interface' })
|
||||
|
||||
-- Window management keymaps
|
||||
vim.keymap.set('n', '<leader>ws', '<C-w>s', { desc = '[W]indow Split Horizontal' })
|
||||
vim.keymap.set('n', '<leader>wv', '<C-w>v', { desc = '[W]indow Split Vertical' })
|
||||
vim.keymap.set('n', '<leader>wh', '<C-w>h', { desc = '[W]indow Left' })
|
||||
vim.keymap.set('n', '<leader>wj', '<C-w>j', { desc = '[W]indow Down' })
|
||||
vim.keymap.set('n', '<leader>wk', '<C-w>k', { desc = '[W]indow Up' })
|
||||
vim.keymap.set('n', '<leader>wl', '<C-w>l', { desc = '[W]indow Right' })
|
||||
vim.keymap.set('n', '<leader>wq', '<C-w>q', { desc = '[W]indow Quit' })
|
||||
vim.keymap.set('n', '<leader>w=', '<C-w>=', { desc = '[W]indow Equalize' })
|
||||
|
||||
-- Slightly advanced example of overriding default behavior and theme
|
||||
vim.keymap.set('n', '<leader>/', function()
|
||||
-- You can pass additional configuration to Telescope to change the theme, layout, etc.
|
||||
|
@ -720,7 +664,10 @@ require('lazy').setup({
|
|||
require('mason-tool-installer').setup { ensure_installed = ensure_installed }
|
||||
|
||||
require('mason-lspconfig').setup {
|
||||
ensure_installed = {}, -- explicitly set to an empty table (Kickstart populates installs via mason-tool-installer)
|
||||
ensure_installed = {
|
||||
-- 'typescript-language-server', -- JavaScript/TypeScript
|
||||
'eslint', -- optional: linting
|
||||
}, -- explicitly set to an empty table (Kickstart populates installs via mason-tool-installer)
|
||||
automatic_installation = false,
|
||||
handlers = {
|
||||
function(server_name)
|
||||
|
@ -984,7 +931,7 @@ 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.
|
||||
-- { import = 'custom.plugins' },
|
||||
{ import = 'custom.plugins' },
|
||||
--
|
||||
-- For additional information with loading, sourcing and examples see `:help lazy.nvim-🔌-plugin-spec`
|
||||
-- Or use telescope!
|
||||
|
|
|
@ -2,4 +2,56 @@
|
|||
-- I promise not to create any merge conflicts in this directory :)
|
||||
--
|
||||
-- See the kickstart.nvim README for more information
|
||||
return {}
|
||||
-- Bootstrap lazy.nvim
|
||||
return {
|
||||
{
|
||||
-- If you want neo-tree's file operations to work with LSP (updating imports, etc.), you can use a plugin like
|
||||
-- https://github.com/antosha417/nvim-lsp-file-operations:
|
||||
-- {
|
||||
-- "antosha417/nvim-lsp-file-operations",
|
||||
-- dependencies = {
|
||||
-- "nvim-lua/plenary.nvim",
|
||||
-- "nvim-neo-tree/neo-tree.nvim",
|
||||
-- },
|
||||
-- config = function()
|
||||
-- require("lsp-file-operations").setup()
|
||||
-- end,
|
||||
-- },
|
||||
|
||||
-- Add this in the plugins table
|
||||
|
||||
{
|
||||
'ray-x/go.nvim',
|
||||
dependencies = {
|
||||
'ray-x/guihua.lua', -- required UI library
|
||||
'nvim-treesitter/nvim-treesitter',
|
||||
'neovim/nvim-lspconfig',
|
||||
},
|
||||
ft = { 'go', 'gomod' },
|
||||
config = function()
|
||||
require('go').setup {
|
||||
lsp_cfg = true, -- auto-setup gopls
|
||||
lsp_on_attach = function(client, bufnr)
|
||||
-- Auto format on save
|
||||
if client.server_capabilities.documentFormattingProvider then
|
||||
vim.api.nvim_create_autocmd('BufWritePre', {
|
||||
group = vim.api.nvim_create_augroup('GoFormat', { clear = true }),
|
||||
buffer = bufnr,
|
||||
callback = function()
|
||||
vim.lsp.buf.format { async = false }
|
||||
end,
|
||||
})
|
||||
end
|
||||
end,
|
||||
}
|
||||
end,
|
||||
},
|
||||
{
|
||||
'windwp/nvim-autopairs',
|
||||
event = 'InsertEnter',
|
||||
config = true,
|
||||
-- use opts = {} for passing setup options
|
||||
-- this is equivalent to setup({}) function
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue