mirror of https://github.com/NvChad/NvChad
commit
8c369f629b
@ -1,45 +0,0 @@
|
||||
vim.cmd [[packadd nvim-lspconfig]]
|
||||
vim.cmd [[packadd nvim-compe]]
|
||||
|
||||
local nvim_lsp = require("lspconfig")
|
||||
|
||||
function on_attach(client)
|
||||
local function buf_set_keymap(...)
|
||||
vim.api.nvim_buf_set_keymap(bufnr, ...)
|
||||
end
|
||||
local function buf_set_option(...)
|
||||
vim.api.nvim_buf_set_option(bufnr, ...)
|
||||
end
|
||||
|
||||
buf_set_option("omnifunc", "v:lua.vim.lsp.omnifunc")
|
||||
|
||||
-- Mappings.
|
||||
local opts = {noremap = true, silent = true}
|
||||
buf_set_keymap("n", "gD", "<Cmd>lua vim.lsp.buf.declaration()<CR>", opts)
|
||||
buf_set_keymap("n", "gd", "<Cmd>lua vim.lsp.buf.definition()<CR>", opts)
|
||||
buf_set_keymap("n", "K", "<Cmd>lua vim.lsp.buf.hover()<CR>", opts)
|
||||
buf_set_keymap("n", "gi", "<cmd>lua vim.lsp.buf.implementation()<CR>", opts)
|
||||
buf_set_keymap("n", "<C-k>", "<cmd>lua vim.lsp.buf.signature_help()<CR>", opts)
|
||||
buf_set_keymap("n", "<space>wa", "<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>", opts)
|
||||
buf_set_keymap("n", "<space>wr", "<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>", opts)
|
||||
buf_set_keymap("n", "<space>wl", "<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>", opts)
|
||||
buf_set_keymap("n", "<space>D", "<cmd>lua vim.lsp.buf.type_definition()<CR>", opts)
|
||||
buf_set_keymap("n", "<space>rn", "<cmd>lua vim.lsp.buf.rename()<CR>", opts)
|
||||
buf_set_keymap("n", "gr", "<cmd>lua vim.lsp.buf.references()<CR>", opts)
|
||||
buf_set_keymap("n", "<space>e", "<cmd>lua vim.lsp.diagnostic.show_line_diagnostics()<CR>", opts)
|
||||
buf_set_keymap("n", "[d", "<cmd>lua vim.lsp.diagnostic.goto_prev()<CR>", opts)
|
||||
buf_set_keymap("n", "]d", "<cmd>lua vim.lsp.diagnostic.goto_next()<CR>", opts)
|
||||
buf_set_keymap("n", "<space>q", "<cmd>lua vim.lsp.diagnostic.set_loclist()<CR>", opts)
|
||||
|
||||
-- Set some keybinds conditional on server capabilities
|
||||
if client.resolved_capabilities.document_formatting then
|
||||
buf_set_keymap("n", "<space>f", "<cmd>lua vim.lsp.buf.formatting()<CR>", opts)
|
||||
elseif client.resolved_capabilities.document_range_formatting then
|
||||
buf_set_keymap("n", "<space>f", "<cmd>lua vim.lsp.buf.range_formatting()<CR>", opts)
|
||||
end
|
||||
end
|
||||
|
||||
local servers = {"tsserver", "cssls", "html" , "pyls"}
|
||||
for _, lsp in ipairs(servers) do
|
||||
nvim_lsp[lsp].setup {on_attach = on_attach}
|
||||
end
|
@ -0,0 +1,100 @@
|
||||
function on_attach(client)
|
||||
local function map(...)
|
||||
vim.api.nvim_buf_set_keymap(bufnr, ...)
|
||||
end
|
||||
|
||||
local function buf_set_option(...)
|
||||
vim.api.nvim_buf_set_option(bufnr, ...)
|
||||
end
|
||||
|
||||
buf_set_option("omnifunc", "v:lua.vim.lsp.omnifunc")
|
||||
|
||||
-- Mappings.
|
||||
local opts = {noremap = true, silent = true, normal = true}
|
||||
map("gD", "<Cmd>lua vim.lsp.buf.declaration()<CR>", opts)
|
||||
map("gd", "<Cmd>lua vim.lsp.buf.definition()<CR>", opts)
|
||||
map("K", "<Cmd>lua vim.lsp.buf.hover()<CR>", opts)
|
||||
map("gi", "<cmd>lua vim.lsp.buf.implementation()<CR>", opts)
|
||||
map("<C-k>", "<cmd>lua vim.lsp.buf.signature_help()<CR>", opts)
|
||||
map("<space>wa", "<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>", opts)
|
||||
map("<space>wr", "<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>", opts)
|
||||
map("<space>wl", "<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>", opts)
|
||||
map("<space>D", "<cmd>lua vim.lsp.buf.type_definition()<CR>", opts)
|
||||
map("<space>rn", "<cmd>lua vim.lsp.buf.rename()<CR>", opts)
|
||||
map("gr", "<cmd>lua vim.lsp.buf.references()<CR>", opts)
|
||||
map("<space>e", "<cmd>lua vim.lsp.diagnostic.show_line_diagnostics()<CR>", opts)
|
||||
map("[d", "<cmd>lua vim.lsp.diagnostic.goto_prev()<CR>", opts)
|
||||
map("]d", "<cmd>lua vim.lsp.diagnostic.goto_next()<CR>", opts)
|
||||
map("<space>q", "<cmd>lua vim.lsp.diagnostic.set_loclist()<CR>", opts)
|
||||
|
||||
-- Set some keybinds conditional on server capabilities
|
||||
if client.resolved_capabilities.document_formatting then
|
||||
map("<space>f", "<cmd>lua vim.lsp.buf.formatting()<CR>", opts)
|
||||
elseif client.resolved_capabilities.document_range_formatting then
|
||||
map("<space>f", "<cmd>lua vim.lsp.buf.range_formatting()<CR>", opts)
|
||||
end
|
||||
end
|
||||
|
||||
local lspconf = require "lspconfig"
|
||||
local servers = {"html", "cssls", "tsserver", "pyright", "bashls"}
|
||||
|
||||
for k, lang in pairs(servers) do
|
||||
lspconf[lang].setup {
|
||||
root_dir = vim.loop.cwd
|
||||
}
|
||||
end
|
||||
|
||||
-- lua lsp settings
|
||||
USER = "/home/" .. vim.fn.expand("$USER")
|
||||
|
||||
local sumneko_root_path = USER .. "/.config/lua-language-server"
|
||||
local sumneko_binary = USER .. "/.config/lua-language-server/bin/Linux/lua-language-server"
|
||||
|
||||
require "lspconfig".sumneko_lua.setup {
|
||||
cmd = {sumneko_binary, "-E", sumneko_root_path .. "/main.lua"},
|
||||
root_dir = function()
|
||||
return vim.loop.cwd()
|
||||
end,
|
||||
settings = {
|
||||
Lua = {
|
||||
runtime = {
|
||||
version = "LuaJIT",
|
||||
path = vim.split(package.path, ";")
|
||||
},
|
||||
diagnostics = {
|
||||
globals = {"vim"}
|
||||
},
|
||||
workspace = {
|
||||
library = {
|
||||
[vim.fn.expand("$VIMRUNTIME/lua")] = true,
|
||||
[vim.fn.expand("$VIMRUNTIME/lua/vim/lsp")] = true
|
||||
}
|
||||
},
|
||||
telemetry = {
|
||||
enable = false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
-- replace the default lsp diagnostic letters with prettier symbols
|
||||
vim.fn.sign_define("LspDiagnosticsSignError", {text = "", numhl = "LspDiagnosticsDefaultError"})
|
||||
vim.fn.sign_define("LspDiagnosticsSignWarning", {text = "", numhl = "LspDiagnosticsDefaultWarning"})
|
||||
vim.fn.sign_define("LspDiagnosticsSignInformation", {text = "", numhl = "LspDiagnosticsDefaultInformation"})
|
||||
vim.fn.sign_define("LspDiagnosticsSignHint", {text = "", numhl = "LspDiagnosticsDefaultHint"})
|
||||
|
||||
-- diagnostics highlights
|
||||
|
||||
local cmd = vim.cmd
|
||||
|
||||
cmd "hi LspDiagnosticsSignError guifg=#f9929b"
|
||||
cmd "hi LspDiagnosticsVirtualTextError guifg=#BF616A"
|
||||
|
||||
cmd "hi LspDiagnosticsSignWarning guifg=#EBCB8B"
|
||||
cmd "hi LspDiagnosticsVirtualTextWarning guifg=#EBCB8B"
|
||||
|
||||
cmd "hi LspDiagnosticsSignInformation guifg=#A3BE8C"
|
||||
cmd "hi LspDiagnosticsVirtualTextInformation guifg=#A3BE8C"
|
||||
|
||||
cmd "hi LspDiagnosticsSignHint guifg=#b6bdca"
|
||||
cmd "hi LspDiagnosticsVirtualTextHint guifg=#b6bdca"
|
@ -1,36 +1,47 @@
|
||||
-- check if packer is installed (~/local/share/nvim/site/pack)
|
||||
local packer_exists = pcall(vim.cmd, [[packadd packer.nvim]])
|
||||
local packer = require("packer")
|
||||
local use = packer.use
|
||||
|
||||
-- using { } when using a different branch of the plugin or loading the plugin with certain commands
|
||||
-- using { } for using different branch , loading plugin with certain commands etc
|
||||
return require("packer").startup(
|
||||
function()
|
||||
use {"wbthomason/packer.nvim", opt = true}
|
||||
use {"lukas-reineke/indent-blankline.nvim", branch = "lua"}
|
||||
use "wbthomason/packer.nvim"
|
||||
|
||||
-- color related stuff
|
||||
use "norcalli/nvim-base16.lua"
|
||||
use "kyazdani42/nvim-web-devicons"
|
||||
use "kyazdani42/nvim-tree.lua"
|
||||
use "norcalli/nvim-colorizer.lua"
|
||||
|
||||
-- lsp stuff
|
||||
use "nvim-treesitter/nvim-treesitter"
|
||||
use "neovim/nvim-lspconfig"
|
||||
use "hrsh7th/nvim-compe"
|
||||
use "onsails/lspkind-nvim"
|
||||
use "sbdchd/neoformat"
|
||||
use "nvim-lua/plenary.nvim"
|
||||
|
||||
use "lewis6991/gitsigns.nvim"
|
||||
use "akinsho/nvim-bufferline.lua"
|
||||
use "glepnir/galaxyline.nvim"
|
||||
use "907th/vim-auto-save"
|
||||
use "nvim-treesitter/nvim-treesitter"
|
||||
use "norcalli/nvim-colorizer.lua"
|
||||
use "ryanoasis/vim-devicons"
|
||||
use "sbdchd/neoformat"
|
||||
use "neovim/nvim-lspconfig"
|
||||
use "hrsh7th/nvim-compe"
|
||||
use "windwp/nvim-autopairs"
|
||||
use "alvan/vim-closetag"
|
||||
use "tweekmonster/startuptime.vim"
|
||||
use "onsails/lspkind-nvim"
|
||||
|
||||
-- snippet support
|
||||
use "hrsh7th/vim-vsnip"
|
||||
use "rafamadriz/friendly-snippets"
|
||||
|
||||
-- file managing , picker etc
|
||||
use "kyazdani42/nvim-tree.lua"
|
||||
use "kyazdani42/nvim-web-devicons"
|
||||
use "ryanoasis/vim-devicons"
|
||||
use "nvim-telescope/telescope.nvim"
|
||||
use "nvim-telescope/telescope-media-files.nvim"
|
||||
use "nvim-lua/popup.nvim"
|
||||
|
||||
-- misc
|
||||
use "tweekmonster/startuptime.vim"
|
||||
use "907th/vim-auto-save"
|
||||
use "karb94/neoscroll.nvim"
|
||||
use "kdav5758/TrueZen.nvim"
|
||||
|
||||
use "nekonako/xresources-nvim"
|
||||
|
||||
use {"lukas-reineke/indent-blankline.nvim", branch = "lua"}
|
||||
end
|
||||
)
|
@ -0,0 +1,47 @@
|
||||
local true_zen = require("true-zen")
|
||||
|
||||
true_zen.setup(
|
||||
{
|
||||
true_false_commands = false,
|
||||
cursor_by_mode = false,
|
||||
before_minimalist_mode_shown = true,
|
||||
before_minimalist_mode_hidden = true,
|
||||
after_minimalist_mode_shown = true,
|
||||
after_minimalist_mode_hidden = true,
|
||||
bottom = {
|
||||
hidden_laststatus = 0,
|
||||
hidden_ruler = false,
|
||||
hidden_showmode = false,
|
||||
hidden_showcmd = false,
|
||||
hidden_cmdheight = 1,
|
||||
shown_laststatus = 2,
|
||||
shown_ruler = true,
|
||||
shown_showmode = false,
|
||||
shown_showcmd = false,
|
||||
shown_cmdheight = 1
|
||||
},
|
||||
top = {
|
||||
hidden_showtabline = 0,
|
||||
shown_showtabline = 2
|
||||
},
|
||||
left = {
|
||||
hidden_number = false,
|
||||
hidden_relativenumber = false,
|
||||
hidden_signcolumn = "no",
|
||||
shown_number = true,
|
||||
shown_relativenumber = false,
|
||||
shown_signcolumn = "no"
|
||||
},
|
||||
ataraxis = {
|
||||
just_do_it_for_me = false,
|
||||
left_padding = 37,
|
||||
right_padding = 37,
|
||||
top_padding = 2,
|
||||
bottom_padding = 2,
|
||||
custome_bg = "#1e222a"
|
||||
},
|
||||
integrations = {
|
||||
integration_galaxyline = true
|
||||
}
|
||||
}
|
||||
)
|
Loading…
Reference in New Issue