Skip to content

Feature/added plugins #1661

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
157 changes: 136 additions & 21 deletions init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -84,14 +84,17 @@ I hope you enjoy your Neovim journey,
P.S. You can delete this when you're done too. It's your config now! :)
--]]

-- Custom config.
require 'custom.keybindings'

-- 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 = ' '
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.o`
Expand All @@ -110,6 +113,9 @@ vim.o.mouse = 'a'
-- Don't show the mode, since it's already in the status line
vim.o.showmode = false

-- Disable swapfiles
vim.opt.swapfile = false -- Disable .swp files

-- 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.
Expand Down Expand Up @@ -200,10 +206,10 @@ vim.keymap.set('n', '<C-j>', '<C-w><C-j>', { desc = 'Move focus to the lower win
vim.keymap.set('n', '<C-k>', '<C-w><C-k>', { desc = 'Move focus to the upper window' })

-- NOTE: Some terminals have colliding keymaps or are not able to send distinct keycodes
-- vim.keymap.set("n", "<C-S-h>", "<C-w>H", { desc = "Move window to the left" })
-- vim.keymap.set("n", "<C-S-l>", "<C-w>L", { desc = "Move window to the right" })
-- vim.keymap.set("n", "<C-S-j>", "<C-w>J", { desc = "Move window to the lower" })
-- vim.keymap.set("n", "<C-S-k>", "<C-w>K", { desc = "Move window to the upper" })
vim.keymap.set('n', '<C-S-h>', '<C-w>H', { desc = 'Move window to the left' })
vim.keymap.set('n', '<C-S-l>', '<C-w>L', { desc = 'Move window to the right' })
vim.keymap.set('n', '<C-S-j>', '<C-w>J', { desc = 'Move window to the lower' })
vim.keymap.set('n', '<C-S-k>', '<C-w>K', { desc = 'Move window to the upper' })

-- [[ Basic Autocommands ]]
-- See `:help lua-guide-autocommands`
Expand Down Expand Up @@ -672,9 +678,9 @@ 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 = {},
gopls = {},
-- pyright = {},
-- rust_analyzer = {},
rust_analyzer = {},
-- ... 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:
Expand All @@ -683,7 +689,46 @@ require('lazy').setup({
-- But for many setups, the LSP (`ts_ls`) will work just fine
-- ts_ls = {},
--

-- Vue 3
--
vuels = {
filetypes = { 'vue', 'javascript', 'typescript' },
init_options = {
config = {
vetur = { -- For Vue 2 compatibility (optional)
validation = { template = true, script = true, style = true },
format = { enable = false }, -- Disable if using Prettier
},
},
},
},
-- TypeScript
ts_ls = {
init_options = {
plugins = {
{
name = '@vue/typescript-plugin',
location = vim.fn.stdpath 'data' .. '/mason/packages/vue-language-server/node_modules/@vue/language-server',
languages = { 'vue' },
},
},
},
settings = {
typescript = {
inlayHints = {
includeInlayParameterNameHints = 'all',
includeInlayParameterNameHintsWhenArgumentMatchesName = true,
includeInlayFunctionParameterTypeHints = true,
includeInlayVariableTypeHints = true,
includeInlayVariableTypeHintsWhenTypeMatchesName = true,
includeInlayPropertyDeclarationTypeHints = true,
includeInlayFunctionLikeReturnTypeHints = true,
includeInlayEnumMemberValueHints = true,
},
},
},
filetypes = { 'typescript', 'javascript', 'javascriptreact', 'typescriptreact', 'vue' },
},
lua_ls = {
-- cmd = { ... },
-- filetypes = { ... },
Expand All @@ -698,6 +743,13 @@ require('lazy').setup({
},
},
},

-- python lsp
pyright = {},
-- CSS/SCSS LSP
cssls = {
filetypes = { 'css', 'scss', 'sass' },
},
}

-- Ensure the servers and tools above are installed
Expand All @@ -717,10 +769,16 @@ require('lazy').setup({
vim.list_extend(ensure_installed, {
'stylua', -- Used to format Lua code
})
vim.filetype.add {
extension = {
vue = 'vue',
},
}
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 = { 'vuels', 'lua_ls' }, -- explicitly set to an empty table (Kickstart populates installs via mason-tool-installer)
automatic_enable = true,
automatic_installation = false,
handlers = {
function(server_name)
Expand Down Expand Up @@ -772,7 +830,7 @@ require('lazy').setup({
-- python = { "isort", "black" },
--
-- You can use 'stop_after_first' to run the first available formatter from the list
-- javascript = { "prettierd", "prettier", stop_after_first = true },
-- javascript = { 'prettierd', 'prettier', stop_after_first = true },
},
},
},
Expand Down Expand Up @@ -809,6 +867,8 @@ require('lazy').setup({
opts = {},
},
'folke/lazydev.nvim',
-- custom deps
'Kaiser-Yang/blink-cmp-avante',
},
--- @module 'blink.cmp'
--- @type blink.cmp.Config
Expand Down Expand Up @@ -837,6 +897,19 @@ require('lazy').setup({
-- See :h blink-cmp-config-keymap for defining your own keymap
preset = 'default',

['<Tab>'] = {
function(cmp)
if cmp.snippet_active() then
return cmp.accept()
else
return cmp.select_and_accept()
end
vim.api.nvim_command '<Esc>'
end,
'snippet_forward',
'fallback',
},

-- For more advanced Luasnip keymaps (e.g. selecting choice nodes, expansion) see:
-- https://github.com/L3MON4D3/LuaSnip?tab=readme-ov-file#keymaps
},
Expand All @@ -851,12 +924,22 @@ require('lazy').setup({
-- By default, you may press `<c-space>` to show the documentation.
-- Optionally, set `auto_show = true` to show the documentation after a delay.
documentation = { auto_show = false, auto_show_delay_ms = 500 },
ghost_text = {
enabled = true,
},
},

sources = {
default = { 'lsp', 'path', 'snippets', 'lazydev' },
default = { 'lsp', 'path', 'snippets', 'lazydev', 'avante' },
providers = {
lazydev = { module = 'lazydev.integrations.blink', score_offset = 100 },
avante = {
module = 'blink-cmp-avante',
name = 'Avante',
opts = {
-- options for blink-cmp-avante
},
},
},
},

Expand Down Expand Up @@ -917,7 +1000,19 @@ require('lazy').setup({
-- - saiw) - [S]urround [A]dd [I]nner [W]ord [)]Paren
-- - sd' - [S]urround [D]elete [']quotes
-- - sr)' - [S]urround [R]eplace [)] [']
require('mini.surround').setup()
require('mini.surround').setup {
custom_surroundings = {
[')'] = { output = { left = '( ', right = ' )' } },
['('] = { output = { left = '(', right = ')' } },
['{'] = { output = { left = '{\n', right = '\n}' } },
['['] = { output = { left = '[', right = ']' } },
},
}

-- // custom mini plugins
--
require('mini.starter').setup()
-- require('mini.bufremove').setup()

-- Simple and easy statusline.
-- You could remove this setup call if you don't like it,
Expand All @@ -944,7 +1039,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',
'c',
'diff',
'html',
'lua',
'luadoc',
'markdown',
'markdown_inline',
'query',
'vim',
'vimdoc',
'html',
'javascript',
'typescript',
'tsx',
'vue',
},
-- Autoinstall languages that are not installed
auto_install = true,
highlight = {
Expand All @@ -955,6 +1067,9 @@ require('lazy').setup({
additional_vim_regex_highlighting = { 'ruby' },
},
indent = { enable = true, disable = { 'ruby' } },
autotag = {
enabled = true,
},
},
-- There are additional nvim-treesitter modules that you can use to interact
-- with nvim-treesitter. You should go explore a few and see what interests you:
Expand All @@ -974,17 +1089,17 @@ require('lazy').setup({
-- Uncomment any of the lines below to enable them (you will need to restart nvim).
--
-- 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.indent_line',
require 'kickstart.plugins.lint',
require 'kickstart.plugins.neo-tree',
require 'kickstart.plugins.gitsigns', -- adds gitsigns recommend keymaps
require 'kickstart.plugins.nvim-ts-autotag', -- adds nvim-ts-autotag

-- 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.
-- { import = 'custom.plugins' },
{ import = 'custom.plugins' },
--
-- For additional information with loading, sourcing and examples see `:help lazy.nvim-🔌-plugin-spec`
-- Or use telescope!
Expand Down
14 changes: 14 additions & 0 deletions lua/custom/keybindings.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
-- Custom Keybinds.

vim.keymap.set('i', 'jk', '<Esc>', { desc = 'escape' })
vim.keymap.set('i', 'kj', '<Esc>', { desc = 'escape' })

vim.keymap.set('n', ',,', '<Cmd>ToggleTerm<CR>', { desc = 'Open terminal in horizontal split' })
vim.keymap.set('t', ',,', '<Cmd>ToggleTerm<CR>', { desc = 'Open terminal in horizontal split' })

-- vim.keymap.set('n', '<C-q>', '<Cmd>bdelete<CR>')

-- Change buffer by number (example Alt+1, Alt+2...)
for i = 1, 9 do
vim.keymap.set('n', '<M-' .. i .. '>', '<Cmd>BufferLineGoToBuffer ' .. i .. '<CR>')
end
Loading