Initial LSP setup with formatting and autocompletion

This commit is contained in:
2026-06-01 12:46:46 +04:00
commit fd3267ca21
13 changed files with 263 additions and 0 deletions
+1
View File
@@ -0,0 +1 @@
{}
+14
View File
@@ -0,0 +1,14 @@
---@type vim.lsp.Config
local settings = {
---@type lspconfig.settings.lua_ls
settings = {
Lua = {
runtime = {
version = 'LuaJIT',
},
workspace = { checkThirdParty = false, library = vim.list_extend({ vim.fn.expand('$VIMRUNTIME') }, vim.api.nvim_get_runtime_file('lua', true)) },
},
},
}
return settings
+3
View File
@@ -0,0 +1,3 @@
local autopairs = require("nvim-autopairs")
autopairs.setup({})
+23
View File
@@ -0,0 +1,23 @@
local telescope = require("telescope")
local builtin = require("telescope.builtin")
local utils = require("utils")
local options = {
defaults = {
path_display = { "truncate" },
sorting_strategy = "ascending",
layout_config = {
prompt_position = "top",
},
},
}
telescope.setup(options)
utils.nmap("<leader>ff", builtin.find_files, "Find Files")
utils.nmap("<leader>fg", builtin.live_grep, "Live Grep")
utils.nmap("<leader>fr", builtin.lsp_references, "LSP References")
utils.nmap("<leader>fi", builtin.lsp_implementations, "LSP Implementations")
utils.nmap("<leader>fs", builtin.lsp_document_symbols, "LSP Document Symbols")
utils.nmap("<leader>fS", builtin.lsp_dynamic_workspace_symbols, "LSP Workspace Symbols")
+3
View File
@@ -0,0 +1,3 @@
local warcraft_api = require("warcraft-api")
warcraft_api.setup({})
+58
View File
@@ -0,0 +1,58 @@
vim.g.mapleader = " "
vim.g.localmapleader = " "
require("plugins")
require("lsp")
require("completion")
require("formatting")
require("colorscheme")
local opt = vim.opt
-- Line numbers
opt.number = true
opt.relativenumber = true
-- Indentation
opt.expandtab = true
opt.tabstop = 4
opt.shiftwidth = 4
opt.softtabstop = 4
opt.smartindent = true
opt.breakindent = true
-- Search
opt.ignorecase = true
opt.smartcase = true
opt.hlsearch = false
opt.incsearch = true
-- Appearance
opt.termguicolors = true
opt.signcolumn = "yes"
opt.cursorline = true
opt.scrolloff = 8
opt.sidescrolloff = 8
opt.wrap = false
opt.colorcolumn = "120"
vim.cmd("colorscheme rose-pine")
-- Splits
opt.splitright = true
opt.splitbelow = true
-- Files
opt.undofile = true
opt.swapfile = false
opt.backup = false
opt.updatetime = 250
-- Clipboard
opt.clipboard = "unnamedplus"
-- Misc
opt.mouse = "a"
opt.showmode = false
opt.isfname:append("@-@")
opt.exrc = true
+1
View File
@@ -0,0 +1 @@
require("rose-pine").setup()
+14
View File
@@ -0,0 +1,14 @@
---@type blink.cmp.API
local cmp = require("blink.cmp")
cmp.build():pwait()
---@type blink.cmp.Config
local cmp_options = {
keymap = { preset = "default" },
completion = { menu = { auto_show = true }, documentation = { auto_show = true } },
sources = { default = { "lsp", "path", "snippets", "buffer" } },
fuzzy = { implementation = "rust" },
}
cmp.setup(cmp_options)
+21
View File
@@ -0,0 +1,21 @@
local conform = require("conform")
---@type conform.setupOpts
local options = {
formatters_by_ft = {
lua = { "stylua" },
},
format_on_save = {
timeout_ms = 500,
lsp_format = "fallback",
},
}
vim.api.nvim_create_autocmd("BufWritePre", {
pattern = "*",
callback = function(args)
conform.format({ bufnr = args.buf })
end,
})
conform.setup(options)
+7
View File
@@ -0,0 +1,7 @@
require("mason").setup({})
require("mason-lspconfig").setup({
ensure_installed = {
"lua_ls",
"stylua",
},
})
+34
View File
@@ -0,0 +1,34 @@
vim.pack.add({
-- Common dependencies
{ src = "https://github.com/nvim-lua/plenary.nvim" },
-- Automatically install language servers
{ src = "https://github.com/mason-org/mason.nvim" },
-- Predefined configs for language servers
{ src = "https://github.com/neovim/nvim-lspconfig" },
-- Automatically enable installed language servers
{ src = "https://github.com/mason-org/mason-lspconfig.nvim" },
-- All-in-one completions engine
{ src = "https://github.com/saghen/blink.lib" },
{ src = "https://github.com/saghen/blink.cmp" },
-- Code formatting
{ src = "https://github.com/stevearc/conform.nvim" },
-- Appearance
{ src = "https://github.com/rose-pine/neovim", name = "rose-pine" },
{ src = "https://github.com/nvim-tree/nvim-web-devicons" },
-- Fuzzy finder
{ src = "https://github.com/nvim-telescope/telescope.nvim" },
{ src = "https://github.com/nvim-telescope/telescope-fzf-native.nvim" },
-- Miscellaneous
{ src = "https://github.com/windwp/nvim-autopairs" },
-- WoW Addon API
{ src = "https://github.com/Tyrannican/warcraft-api.nvim" },
})
+28
View File
@@ -0,0 +1,28 @@
local M = {}
function M.map(mode, keys, func, desc, opts)
vim.keymap.set(
mode,
keys,
func,
vim.tbl_extend("force", {
desc = desc,
noremap = true,
silent = true,
}, opts or {})
)
end
function M.nmap(keys, func, desc, opts)
M.map("n", keys, func, desc, opts)
end
function M.vmap(keys, func, desc, opts)
M.map("v", keys, func, desc, opts)
end
function M.imap(keys, func, desc, opts)
M.map("i", keys, func, desc, opts)
end
return M
+56
View File
@@ -0,0 +1,56 @@
{
"plugins": {
"blink.cmp": {
"rev": "5ee69ea52492fa038b3a1cd8de55edffe205c77d",
"src": "https://github.com/saghen/blink.cmp"
},
"blink.lib": {
"rev": "2cb62890cee636fe46722d03b7b2331e54fb3755",
"src": "https://github.com/saghen/blink.lib"
},
"conform.nvim": {
"rev": "619363c30309d29ffa631e67c8183f2a72caa373",
"src": "https://github.com/stevearc/conform.nvim"
},
"mason-lspconfig.nvim": {
"rev": "0a695750d747db1e7e70bcf0267ef8951c95fc83",
"src": "https://github.com/mason-org/mason-lspconfig.nvim"
},
"mason.nvim": {
"rev": "16ba83bfc8a25f52bb545134f5bee082b195c460",
"src": "https://github.com/mason-org/mason.nvim"
},
"nvim-autopairs": {
"rev": "7b9923abad60b903ece7c52940e1321d39eccc79",
"src": "https://github.com/windwp/nvim-autopairs"
},
"nvim-lspconfig": {
"rev": "9573948c38bfabeec353ae7dd7d3ffec4c506a6b",
"src": "https://github.com/neovim/nvim-lspconfig"
},
"nvim-web-devicons": {
"rev": "dfbfaa967a6f7ec50789bead7ef87e336c1fa63c",
"src": "https://github.com/nvim-tree/nvim-web-devicons"
},
"plenary.nvim": {
"rev": "74b06c6c75e4eeb3108ec01852001636d85a932b",
"src": "https://github.com/nvim-lua/plenary.nvim"
},
"rose-pine": {
"rev": "ff483051a47e27d84bdef47703538df1ed9f4a47",
"src": "https://github.com/rose-pine/neovim"
},
"telescope-fzf-native.nvim": {
"rev": "b25b749b9db64d375d782094e2b9dce53ad53a40",
"src": "https://github.com/nvim-telescope/telescope-fzf-native.nvim"
},
"telescope.nvim": {
"rev": "7d324792b7943e4aa16ad007212e6acc6f9fe335",
"src": "https://github.com/nvim-telescope/telescope.nvim"
},
"warcraft-api.nvim": {
"rev": "c016bc54ed62bca5058cc3bd7553e429dd8caf37",
"src": "https://github.com/Tyrannican/warcraft-api.nvim"
}
}
}