commit - 3be0639a9062658804becb993d8b2687c123c9c2
commit + 97347067f65c59c6975f47587748119f5b2f9aba
blob - 90b9c4a7b0a0a6a9f017bdc48ffac8843a9392d2
blob + 6628c28a24012404d3cb4d16909295ea5101c780
--- init.lua
+++ init.lua
vim.g.mapleader = ' '
vim.g.maplocalleader = ' '
-require 'plugins.lazy'
+require('plugins.lazy')
require('lazy').setup({
- require 'plugins/telescope'
+ require('plugins/telescope'),
+ require('plugins/mason'),
+ require('plugins/lspconfig'),
+ require('plugins/conform'),
})
-require 'config.options'
-require 'config.keymaps'
+require('config.options')
+require('config.keymaps')
blob - 995738b008bada3c6825615a94fbd1640f7a7c32
blob + 5f1f13082416d29610789fc428681e9fb8568bbd
--- lazy-lock.json
+++ lazy-lock.json
{
+ "conform.nvim": { "branch": "master", "commit": "374aaf384e2e841607b8e2fe63fa3ad01d111c91" },
"lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" },
+ "mason-lspconfig.nvim": { "branch": "main", "commit": "d39a75bbce4b8aad5d627191ea915179c77c100f" },
+ "mason-tool-installer.nvim": { "branch": "main", "commit": "aafae207d5a2a28c59c9d478d8581c2739135d09" },
+ "mason.nvim": { "branch": "main", "commit": "7c7318e8bae7e3536ef6b9e86b9e38e74f2e125e" },
+ "nvim-lspconfig": { "branch": "master", "commit": "61e5109c8cf24807e4ae29813a3a82b31821dd45" },
"plenary.nvim": { "branch": "master", "commit": "857c5ac632080dba10aae49dba902ce3abf91b35" },
"telescope-fzf-native.nvim": { "branch": "main", "commit": "1f08ed60cafc8f6168b72b80be2b2ea149813e55" },
+ "telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" },
"telescope.nvim": { "branch": "0.1.x", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" }
}
blob - 0974f2dad9ec8b6ca79d7e71136f442486e8c4bc
blob + b2b1a0c36baa9b9cd650b87130f0229893bba2b6
--- lua/config/keymaps.lua
+++ lua/config/keymaps.lua
vim.keymap.set('n', '<C-j>', '<C-w><C-j>', { desc = 'Move focus to the lower window' })
vim.keymap.set('n', '<C-k>', '<C-w><C-k>', { desc = 'Move focus to the upper window' })
-
-- Highlight when yanking (copying) text
-- Try it with `yap` in normal mode
-- See `:help vim.highlight.on_yank()`
vim.api.nvim_create_autocmd('TextYankPost', {
- desc = 'Highlight when yanking (copying) text',
- group = vim.api.nvim_create_augroup('kickstart-highlight-yank', { clear = true }),
- callback = function()
- vim.highlight.on_yank()
- end,
+ desc = 'Highlight when yanking (copying) text',
+ group = vim.api.nvim_create_augroup('kickstart-highlight-yank', { clear = true }),
+ callback = function()
+ vim.highlight.on_yank()
+ end,
})
vim.keymap.set('t', '<Esc><Esc>', '<C-\\><C-n>', { desc = 'Exit terminal mode' })
vim.keymap.set('n', '<leader>gf', '<cmd>Telescope git_files<CR>', { desc = 'Find Git-tracked files' })
vim.keymap.set('n', '<leader>sh', '<cmd>Telescope help_tags<CR>', { desc = 'Search help tags' })
vim.keymap.set('n', '<leader>sr', '<cmd>Telescope oldfiles<CR>', { desc = 'List recent files' })
-vim.keymap.set('n', '<leader>sz', '<cmd>Telescope current_buffer_fuzzy_find<CR>', { desc = 'Fuzzy find in current buffer' })
+vim.keymap.set(
+ 'n',
+ '<leader>sz',
+ '<cmd>Telescope current_buffer_fuzzy_find<CR>',
+ { desc = 'Fuzzy find in current buffer' }
+)
+
+-- Conform
+vim.keymap.set({ 'n', 'x' }, '<leader>f', function()
+ require('conform').format({ async = true, lsp_fallback = true })
+end, { desc = '[C]ode [F]ormat' })
+
+-- LSP keymaps (set on LspAttach)
+vim.api.nvim_create_autocmd('LspAttach', {
+ group = vim.api.nvim_create_augroup('UserLspConfig', { clear = true }),
+ callback = function(event)
+ local lsp_map = function(keys, func, desc, mode)
+ mode = mode or 'n'
+ vim.keymap.set(mode, keys, func, { buffer = event.buf, desc = 'LSP: ' .. desc })
+ end
+
+ -- Core navigation (single-key, no prefix)
+ lsp_map('gd', require('telescope.builtin').lsp_definitions, 'Go to Definition')
+ lsp_map('gD', vim.lsp.buf.declaration, 'Go to Declaration')
+ lsp_map('gi', require('telescope.builtin').lsp_implementations, 'Go to Implementation')
+ lsp_map('gr', require('telescope.builtin').lsp_references, 'Get References')
+ lsp_map('K', vim.lsp.buf.hover, 'Show hover documentation')
+
+ -- Leader-based LSP actions (under <leader>l for less frequent actions)
+ lsp_map('<leader>lr', vim.lsp.buf.rename, 'Rename across multiple files', 'n')
+ lsp_map('<leader>la', vim.lsp.buf.code_action, 'Code actions', { 'n', 'x' })
+ lsp_map('<leader>lt', require('telescope.builtin').lsp_type_definitions, 'Type Definition')
+ end,
+})
blob - cfba14dc15db438fe815d17a0d21d3f65ecaea4f
blob + 60376135828e270a184d042effe1e8f8aeb9d4e3
--- lua/config/options.lua
+++ lua/config/options.lua
-- Sync clipboard between OS and Neovim.
vim.schedule(function()
- vim.o.clipboard = 'unnamedplus'
+ vim.o.clipboard = 'unnamedplus'
end)
-- Enable break indent
-- instead raise a dialog asking if you wish to save the current file(s)
-- See `:help 'confirm'`
vim.o.confirm = true
-
--- vim: ts=2 sts=2 sw=2 et
blob - 242ede334e2859fea69f50f538bf9c6b6aad4d82
blob + 25523869af3986209d2421e9c188b113222da7ef
--- lua/plugins/lazy.lua
+++ lua/plugins/lazy.lua
-local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
+local lazypath = vim.fn.stdpath('data') .. '/lazy/lazy.nvim'
if not (vim.uv or vim.loop).fs_stat(lazypath) then
- local lazyrepo = "https://github.com/folke/lazy.nvim.git"
- local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
- if vim.v.shell_error ~= 0 then
- vim.api.nvim_echo({
- { "Failed to clone lazy.nvim:\n", "ErrorMsg" },
- { out, "WarningMsg" },
- { "\nPress any key to exit..." },
- }, true, {})
- vim.fn.getchar()
- os.exit(1)
- end
+ local lazyrepo = 'https://github.com/folke/lazy.nvim.git'
+ local out = vim.fn.system({ 'git', 'clone', '--filter=blob:none', '--branch=stable', lazyrepo, lazypath })
+ if vim.v.shell_error ~= 0 then
+ vim.api.nvim_echo({
+ { 'Failed to clone lazy.nvim:\n', 'ErrorMsg' },
+ { out, 'WarningMsg' },
+ { '\nPress any key to exit...' },
+ }, true, {})
+ vim.fn.getchar()
+ os.exit(1)
+ end
end
vim.opt.runtimepath:prepend(lazypath)
blob - /dev/null
blob + 609b6c2631e6da6463e0e6037354551ade1d59a8 (mode 644)
--- /dev/null
+++ lua/plugins/conform.lua
+return {
+ {
+ 'stevearc/conform.nvim',
+ cmd = { 'ConformInfo' },
+ opts = {
+ notify_on_error = true,
+ formatters_by_ft = {
+ lua = { 'stylua' },
+ },
+ },
+ },
+}
blob - 4338fe2b02e3d3bdb5f6336488b458890784eaaa
blob + a95912f76c3be67ed25ef341e032eb2506d1235f
--- lua/plugins/telescope.lua
+++ lua/plugins/telescope.lua
branch = '0.1.x',
dependencies = {
'nvim-lua/plenary.nvim',
+ { 'nvim-telescope/telescope-ui-select.nvim' },
{
- 'nvim-telescope/telescope-fzf-native.nvim',
+ 'nvim-telescope/telescope-fzf-native.nvim',
+ -- `build` is used to run some command when the plugin is installed/updated.
+ -- This is only run then, not every time Neovim starts up.
+ build = 'make',
- -- `build` is used to run some command when the plugin is installed/updated.
- -- This is only run then, not every time Neovim starts up.
- build = 'make',
-
- -- `cond` is a condition used to determine whether this plugin should be
- -- installed and loaded.
- cond = function()
- return vim.fn.executable 'make' == 1
- end,
- },
+ -- `cond` is a condition used to determine whether this plugin should be
+ -- installed and loaded.
+ cond = function()
+ return vim.fn.executable('make') == 1
+ end,
+ },
},
cmd = 'Telescope', -- Lazy-load on :Telescope command
config = function()
pcall(require('telescope').load_extension, 'fzf')
+ pcall(require('telescope').load_extension, 'ui-select')
require('telescope').setup({
defaults = {
-- Minimal layout for speed
},
},
},
+ extensions = {
+ ['ui-select'] = {
+ require('telescope.themes').get_dropdown(),
+ },
+ },
})
end,
}
blob - /dev/null
blob + d5c6154c7eb54ceb8d2132da4c0dd07ab195af74 (mode 644)
--- /dev/null
+++ lua/plugins/lspconfig.lua
+return {
+ {
+ 'neovim/nvim-lspconfig',
+ dependencies = {
+ { 'williamboman/mason-lspconfig.nvim' },
+ },
+ config = function()
+ local lspconfig = require('lspconfig')
+ local capabilities = vim.lsp.protocol.make_client_capabilities()
+
+ vim.diagnostic.config({
+ severity_sort = true,
+ float = { border = 'rounded', source = 'if_many' },
+ underline = { severity = vim.diagnostic.severity.ERROR },
+ signs = vim.g.have_nerd_font and {
+ text = {
+ [vim.diagnostic.severity.ERROR] = ' ',
+ [vim.diagnostic.severity.WARN] = ' ',
+ [vim.diagnostic.severity.INFO] = ' ',
+ [vim.diagnostic.severity.HINT] = ' ',
+ },
+ } or {},
+ virtual_text = {
+ source = 'if_many',
+ spacing = 2,
+ format = function(diagnostic)
+ local diagnostic_message = {
+ [vim.diagnostic.severity.ERROR] = diagnostic.message,
+ [vim.diagnostic.severity.WARN] = diagnostic.message,
+ [vim.diagnostic.severity.INFO] = diagnostic.message,
+ [vim.diagnostic.severity.HINT] = diagnostic.message,
+ }
+ return diagnostic_message[diagnostic.severity]
+ end,
+ },
+ })
+
+ -- Define LSP servers and their configurations
+ local servers = {
+ lua_ls = {
+ settings = {
+ Lua = {
+ diagnostics = { globals = { 'vim' } },
+ workspace = { checkThirdParty = false },
+ telemetry = { enable = false },
+ },
+ },
+ },
+ }
+
+ for server_name, server_config in pairs(servers) do
+ lspconfig[server_name].setup(vim.tbl_deep_extend('force', {
+ capabilities = capabilities,
+ }, server_config))
+ end
+ end,
+ },
+}
blob - /dev/null
blob + cdf95b5419e6f77c2092a1a841cfdc91af244d47 (mode 644)
--- /dev/null
+++ lua/plugins/mason.lua
+return {
+ {
+ "williamboman/mason.nvim",
+ opts = {},
+ },
+ {
+ "williamboman/mason-lspconfig.nvim",
+ opts = {
+ ensure_installed = { "lua_ls" },
+ automatic_installation = true,
+ },
+ },
+ {
+ "WhoIsSethDaniel/mason-tool-installer.nvim",
+ opts = {
+ ensure_installed = { "stylua" },
+ },
+ },
+}
blob - /dev/null
blob + b352dd7109ae42c6169064ca7bbec6b5e605cb6c (mode 644)
--- /dev/null
+++ stylua.toml
+indent_type = "Spaces"
+indent_width = 4
+column_width = 120
+quote_style = "AutoPreferSingle"