feat: tried adding the nvim lspconifg
This commit is contained in:
parent
1ea5c9e376
commit
93caf0c971
|
@ -33,3 +33,4 @@ require('github-theme').setup({
|
|||
|
||||
-- Import my other files
|
||||
require('my.keymaps').setup()
|
||||
require('my.plugins').setup()
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
local M = {}
|
||||
|
||||
local function map(mode, lhs, rhs, opts)
|
||||
function M.map(mode, lhs, rhs, opts)
|
||||
local options = {noremap = true}
|
||||
if opts then options = vim.tbl_extend('force', options, opts) end
|
||||
vim.api.nvim_set_keymap(mode, lhs, rhs, options)
|
||||
end
|
||||
|
||||
function M.setup()
|
||||
map("i", "jj", "<Esc>") -- Remap Esc to
|
||||
M.map("i", "jj", "<Esc>") -- Remap Esc to
|
||||
end
|
||||
|
||||
return M
|
10
dotfiles/neovim/lua/my/plugins/init.lua
Normal file
10
dotfiles/neovim/lua/my/plugins/init.lua
Normal file
|
@ -0,0 +1,10 @@
|
|||
local M = {}
|
||||
|
||||
function M.setup()
|
||||
require("my.plugins.lspconfig").setup()
|
||||
|
||||
-- Other unconfigured plugins
|
||||
require('nvim-autopairs').setup()
|
||||
end
|
||||
|
||||
return M
|
50
dotfiles/neovim/lua/my/plugins/lspconfig.lua
Normal file
50
dotfiles/neovim/lua/my/plugins/lspconfig.lua
Normal file
|
@ -0,0 +1,50 @@
|
|||
local M = {}
|
||||
|
||||
-- Use a loop to conveniently call 'setup' on multiple servers and
|
||||
-- map buffer local keybindings when the language server attaches
|
||||
local servers = { "tsserver" "purescriptls" }
|
||||
|
||||
function M.map(buf, mode, lhs, rhs, opts)
|
||||
local options = { noremap=true, silent=true }
|
||||
if opts then options = vim.tbl_extend('force', options, opts) end
|
||||
map(buf, mode, lhs, rhs, options)
|
||||
end
|
||||
|
||||
function on_attach(client, bufnr)
|
||||
-- Enable completion triggered by <c-x><c-o>
|
||||
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
|
||||
|
||||
-- Go to declaration / definition / implementation
|
||||
map(bufnr, "n", 'gD', '<cmd>lua vim.lsp.buf.declaration()<CR>')
|
||||
map(bufnr, "n", 'gd', '<cmd>lua vim.lsp.buf.definition()<CR>')
|
||||
map(bufnr, 'n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<CR>')
|
||||
|
||||
-- Hover
|
||||
map(bufnr, 'n', 'K', '<cmd>lua vim.lsp.buf.hover()<CR>')
|
||||
map(bufnr, 'n', '<C-k>', '<cmd>lua vim.lsp.buf.signature_help()<CR>')
|
||||
|
||||
-- Workspace stuff
|
||||
map(bufnr, 'n', '<space>wa', '<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>')
|
||||
map(bufnr, 'n', '<space>wr', '<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>')
|
||||
map(bufnr, 'n', '<space>wl', '<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>')
|
||||
|
||||
-- Code actions
|
||||
map(bufnr, 'n', '<space>D', '<cmd>lua vim.lsp.buf.type_definition()<CR>')
|
||||
map(bufnr, 'n', '<space>rn', '<cmd>lua vim.lsp.buf.rename()<CR>')
|
||||
map(bufnr, 'n', '<space>ca', '<cmd>lua vim.lsp.buf.code_action()<CR>')
|
||||
map(bufnr, 'n', 'gr', '<cmd>lua vim.lsp.buf.references()<CR>')
|
||||
map(bufnr, 'n', '<space>f', '<cmd>lua vim.lsp.buf.formatting()<CR>')
|
||||
end
|
||||
|
||||
function M.setup()
|
||||
for _, lsp in pairs(servers) do
|
||||
require('lspconfig')[lsp].setup {
|
||||
on_attach = on_attach,
|
||||
flags = {
|
||||
debounce_text_changes = 150, -- This will be the default in neovim 0.7+
|
||||
}
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
return M
|
|
@ -72,5 +72,6 @@
|
|||
# games
|
||||
# tetrio-desktop
|
||||
# mindustry
|
||||
edopro
|
||||
];
|
||||
}
|
||||
|
|
|
@ -14,7 +14,17 @@ in {
|
|||
luafile ${config-nvim}/init.lua
|
||||
'';
|
||||
|
||||
plugins = with pkgs.vimExtraPlugins; [ config-nvim github-nvim-theme ];
|
||||
extraPackages = [
|
||||
pkgs.nodePackages.typescript
|
||||
pkgs.easy-purescript-nix.purescript-language-server
|
||||
];
|
||||
|
||||
plugins = with pkgs.vimPlugins;
|
||||
with pkgs.vimExtraPlugins; [
|
||||
config-nvim # my neovim config
|
||||
github-nvim-theme # github theme for neovim
|
||||
nvim-lspconfig # configures lsps for me
|
||||
nvim-autopairs # close pairs for me
|
||||
];
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{ pkgs, ... }:
|
||||
{ pkgs ? import <nixpkgs>, ... }:
|
||||
pkgs.stdenv.mkDerivation rec {
|
||||
pname = "edopro";
|
||||
version = "39.2.0";
|
||||
|
@ -7,6 +7,7 @@ pkgs.stdenv.mkDerivation rec {
|
|||
src = pkgs.fetchurl {
|
||||
url =
|
||||
"https://github.com/ProjectIgnis/edopro-assets/releases/download/${rev}/ProjectIgnis-EDOPro-${version}-linux.tar.gz";
|
||||
sha256 = "OQSWTuRaTyr2XIDjSbIvrV11LJCpOmw5aOjHU2ji+kI=";
|
||||
};
|
||||
|
||||
buildInputs = [ pkgs.mono ];
|
||||
|
@ -15,6 +16,8 @@ pkgs.stdenv.mkDerivation rec {
|
|||
|
||||
installPhase = ''
|
||||
mkdir -p $out/bin
|
||||
mv edopro $out/bin
|
||||
ls
|
||||
chmod +x ./EDOPro
|
||||
mv ./* $out/bin/
|
||||
'';
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue