Skip to content

Commit afe6cde

Browse files
author
RahatMelsov
committed
feat: added start golang and react js (ts/js) confs
1 parent 3338d39 commit afe6cde

File tree

2 files changed

+88
-89
lines changed

2 files changed

+88
-89
lines changed

init.lua

Lines changed: 35 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -1,89 +1,3 @@
1-
--[[
2-
3-
=====================================================================
4-
==================== READ THIS BEFORE CONTINUING ====================
5-
=====================================================================
6-
======== .-----. ========
7-
======== .----------------------. | === | ========
8-
======== |.-""""""""""""""""""-.| |-----| ========
9-
======== || || | === | ========
10-
======== || KICKSTART.NVIM || |-----| ========
11-
======== || || | === | ========
12-
======== || || |-----| ========
13-
======== ||:Tutor || |:::::| ========
14-
======== |'-..................-'| |____o| ========
15-
======== `"")----------------(""` ___________ ========
16-
======== /::::::::::| |::::::::::\ \ no mouse \ ========
17-
======== /:::========| |==hjkl==:::\ \ required \ ========
18-
======== '""""""""""""' '""""""""""""' '""""""""""' ========
19-
======== ========
20-
=====================================================================
21-
=====================================================================
22-
23-
What is Kickstart?
24-
25-
Kickstart.nvim is *not* a distribution.
26-
27-
Kickstart.nvim is a starting point for your own configuration.
28-
The goal is that you can read every line of code, top-to-bottom, understand
29-
what your configuration is doing, and modify it to suit your needs.
30-
31-
Once you've done that, you can start exploring, configuring and tinkering to
32-
make Neovim your own! That might mean leaving Kickstart just the way it is for a while
33-
or immediately breaking it into modular pieces. It's up to you!
34-
35-
If you don't know anything about Lua, I recommend taking some time to read through
36-
a guide. One possible example which will only take 10-15 minutes:
37-
- https://learnxinyminutes.com/docs/lua/
38-
39-
After understanding a bit more about Lua, you can use `:help lua-guide` as a
40-
reference for how Neovim integrates Lua.
41-
- :help lua-guide
42-
- (or HTML version): https://neovim.io/doc/user/lua-guide.html
43-
44-
Kickstart Guide:
45-
46-
TODO: The very first thing you should do is to run the command `:Tutor` in Neovim.
47-
48-
If you don't know what this means, type the following:
49-
- <escape key>
50-
- :
51-
- Tutor
52-
- <enter key>
53-
54-
(If you already know the Neovim basics, you can skip this step.)
55-
56-
Once you've completed that, you can continue working through **AND READING** the rest
57-
of the kickstart init.lua.
58-
59-
Next, run AND READ `:help`.
60-
This will open up a help window with some basic information
61-
about reading, navigating and searching the builtin help documentation.
62-
63-
This should be the first place you go to look when you're stuck or confused
64-
with something. It's one of my favorite Neovim features.
65-
66-
MOST IMPORTANTLY, we provide a keymap "<space>sh" to [s]earch the [h]elp documentation,
67-
which is very useful when you're not exactly sure of what you're looking for.
68-
69-
I have left several `:help X` comments throughout the init.lua
70-
These are hints about where to find more information about the relevant settings,
71-
plugins or Neovim features used in Kickstart.
72-
73-
NOTE: Look for lines like this
74-
75-
Throughout the file. These are for you, the reader, to help you understand what is happening.
76-
Feel free to delete them once you know what you're doing, but they should serve as a guide
77-
for when you are first encountering a few different constructs in your Neovim config.
78-
79-
If you experience any errors while trying to install kickstart, run `:checkhealth` for more info.
80-
81-
I hope you enjoy your Neovim journey,
82-
- TJ
83-
84-
P.S. You can delete this when you're done too. It's your config now! :)
85-
--]]
86-
871
-- Set <space> as the leader key
882
-- See `:help mapleader`
893
-- NOTE: Must happen before plugins are loaded (otherwise wrong leader will be used)
@@ -100,6 +14,20 @@ vim.g.have_nerd_font = false
10014

10115
-- Make line numbers default
10216
vim.o.number = true
17+
vim.o.expandtab = true
18+
vim.o.tabstop = 4
19+
vim.o.shiftwidth = 4
20+
vim.o.softtabstop = 4
21+
vim.opt.relativenumber = true
22+
23+
vim.diagnostic.config {
24+
virtual_text = true, -- shows inline
25+
signs = true, -- shows signs in gutter
26+
update_in_insert = false,
27+
}
28+
29+
-- " make back‑spacing feel like 4 spaces
30+
-- set =4
10331
-- You can also add relative line numbers, to help with jumping.
10432
-- Experiment for yourself to see if you like it!
10533
-- vim.o.relativenumber = true
@@ -437,6 +365,22 @@ require('lazy').setup({
437365
vim.keymap.set('n', '<leader>s.', builtin.oldfiles, { desc = '[S]earch Recent Files ("." for repeat)' })
438366
vim.keymap.set('n', '<leader><leader>', builtin.buffers, { desc = '[ ] Find existing buffers' })
439367

368+
vim.keymap.set('n', '<leader>gf', require('telescope.builtin').git_status, { desc = 'Git changed files' })
369+
370+
vim.keymap.set('n', '<leader>gr', ':GoRun<CR>', { desc = '[Go] Run' })
371+
vim.keymap.set('n', '<leader>gt', ':GoTestFunc<CR>', { desc = '[Go] Test Function' })
372+
vim.keymap.set('n', '<leader>gi', ':GoImpl<CR>', { desc = '[Go] Implement interface' })
373+
374+
-- Window management keymaps
375+
vim.keymap.set('n', '<leader>ws', '<C-w>s', { desc = '[W]indow Split Horizontal' })
376+
vim.keymap.set('n', '<leader>wv', '<C-w>v', { desc = '[W]indow Split Vertical' })
377+
vim.keymap.set('n', '<leader>wh', '<C-w>h', { desc = '[W]indow Left' })
378+
vim.keymap.set('n', '<leader>wj', '<C-w>j', { desc = '[W]indow Down' })
379+
vim.keymap.set('n', '<leader>wk', '<C-w>k', { desc = '[W]indow Up' })
380+
vim.keymap.set('n', '<leader>wl', '<C-w>l', { desc = '[W]indow Right' })
381+
vim.keymap.set('n', '<leader>wq', '<C-w>q', { desc = '[W]indow Quit' })
382+
vim.keymap.set('n', '<leader>w=', '<C-w>=', { desc = '[W]indow Equalize' })
383+
440384
-- Slightly advanced example of overriding default behavior and theme
441385
vim.keymap.set('n', '<leader>/', function()
442386
-- You can pass additional configuration to Telescope to change the theme, layout, etc.
@@ -720,7 +664,10 @@ require('lazy').setup({
720664
require('mason-tool-installer').setup { ensure_installed = ensure_installed }
721665

722666
require('mason-lspconfig').setup {
723-
ensure_installed = {}, -- explicitly set to an empty table (Kickstart populates installs via mason-tool-installer)
667+
ensure_installed = {
668+
-- 'typescript-language-server', -- JavaScript/TypeScript
669+
'eslint', -- optional: linting
670+
}, -- explicitly set to an empty table (Kickstart populates installs via mason-tool-installer)
724671
automatic_installation = false,
725672
handlers = {
726673
function(server_name)
@@ -984,7 +931,7 @@ require('lazy').setup({
984931
-- This is the easiest way to modularize your config.
985932
--
986933
-- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going.
987-
-- { import = 'custom.plugins' },
934+
{ import = 'custom.plugins' },
988935
--
989936
-- For additional information with loading, sourcing and examples see `:help lazy.nvim-🔌-plugin-spec`
990937
-- Or use telescope!

lua/custom/plugins/init.lua

Lines changed: 53 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,56 @@
22
-- I promise not to create any merge conflicts in this directory :)
33
--
44
-- See the kickstart.nvim README for more information
5-
return {}
5+
-- Bootstrap lazy.nvim
6+
return {
7+
{
8+
-- If you want neo-tree's file operations to work with LSP (updating imports, etc.), you can use a plugin like
9+
-- https://github.com/antosha417/nvim-lsp-file-operations:
10+
-- {
11+
-- "antosha417/nvim-lsp-file-operations",
12+
-- dependencies = {
13+
-- "nvim-lua/plenary.nvim",
14+
-- "nvim-neo-tree/neo-tree.nvim",
15+
-- },
16+
-- config = function()
17+
-- require("lsp-file-operations").setup()
18+
-- end,
19+
-- },
20+
21+
-- Add this in the plugins table
22+
23+
{
24+
'ray-x/go.nvim',
25+
dependencies = {
26+
'ray-x/guihua.lua', -- required UI library
27+
'nvim-treesitter/nvim-treesitter',
28+
'neovim/nvim-lspconfig',
29+
},
30+
ft = { 'go', 'gomod' },
31+
config = function()
32+
require('go').setup {
33+
lsp_cfg = true, -- auto-setup gopls
34+
lsp_on_attach = function(client, bufnr)
35+
-- Auto format on save
36+
if client.server_capabilities.documentFormattingProvider then
37+
vim.api.nvim_create_autocmd('BufWritePre', {
38+
group = vim.api.nvim_create_augroup('GoFormat', { clear = true }),
39+
buffer = bufnr,
40+
callback = function()
41+
vim.lsp.buf.format { async = false }
42+
end,
43+
})
44+
end
45+
end,
46+
}
47+
end,
48+
},
49+
{
50+
'windwp/nvim-autopairs',
51+
event = 'InsertEnter',
52+
config = true,
53+
-- use opts = {} for passing setup options
54+
-- this is equivalent to setup({}) function
55+
},
56+
},
57+
}

0 commit comments

Comments
 (0)