mirror of https://github.com/wlcx/home.git
😎 Make nvim config 100% cooler
This commit is contained in:
parent
8720cfffec
commit
ca45cf76ca
|
@ -0,0 +1,66 @@
|
|||
-- Basics
|
||||
vim.o.relativenumber = true
|
||||
vim.o.mouse = "nvi" -- mouse mode in normal, visual and insert
|
||||
vim.o.textwidth = 88 -- A vaguely sensible default textwidth
|
||||
vim.o.colorcolumn = "+0" -- Mark the textwidth
|
||||
vim.o.shiftwidth = 4
|
||||
vim.o.tabstop = 4
|
||||
vim.o.softtabstop = 4
|
||||
|
||||
vim.o.list = true
|
||||
vim.o.listchars = "trail:·" -- show trailing spaces
|
||||
|
||||
-- Colors
|
||||
vim.cmd "colorscheme gruvbox"
|
||||
vim.o.termguicolors = true
|
||||
|
||||
-- Keybinds
|
||||
vim.api.nvim_set_keymap('n','<C-P>', '<cmd> FZF<CR>', { noremap=true })
|
||||
|
||||
-- LSP
|
||||
local opts = { noremap=true, silent=true }
|
||||
local on_attach = function(client, bufnr)
|
||||
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
|
||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gD', '<cmd>lua vim.lsp.buf.declaration()<CR>', opts)
|
||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gd', '<cmd>lua vim.lsp.buf.definition()<CR>', opts)
|
||||
vim.api.nvim_buf_set_keymap(bufnr, 'n', '<space>f', '<cmd>lua vim.lsp.buf.formatting()<CR>', opts)
|
||||
end
|
||||
|
||||
-- Enable Language LSPs
|
||||
require'lspconfig'.gopls.setup{
|
||||
on_attach = on_attach,
|
||||
}
|
||||
require'lspconfig'.pylsp.setup{
|
||||
on_attach = on_attach,
|
||||
handlers = {
|
||||
["textDocument/publishDiagnostics"] = vim.lsp.with(
|
||||
vim.lsp.diagnostic.on_publish_diagnostics, {
|
||||
-- Disable virtual_text
|
||||
virtual_text = false
|
||||
}
|
||||
),
|
||||
}
|
||||
}
|
||||
require'lspconfig'.rnix.setup{
|
||||
on_attach = on_attach
|
||||
}
|
||||
|
||||
-- Diags with Trouble
|
||||
require('trouble').setup {
|
||||
icons = false,
|
||||
signs = {
|
||||
error = "E",
|
||||
warning = "W",
|
||||
hint = "H",
|
||||
information = "I"
|
||||
}
|
||||
}
|
||||
|
||||
vim.g.rustfmt_autosave = 1
|
||||
|
||||
-- Tree-sitter
|
||||
require'nvim-treesitter.configs'.setup {
|
||||
highlight = {
|
||||
enable = true
|
||||
}
|
||||
}
|
32
home/vim.nix
32
home/vim.nix
|
@ -1,14 +1,34 @@
|
|||
# This module sets up a "full" neovim install with plugins and unicorns. It also
|
||||
# makes neovim the default editor and aliases vim to nvim.
|
||||
# This module sets up a "full" neovim install with plugins and unicorns. It
|
||||
# also makes neovim the default editor and aliases vim to nvim.
|
||||
{ pkgs, ... }: {
|
||||
home.sessionVariables = { "EDITOR" = "nvim"; };
|
||||
home.packages = with pkgs; [ rnix-lsp ripgrep ];
|
||||
programs.neovim = {
|
||||
enable = true;
|
||||
plugins = with pkgs.vimPlugins; [ vim-nix rust-vim ];
|
||||
viAlias = true;
|
||||
vimAlias = true;
|
||||
plugins = with pkgs.vimPlugins; [
|
||||
# Basic stuff
|
||||
vim-sensible
|
||||
vim-noctu # 16color colorscheme
|
||||
gruvbox-nvim
|
||||
fzfWrapper
|
||||
# More fancy shit
|
||||
nvim-treesitter
|
||||
# Language stuff
|
||||
nvim-lspconfig
|
||||
trouble-nvim
|
||||
vim-nix
|
||||
rust-vim
|
||||
vim-go
|
||||
# Git stuff
|
||||
fugitive
|
||||
vim-gitgutter
|
||||
];
|
||||
extraConfig = ''
|
||||
set relativenumber
|
||||
let g:rustfmt_autosave = 1
|
||||
lua <<EOF
|
||||
${builtins.readFile ./init.lua}
|
||||
EOF
|
||||
'';
|
||||
};
|
||||
programs.zsh.shellAliases = { vim = "nvim"; };
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue