Add LSP configurations to neovim. Add conform/telescope plugins.
This commit is contained in:
@@ -5,13 +5,10 @@ vim.g.maplocalleader = ','
|
|||||||
-- Set to true if you have a Nerd Font installed and selected in the terminal
|
-- Set to true if you have a Nerd Font installed and selected in the terminal
|
||||||
vim.g.have_nerd_font = true
|
vim.g.have_nerd_font = true
|
||||||
|
|
||||||
-- [[ Setting options ]]
|
|
||||||
require 'options'
|
require 'options'
|
||||||
|
|
||||||
-- [[ Basic Keymaps ]]
|
|
||||||
require 'keymaps'
|
require 'keymaps'
|
||||||
|
|
||||||
-- [[ Install `lazy.nvim` plugin manager ]]
|
|
||||||
require 'config.lazy'
|
require 'config.lazy'
|
||||||
|
require 'config.lsp'
|
||||||
|
|
||||||
vim.cmd.colorscheme 'catppuccin-mocha'
|
vim.cmd.colorscheme 'catppuccin-mocha'
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
{
|
{
|
||||||
"catppuccin": { "branch": "main", "commit": "e79d09fa347b367e0e7f693bfe87dba932a8cbd1" },
|
"catppuccin": { "branch": "main", "commit": "af58927c55c9f3272c940ff02b3cee94a1249f26" },
|
||||||
"lazy.nvim": { "branch": "main", "commit": "59334064f8604ca073791c25dcc5c9698865406e" },
|
"conform.nvim": { "branch": "master", "commit": "fbcb4fa7f34bfea9be702ffff481a8e336ebf6ed" },
|
||||||
"neo-tree.nvim": { "branch": "v3.x", "commit": "f14ac20f98fb62769eaf4de1dc69fbee5fcf3384" },
|
"lazy.nvim": { "branch": "main", "commit": "1ea3c4085785f460fb0e46d2fe1ee895f5f9e7c1" },
|
||||||
|
"neo-tree.nvim": { "branch": "main", "commit": "4c60a198e3f92098778a32a1c76d2bd7ba46a3b5" },
|
||||||
"nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" },
|
"nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" },
|
||||||
"nvim-web-devicons": { "branch": "master", "commit": "b8221e42cf7287c4dcde81f232f58d7b947c210d" },
|
"nvim-web-devicons": { "branch": "master", "commit": "b8221e42cf7287c4dcde81f232f58d7b947c210d" },
|
||||||
"plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" },
|
"plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" },
|
||||||
|
"telescope-fzf-native.nvim": { "branch": "main", "commit": "1f08ed60cafc8f6168b72b80be2b2ea149813e55" },
|
||||||
"telescope.nvim": { "branch": "master", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" }
|
"telescope.nvim": { "branch": "master", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" }
|
||||||
}
|
}
|
||||||
|
|||||||
30
config/nvim/lsp/lua_ls.lua
Normal file
30
config/nvim/lsp/lua_ls.lua
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
-- config for lua-language-server
|
||||||
|
return {
|
||||||
|
-- Command and arguments to start the server.
|
||||||
|
cmd = { 'lua-language-server' },
|
||||||
|
|
||||||
|
-- Filetypes to automatically attach to.
|
||||||
|
filetypes = { 'lua' },
|
||||||
|
|
||||||
|
-- Sets the "root directory" to the parent directory of the file in the
|
||||||
|
-- current buffer that contains either a ".luarc.json" or a
|
||||||
|
-- ".luarc.jsonc" file. Files that share a root directory will reuse
|
||||||
|
-- the connection to the same LSP server.
|
||||||
|
-- Nested lists indicate equal priority, see |vim.lsp.Config|.
|
||||||
|
root_markers = { { '.luarc.json', '.luarc.jsonc' }, '.git' },
|
||||||
|
|
||||||
|
-- Specific settings to send to the server. The schema for this is
|
||||||
|
-- defined by the server. For example the schema for lua-language-server
|
||||||
|
-- can be found here https://raw.githubusercontent.com/LuaLS/vscode-lua/master/setting/schema.json
|
||||||
|
settings = {
|
||||||
|
Lua = {
|
||||||
|
runtime = {
|
||||||
|
version = 'LuaJIT',
|
||||||
|
},
|
||||||
|
diagnostics = {
|
||||||
|
-- Get the language server to recognize the `vim` global
|
||||||
|
globals = { 'vim' },
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
28
config/nvim/lua/config/lsp.lua
Normal file
28
config/nvim/lua/config/lsp.lua
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
-- enables LSPs and configures useful bindings
|
||||||
|
|
||||||
|
vim.lsp.enable('lua_ls')
|
||||||
|
|
||||||
|
vim.api.nvim_create_autocmd('LspAttach', {
|
||||||
|
callback = function(ev)
|
||||||
|
local client = vim.lsp.get_client_by_id(ev.data.client_id)
|
||||||
|
if client and client:supports_method(vim.lsp.protocol.Methods.textDocument_completion) then
|
||||||
|
vim.opt.completeopt = { 'menu', 'menuone', 'noinsert', 'fuzzy', 'popup' }
|
||||||
|
vim.lsp.completion.enable(true, client.id, ev.buf, { autotrigger = true })
|
||||||
|
vim.keymap.set('i', '<C-Space>', function()
|
||||||
|
vim.lsp.completion.get()
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Diagnostics
|
||||||
|
vim.diagnostic.config({
|
||||||
|
-- Use the default configuration
|
||||||
|
-- virtual_lines = true
|
||||||
|
|
||||||
|
-- Alternatively, customize specific options
|
||||||
|
virtual_lines = {
|
||||||
|
-- Only show virtual line diagnostics for the current cursor line
|
||||||
|
current_line = true,
|
||||||
|
},
|
||||||
|
})
|
||||||
@@ -16,5 +16,3 @@ vim.keymap.set('n', '<C-h>', '<C-w><C-h>', { desc = 'Move focus to the left wind
|
|||||||
vim.keymap.set('n', '<C-l>', '<C-w><C-l>', { desc = 'Move focus to the right window' })
|
vim.keymap.set('n', '<C-l>', '<C-w><C-l>', { desc = 'Move focus to the right window' })
|
||||||
vim.keymap.set('n', '<C-j>', '<C-w><C-j>', { desc = 'Move focus to the lower window' })
|
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' })
|
vim.keymap.set('n', '<C-k>', '<C-w><C-k>', { desc = 'Move focus to the upper window' })
|
||||||
|
|
||||||
-- vim: ts=2 sts=2 sw=2 et
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
-- See `:help vim.o`
|
-- See `:help vim.o`
|
||||||
|
|
||||||
-- Make line numbers default
|
-- Make line numbers default
|
||||||
vim.o.number = true
|
vim.o.relativenumber = true
|
||||||
|
|
||||||
-- Enable mouse mode, can be useful for resizing splits for example!
|
-- Enable mouse mode, can be useful for resizing splits for example!
|
||||||
vim.o.mouse = 'a'
|
vim.o.mouse = 'a'
|
||||||
@@ -58,3 +58,10 @@ vim.o.scrolloff = 10
|
|||||||
-- instead raise a dialog asking if you wish to save the current file(s)
|
-- instead raise a dialog asking if you wish to save the current file(s)
|
||||||
-- See `:help 'confirm'`
|
-- See `:help 'confirm'`
|
||||||
vim.o.confirm = true
|
vim.o.confirm = true
|
||||||
|
|
||||||
|
-- default tab/space configuration
|
||||||
|
vim.o.tabstop = 2
|
||||||
|
vim.o.softtabstop = 2
|
||||||
|
vim.o.shiftwidth = 2
|
||||||
|
vim.o.expandtab = true
|
||||||
|
|
||||||
|
|||||||
15
config/nvim/lua/plugins/conform.lua
Normal file
15
config/nvim/lua/plugins/conform.lua
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
return {
|
||||||
|
{
|
||||||
|
'stevearc/conform.nvim',
|
||||||
|
opts = {
|
||||||
|
formatters_by_ft = {
|
||||||
|
lua = { 'stylua' },
|
||||||
|
javascript = { 'prettier' },
|
||||||
|
},
|
||||||
|
format_on_save = {
|
||||||
|
timeout_ms = 500,
|
||||||
|
lsp_format = 'fallback',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
@@ -1,4 +1,8 @@
|
|||||||
return {
|
return {
|
||||||
'nvim-telescope/telescope.nvim', tag = '0.1.8',
|
{
|
||||||
dependencies = { 'nvim-lua/plenary.nvim' }
|
'nvim-telescope/telescope.nvim',
|
||||||
|
tag = '0.1.8',
|
||||||
|
dependencies = { 'nvim-lua/plenary.nvim', { 'nvim-telescope/telescope-fzf-native.nvim', build = 'make' } },
|
||||||
|
config = function() end,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +0,0 @@
|
|||||||
# Install packages locally to prevent interference with packages installed with pacman
|
|
||||||
PATH=$PATH:~/.npm-global/bin
|
|
||||||
export GEM_HOME="$(gem env user_gemhome)"
|
|
||||||
PATH="$PATH:$GEM_HOME/bin"
|
|
||||||
@@ -13,13 +13,16 @@ compinit
|
|||||||
# Simple prompt
|
# Simple prompt
|
||||||
PROMPT='%F{magenta}%* %F{cyan}%~ %(?.%F{green}.%F{red})%#%f '
|
PROMPT='%F{magenta}%* %F{cyan}%~ %(?.%F{green}.%F{red})%#%f '
|
||||||
|
|
||||||
|
# PATH configuration
|
||||||
|
PATH=$PATH:~/.npm-global/bin
|
||||||
|
# Install packages locally to prevent interference with packages installed with pacman
|
||||||
|
export GEM_HOME="$(gem env user_gemhome)"
|
||||||
|
PATH="$PATH:$GEM_HOME/bin"
|
||||||
|
|
||||||
|
# Useful aliases
|
||||||
alias ls='ls --color=auto'
|
alias ls='ls --color=auto'
|
||||||
alias vim='nvim'
|
alias vim='nvim'
|
||||||
alias ..='cd ..'
|
alias open='xdg-open'
|
||||||
alias ...='cd ../..'
|
|
||||||
alias ....='cd ../../..'
|
|
||||||
alias .....='cd ../../../..'
|
|
||||||
alias ......='cd ../../../../..'
|
|
||||||
|
|
||||||
# Fun tools
|
# Fun tools
|
||||||
alias transcat='queercat -f transgender'
|
alias transcat='queercat -f transgender'
|
||||||
|
|||||||
Reference in New Issue
Block a user