neovim: add presence-nvim and change lsp settings
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
{config, pkgs, ...}:
|
||||
|
||||
{
|
||||
programs.neovim = {
|
||||
enable = true;
|
||||
@@ -22,6 +23,15 @@
|
||||
vim-polyglot
|
||||
nvim-tree-lua
|
||||
(gruvbox.overrideAttrs (oa: { patches = [ ./nvim/gruvbox.patch ]; }))
|
||||
(pkgs.vimUtils.buildVimPlugin {
|
||||
name = "presence-nvim";
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "andweeb";
|
||||
repo = "presence.nvim";
|
||||
rev = "f4c1e227be0a0c863c2de201155401950eda572e";
|
||||
sha256 = "08s4az1gv6r5sl0jqkaf4yzibglibb7n2sivh7qccj8dz8id3883";
|
||||
};
|
||||
})
|
||||
];
|
||||
};
|
||||
};
|
||||
|
@@ -1,10 +1,4 @@
|
||||
require'lspconfig'.rust_analyzer.setup{}
|
||||
require'lspconfig'.tsserver.setup{}
|
||||
require'lspconfig'.clangd.setup{}
|
||||
require'lspconfig'.tsserver.setup{}
|
||||
require'lspconfig'.jedi_language_server.setup{}
|
||||
require'lspconfig'.purescriptls.setup{}
|
||||
|
||||
local nvim_lsp = require('lspconfig')
|
||||
local comm = vim.api.nvim_command
|
||||
local bind = vim.api.nvim_set_keymap
|
||||
local set = function(a) comm("set " .. a) end
|
||||
@@ -182,13 +176,24 @@ do
|
||||
bind('n', string.format("<M-%d>", i), string.format(":BufferGoto %d<CR>", i), {silent=true, noremap=true})
|
||||
end
|
||||
|
||||
--presence.nvim
|
||||
vim.g.presence_neovim_image_text = "Ballin"
|
||||
vim.g.presence_main_image = "file"
|
||||
--vim.g.presence_log_level = "debug"
|
||||
|
||||
--lsp and compe stuff i got from various places
|
||||
vim.api.nvim_buf_set_keymap(0, 'n', 'gD', '<Cmd>lua vim.lsp.buf.declaration()<CR>', {silent=true, noremap=true})
|
||||
vim.api.nvim_buf_set_keymap(0, 'n', 'gd', '<Cmd>lua vim.lsp.buf.definition()<CR>', {silent=true, noremap=true})
|
||||
vim.api.nvim_buf_set_keymap(0, 'n', 'gk', '<Cmd>lua vim.lsp.buf.hover()<CR>', {silent=true, noremap=true})
|
||||
vim.api.nvim_buf_set_keymap(0, 'n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<CR>', {silent=true, noremap=true})
|
||||
vim.api.nvim_buf_set_keymap(0, 'n', 'gr', '<cmd>lua vim.lsp.buf.references()<CR>', {silent=true, noremap=true})
|
||||
vim.api.nvim_buf_set_keymap(0, 'n', "<space>f", "<cmd>lua vim.lsp.buf.formatting()<CR>", {silent=true, noremap=true})
|
||||
local on_attach = function(client, bufnr)
|
||||
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')
|
||||
buf_set_keymap('n', 'gD', '<Cmd>lua vim.lsp.buf.declaration()<CR>', {silent=true, noremap=true})
|
||||
buf_set_keymap('n', 'gd', '<Cmd>lua vim.lsp.buf.definition()<CR>', {silent=true, noremap=true})
|
||||
buf_set_keymap('n', 'gk', '<Cmd>lua vim.lsp.buf.hover()<CR>', {silent=true, noremap=true})
|
||||
buf_set_keymap('n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<CR>', {silent=true, noremap=true})
|
||||
buf_set_keymap('n', 'gr', '<cmd>lua vim.lsp.buf.references()<CR>', {silent=true, noremap=true})
|
||||
buf_set_keymap('n', "<M-f>", "<cmd>lua vim.lsp.buf.formatting()<CR>", {silent=true, noremap=true})
|
||||
end
|
||||
|
||||
require'compe'.setup {
|
||||
enabled = true;
|
||||
autocomplete = true;
|
||||
@@ -308,3 +313,8 @@ local statusline = {
|
||||
}
|
||||
vim.o.statusline = table.concat(statusline)
|
||||
vim.api.nvim_set_option("termguicolors", true)
|
||||
|
||||
local servers = { "clangd", "rust_analyzer", "tsserver", "jedi_language_server" }
|
||||
for _, lsp in ipairs(servers) do
|
||||
nvim_lsp[lsp].setup { on_attach = on_attach }
|
||||
end
|
||||
|
Reference in New Issue
Block a user