feat: more useful nvim
This commit is contained in:
parent
b5a483f88d
commit
89fa2eea02
1 changed files with 8 additions and 38 deletions
46
home/irl.nix
46
home/irl.nix
|
@ -20,6 +20,7 @@ in
|
||||||
age
|
age
|
||||||
fish
|
fish
|
||||||
neofetch
|
neofetch
|
||||||
|
nil
|
||||||
rust-analyzer
|
rust-analyzer
|
||||||
starship
|
starship
|
||||||
tree
|
tree
|
||||||
|
@ -95,46 +96,15 @@ in
|
||||||
vimdiffAlias = true;
|
vimdiffAlias = true;
|
||||||
plugins = with pkgs.vimPlugins; [
|
plugins = with pkgs.vimPlugins; [
|
||||||
bufferline-nvim
|
bufferline-nvim
|
||||||
nvim-lspconfig
|
lualine-nvim
|
||||||
nvim-treesitter.withAllGrammars
|
nvim-lspconfig
|
||||||
|
nvim-web-devicons
|
||||||
];
|
];
|
||||||
extraLuaConfig = ''
|
extraLuaConfig = ''
|
||||||
vim.lsp.config('rust_analyzer', {
|
vim.opt.termguicolors = true
|
||||||
settings = {
|
require("bufferline").setup{}
|
||||||
['rust-analyzer'] = {},
|
require('lualine').setup{}
|
||||||
},
|
vim.lsp.enable("nil")
|
||||||
})
|
|
||||||
vim.api.nvim_create_autocmd('LspAttach', {
|
|
||||||
group = vim.api.nvim_create_augroup('my.lsp', {}),
|
|
||||||
callback = function(args)
|
|
||||||
local client = assert(vim.lsp.get_client_by_id(args.data.client_id))
|
|
||||||
if client:supports_method('textDocument/implementation') then
|
|
||||||
-- Create a keymap for vim.lsp.buf.implementation ...
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Enable auto-completion. Note: Use CTRL-Y to select an item. |complete_CTRL-Y|
|
|
||||||
if client:supports_method('textDocument/completion') then
|
|
||||||
-- Optional: trigger autocompletion on EVERY keypress. May be slow!
|
|
||||||
-- local chars = {}; for i = 32, 126 do table.insert(chars, string.char(i)) end
|
|
||||||
-- client.server_capabilities.completionProvider.triggerCharacters = chars
|
|
||||||
|
|
||||||
vim.lsp.completion.enable(true, client.id, args.buf, {autotrigger = true})
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Auto-format ("lint") on save.
|
|
||||||
-- Usually not needed if server supports "textDocument/willSaveWaitUntil".
|
|
||||||
if not client:supports_method('textDocument/willSaveWaitUntil')
|
|
||||||
and client:supports_method('textDocument/formatting') then
|
|
||||||
vim.api.nvim_create_autocmd('BufWritePre', {
|
|
||||||
group = vim.api.nvim_create_augroup('my.lsp', {clear=false}),
|
|
||||||
buffer = args.buf,
|
|
||||||
callback = function()
|
|
||||||
vim.lsp.buf.format({ bufnr = args.buf, id = client.id, timeout_ms = 1000 })
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
programs.starship = {
|
programs.starship = {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue