Compare commits
No commits in common. "80d5f0964037e42d9a57733480dc2a224d09b5ec" and "def3fbca47e21b09ac0c6a4d5723775740ba7c6a" have entirely different histories.
80d5f09640
...
def3fbca47
@ -144,7 +144,7 @@ in {
|
|||||||
"org/gnome/desktop/interface" = {
|
"org/gnome/desktop/interface" = {
|
||||||
color-scheme = "prefer-dark";
|
color-scheme = "prefer-dark";
|
||||||
enable-hot-corners = false;
|
enable-hot-corners = false;
|
||||||
monospace-font-name = "UbuntuMono Nerd Font 11";
|
monospace-font-name = "Ubuntu Mono 11";
|
||||||
};
|
};
|
||||||
"org/gnome/desktop/wm/keybindings" = {
|
"org/gnome/desktop/wm/keybindings" = {
|
||||||
switch-group = [ "<Super>grave" ];
|
switch-group = [ "<Super>grave" ];
|
||||||
@ -157,7 +157,7 @@ in {
|
|||||||
|
|
||||||
fonts.packages = with pkgs; [
|
fonts.packages = with pkgs; [
|
||||||
noto-fonts
|
noto-fonts
|
||||||
(nerdfonts.override { fonts = [ "BigBlueTerminal" "ComicShannsMono" "UbuntuMono" ]; })
|
ubuntu_font_family
|
||||||
];
|
];
|
||||||
|
|
||||||
user.packages = with pkgs; [
|
user.packages = with pkgs; [
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
let
|
let
|
||||||
cfg = config.modules.editors.neovim;
|
cfg = config.modules.editors.neovim;
|
||||||
|
dev = config.modules.dev;
|
||||||
in {
|
in {
|
||||||
options.modules.editors.neovim = {
|
options.modules.editors.neovim = {
|
||||||
enable = lib.mkOption {
|
enable = lib.mkOption {
|
||||||
@ -11,15 +12,124 @@ in {
|
|||||||
};
|
};
|
||||||
|
|
||||||
config = lib.mkIf cfg.enable {
|
config = lib.mkIf cfg.enable {
|
||||||
user.packages = with pkgs.unstable; [
|
user.packages = with pkgs; [
|
||||||
lunarvim
|
(neovim.override {
|
||||||
];
|
configure = {
|
||||||
|
customRC = ''
|
||||||
|
luafile ~/.config/nvim/init.lua
|
||||||
|
'';
|
||||||
|
packages.myPlugins = with pkgs.vimPlugins; {
|
||||||
|
start = [
|
||||||
|
(nvim-treesitter.withPlugins (
|
||||||
|
plugins: with plugins; [
|
||||||
|
bash
|
||||||
|
c
|
||||||
|
cmake
|
||||||
|
cpp
|
||||||
|
css
|
||||||
|
dockerfile
|
||||||
|
elm
|
||||||
|
glsl
|
||||||
|
graphql
|
||||||
|
haskell
|
||||||
|
http
|
||||||
|
html
|
||||||
|
java
|
||||||
|
javascript
|
||||||
|
jsdoc
|
||||||
|
json
|
||||||
|
json5
|
||||||
|
latex
|
||||||
|
lua
|
||||||
|
markdown
|
||||||
|
ninja
|
||||||
|
nix
|
||||||
|
org
|
||||||
|
perl
|
||||||
|
php
|
||||||
|
pug
|
||||||
|
python
|
||||||
|
regex
|
||||||
|
rst
|
||||||
|
ruby
|
||||||
|
rust
|
||||||
|
scala
|
||||||
|
scss
|
||||||
|
toml
|
||||||
|
tsx
|
||||||
|
typescript
|
||||||
|
vim
|
||||||
|
yaml
|
||||||
|
zig
|
||||||
|
]
|
||||||
|
))
|
||||||
|
nvim-treesitter-context
|
||||||
|
nvim-treesitter-textobjects
|
||||||
|
nvim-lspconfig
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
})
|
||||||
|
] ++
|
||||||
|
|
||||||
env.EDITOR = "lvim";
|
# Install appropriate language servers
|
||||||
|
(if dev.cc.enable then [
|
||||||
|
ccls # C/C++
|
||||||
|
] else []) ++
|
||||||
|
(if dev.java.enable then [
|
||||||
|
java-language-server # Java
|
||||||
|
ltex-ls # LaTeX
|
||||||
|
] else []) ++
|
||||||
|
(if dev.lua.enable then [
|
||||||
|
sumneko-lua-language-server # Lua
|
||||||
|
] else []) ++
|
||||||
|
(if dev.node.enable then [
|
||||||
|
nodePackages.bash-language-server # Bash
|
||||||
|
nodePackages.dockerfile-language-server-nodejs # Dockerfile
|
||||||
|
nodePackages.graphql-language-service-cli # GraphQL
|
||||||
|
nodePackages.purescript-language-server # PureScript
|
||||||
|
nodePackages.svelte-language-server # Svelte
|
||||||
|
nodePackages.typescript-language-server # JavaScript/TypeScript
|
||||||
|
nodePackages.vim-language-server # Vim
|
||||||
|
nodePackages.vscode-langservers-extracted # HTML, CSS, JSON, ESLint
|
||||||
|
nodePackages.vue-language-server # Vue.js
|
||||||
|
nodePackages.yaml-language-server # YAML
|
||||||
|
] else []) ++
|
||||||
|
(if dev.python.enable then [
|
||||||
|
cmake-language-server # CMake
|
||||||
|
python310Packages.python-lsp-server # Python
|
||||||
|
] else []) ++
|
||||||
|
(if dev.rust.enable then [
|
||||||
|
rust-analyzer # Rust
|
||||||
|
] else []) ++
|
||||||
|
(if dev.scala.enable then [
|
||||||
|
metals # Scala
|
||||||
|
] else []) ++
|
||||||
|
(if dev.zig.enable then [
|
||||||
|
zls # Zig
|
||||||
|
] else []);
|
||||||
|
|
||||||
|
home.configFile = {
|
||||||
|
"nvim/init.lua".source = ./init.lua;
|
||||||
|
"nvim/lua" = { source = ./lua; recursive = true; };
|
||||||
|
"nvim/lua/config/lsp.lua".text = ''
|
||||||
|
-- This file is autogenerated, do not edit.
|
||||||
|
${if dev.cc.enable then "require('config.lsp.cc')\n" else ""}
|
||||||
|
${if dev.java.enable then "require('config.lsp.java')\n" else ""}
|
||||||
|
${if dev.lua.enable then "require('config.lsp.lua')\n" else ""}
|
||||||
|
${if dev.node.enable then "require('config.lsp.node')\n" else ""}
|
||||||
|
${if dev.python.enable then "require('config.lsp.python')\n" else ""}
|
||||||
|
${if dev.rust.enable then "require('config.lsp.rust')\n" else ""}
|
||||||
|
${if dev.scala.enable then "require('config.lsp.scala')\n" else ""}
|
||||||
|
${if dev.zig.enable then "require('config.lsp.zig')\n" else ""}
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
env.EDITOR = "nvim";
|
||||||
|
|
||||||
environment.shellAliases = {
|
environment.shellAliases = {
|
||||||
vim = "lvim";
|
vim = "nvim";
|
||||||
v = "lvim";
|
v = "nvim";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
6
modules/editors/neovim/init.lua
Normal file
6
modules/editors/neovim/init.lua
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
require("config.core")
|
||||||
|
require("config.keymap")
|
||||||
|
require("config.treesitter")
|
||||||
|
require("config.plugins")
|
||||||
|
require("config.lsp")
|
||||||
|
|
36
modules/editors/neovim/lua/config/core.lua
Normal file
36
modules/editors/neovim/lua/config/core.lua
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
local o = vim.opt
|
||||||
|
local wo = vim.wo
|
||||||
|
local bo = vim.bo
|
||||||
|
|
||||||
|
-- Global dirs
|
||||||
|
local cachedir = os.getenv("XDG_CACHE_HOME")
|
||||||
|
o.backupdir = cachedir .. "/nvim/backup/"
|
||||||
|
o.directory = cachedir .. "/nvim/swap/"
|
||||||
|
o.undodir = cachedir .. "/nvim/undo/"
|
||||||
|
|
||||||
|
-- Global
|
||||||
|
o.breakindent = true
|
||||||
|
o.clipboard = "unnamedplus"
|
||||||
|
o.compatible = false
|
||||||
|
o.encoding = "utf-8"
|
||||||
|
o.expandtab = true
|
||||||
|
o.foldlevel = 99
|
||||||
|
o.hidden = true
|
||||||
|
o.hlsearch = false
|
||||||
|
o.ignorecase = true
|
||||||
|
o.laststatus = 2
|
||||||
|
o.listchars = { eol = '↲', tab = '▸ ', trail = '·' }
|
||||||
|
o.relativenumber = true
|
||||||
|
o.shiftwidth = 2
|
||||||
|
o.showmode = false
|
||||||
|
o.smartcase = true
|
||||||
|
o.smarttab = true
|
||||||
|
o.softtabstop = 2
|
||||||
|
o.synmaxcol = 150
|
||||||
|
o.tabstop = 4
|
||||||
|
o.undofile = true
|
||||||
|
o.wildmenu = true
|
||||||
|
|
||||||
|
-- Window
|
||||||
|
|
||||||
|
-- Buffer
|
35
modules/editors/neovim/lua/config/keymap.lua
Normal file
35
modules/editors/neovim/lua/config/keymap.lua
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
local keymap = vim.keymap.set
|
||||||
|
local opts = { noremap = true, silent = true }
|
||||||
|
|
||||||
|
vim.g.mapleader = ","
|
||||||
|
|
||||||
|
-- Modes
|
||||||
|
-- Normal = "n",
|
||||||
|
-- Insert = "i",
|
||||||
|
-- Visual = "v",
|
||||||
|
-- Visual Block = "x",
|
||||||
|
-- Term = "t",
|
||||||
|
-- Command = "c"
|
||||||
|
|
||||||
|
keymap("n", "<Left>", "<Nop>", opts)
|
||||||
|
keymap("n", "<Right>", "<Nop>", opts)
|
||||||
|
keymap("n", "<Up>", "<Nop>", opts)
|
||||||
|
keymap("n", "<Down>", "<Nop>", opts)
|
||||||
|
|
||||||
|
keymap("n", "<C-h>", "<C-w>h", { noremap = true })
|
||||||
|
keymap("n", "<C-j>", "<C-w>j", { noremap = true })
|
||||||
|
keymap("n", "<C-k>", "<C-w>k", { noremap = true })
|
||||||
|
keymap("n", "<C-l>", "<C-w>l", { noremap = true })
|
||||||
|
|
||||||
|
keymap("n", "gV", "`[v`]", opts)
|
||||||
|
|
||||||
|
keymap("n", ";", ":", { noremap = true })
|
||||||
|
|
||||||
|
-- Bubble single lines with vim-unimpaired
|
||||||
|
keymap("n", "<C-Up>", "[e", opts)
|
||||||
|
keymap("n", "<C-Down>", "]e", opts)
|
||||||
|
|
||||||
|
-- Bubble multiple lines with vim-unimpaired
|
||||||
|
keymap("v", "<C-Up>", "[egv", opts)
|
||||||
|
keymap("v", "<C-Down>", "]egv", opts)
|
||||||
|
|
5
modules/editors/neovim/lua/config/lsp/cc.lua
Normal file
5
modules/editors/neovim/lua/config/lsp/cc.lua
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
lspconfig = require('lspconfig')
|
||||||
|
|
||||||
|
-- Requires C/C++
|
||||||
|
lspconfig.ccls.setup{}
|
||||||
|
|
6
modules/editors/neovim/lua/config/lsp/java.lua
Normal file
6
modules/editors/neovim/lua/config/lsp/java.lua
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
lspconfig = require('lspconfig')
|
||||||
|
|
||||||
|
-- Requires Java
|
||||||
|
lspconfig.java_language_server.setup{}
|
||||||
|
lspconfig.ltex.setup{}
|
||||||
|
|
22
modules/editors/neovim/lua/config/lsp/lua.lua
Normal file
22
modules/editors/neovim/lua/config/lsp/lua.lua
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
lspconfig = require('lspconfig')
|
||||||
|
|
||||||
|
-- Requires Lua
|
||||||
|
lspconfig.sumneko_lua.setup {
|
||||||
|
settings = {
|
||||||
|
Lua = {
|
||||||
|
runtime = {
|
||||||
|
-- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim)
|
||||||
|
version = 'LuaJIT',
|
||||||
|
},
|
||||||
|
diagnostics = {
|
||||||
|
-- Get the language server to recognize the `vim` global
|
||||||
|
globals = {'vim'},
|
||||||
|
},
|
||||||
|
-- Do not send telemetry data containing a randomized but unique identifier
|
||||||
|
telemetry = {
|
||||||
|
enable = false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
17
modules/editors/neovim/lua/config/lsp/node.lua
Normal file
17
modules/editors/neovim/lua/config/lsp/node.lua
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
lspconfig = require('lspconfig')
|
||||||
|
|
||||||
|
-- Requires Node.js
|
||||||
|
lspconfig.bashls.setup{}
|
||||||
|
lspconfig.cssls.setup{}
|
||||||
|
lspconfig.dockerls.setup{}
|
||||||
|
lspconfig.eslint.setup{}
|
||||||
|
lspconfig.graphql.setup{}
|
||||||
|
lspconfig.html.setup{}
|
||||||
|
lspconfig.jsonls.setup{}
|
||||||
|
lspconfig.purescriptls.setup{}
|
||||||
|
lspconfig.svelte.setup{}
|
||||||
|
lspconfig.tsserver.setup{}
|
||||||
|
lspconfig.vimls.setup{}
|
||||||
|
lspconfig.vuels.setup{}
|
||||||
|
lspconfig.yamlls.setup{}
|
||||||
|
|
6
modules/editors/neovim/lua/config/lsp/python.lua
Normal file
6
modules/editors/neovim/lua/config/lsp/python.lua
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
lspconfig = require('lspconfig')
|
||||||
|
|
||||||
|
-- Requires Python
|
||||||
|
lspconfig.cmake.setup{}
|
||||||
|
lspconfig.pylsp.setup{}
|
||||||
|
|
5
modules/editors/neovim/lua/config/lsp/rust.lua
Normal file
5
modules/editors/neovim/lua/config/lsp/rust.lua
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
lspconfig = require('lspconfig')
|
||||||
|
|
||||||
|
-- Requires Rust
|
||||||
|
lspconfig.rls.setup{}
|
||||||
|
|
5
modules/editors/neovim/lua/config/lsp/scala.lua
Normal file
5
modules/editors/neovim/lua/config/lsp/scala.lua
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
lspconfig = require('lspconfig')
|
||||||
|
|
||||||
|
-- Requires Scala
|
||||||
|
lspconfig.metals.setup{}
|
||||||
|
|
5
modules/editors/neovim/lua/config/lsp/zig.lua
Normal file
5
modules/editors/neovim/lua/config/lsp/zig.lua
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
lspconfig = require('lspconfig')
|
||||||
|
|
||||||
|
-- Requires Zig
|
||||||
|
lspconfig.zls.setup{}
|
||||||
|
|
77
modules/editors/neovim/lua/config/plugins.lua
Normal file
77
modules/editors/neovim/lua/config/plugins.lua
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
local fn = vim.fn
|
||||||
|
|
||||||
|
local install_path = fn.stdpath "data" .. "/site/pack/packer/start/packer.nvim"
|
||||||
|
if fn.empty(fn.glob(install_path)) > 0 then
|
||||||
|
PACKER_BOOTSTRAP = fn.system {
|
||||||
|
"git",
|
||||||
|
"clone",
|
||||||
|
"--depth",
|
||||||
|
"1",
|
||||||
|
"https://github.com/wbthomason/packer.nvim",
|
||||||
|
install_path,
|
||||||
|
}
|
||||||
|
print "Installing packer close and reopen Neovim..."
|
||||||
|
vim.cmd [[packadd packer.nvim]]
|
||||||
|
end
|
||||||
|
|
||||||
|
vim.cmd [[
|
||||||
|
augroup packer_user_config
|
||||||
|
autocmd!
|
||||||
|
autocmd BufWritePost plugins.lua source <afile> | PackerSync
|
||||||
|
augroup end
|
||||||
|
]]
|
||||||
|
|
||||||
|
local status_ok, packer = pcall(require, "packer")
|
||||||
|
if not status_ok then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
packer.init {
|
||||||
|
display = {
|
||||||
|
open_fn = function()
|
||||||
|
return require("packer.util").float { border = "rounded" }
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
return packer.startup(function(use)
|
||||||
|
-- Utilities
|
||||||
|
use { "wbthomason/packer.nvim", opt = true }
|
||||||
|
use { "mbbill/undotree" }
|
||||||
|
use { "nvim-lua/plenary.nvim" }
|
||||||
|
use { "tpope/vim-fugitive", event = "User InGitRepo" }
|
||||||
|
|
||||||
|
-- Editing
|
||||||
|
use { "andymass/vim-matchup" }
|
||||||
|
use { "godlygeek/tabular" }
|
||||||
|
use { "JoosepAlviste/nvim-ts-context-commentstring" }
|
||||||
|
use { "kana/vim-textobj-user" }
|
||||||
|
use { "mg979/vim-visual-multi", branch = "master" }
|
||||||
|
use { "p00f/nvim-ts-rainbow" }
|
||||||
|
use { "terryma/vim-expand-region" }
|
||||||
|
use { "tommcdo/vim-exchange", event = "VimEnter" }
|
||||||
|
use { "tpope/vim-abolish" }
|
||||||
|
use { "tpope/vim-commentary", event = "VimEnter" }
|
||||||
|
use { "tpope/vim-repeat", event = "VimEnter" }
|
||||||
|
use { "tpope/vim-surround", event = "VimEnter" }
|
||||||
|
use { "windwp/nvim-autopairs" }
|
||||||
|
use { "windwp/nvim-ts-autotag" }
|
||||||
|
|
||||||
|
-- UI
|
||||||
|
use { "junegunn/goyo.vim" }
|
||||||
|
use { "junegunn/limelight.vim" }
|
||||||
|
use { "markonm/traces.vim" }
|
||||||
|
|
||||||
|
-- Searching
|
||||||
|
use { "nvim-telescope/telescope.nvim", config = [[require('config.telescope')]] }
|
||||||
|
use { "cljoly/telescope-repo.nvim", requires = "telescope.nvim" }
|
||||||
|
use { "dyng/ctrlsf.vim" }
|
||||||
|
|
||||||
|
-- LSP
|
||||||
|
use { "jose-elias-alvarez/null-ls.nvim" }
|
||||||
|
|
||||||
|
if PACKER_BOOTSTRAP then
|
||||||
|
require("packer").sync()
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
46
modules/editors/neovim/lua/config/telescope.lua
Normal file
46
modules/editors/neovim/lua/config/telescope.lua
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
local status_ok, telescope = pcall(require, "telescope")
|
||||||
|
if not status_ok then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local actions = require("telescope.actions")
|
||||||
|
|
||||||
|
telescope.setup({
|
||||||
|
defaults = {
|
||||||
|
file_ignore_patterns = { ".git/", "node_modules" },
|
||||||
|
},
|
||||||
|
mappings = {
|
||||||
|
i = {
|
||||||
|
["<Down>"] = actions.cycle_history_next,
|
||||||
|
["<Up>"] = actions.cycle_history_prev,
|
||||||
|
["<C-j>"] = actions.move_selection_next,
|
||||||
|
["<C-k>"] = actions.move_selection_previous,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
extensions = {
|
||||||
|
repo = {
|
||||||
|
list = {
|
||||||
|
fd_opts = {
|
||||||
|
"--no-ignore-vcs",
|
||||||
|
},
|
||||||
|
search_dirs = {
|
||||||
|
"~/projects",
|
||||||
|
"~/repos",
|
||||||
|
"~/workspace",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
telescope.load_extension("repo")
|
||||||
|
|
||||||
|
local keymap = vim.keymap.set
|
||||||
|
local opts = { noremap = true, silent = true }
|
||||||
|
|
||||||
|
keymap("n", "<Leader>ff", "<cmd>Telescope find_files<cr>", opts)
|
||||||
|
keymap("n", "<Leader>fg", "<cmd>Telescope live_grep<cr>", opts)
|
||||||
|
keymap("n", "<Leader>fb", "<cmd>Telescope buffers<cr>", opts)
|
||||||
|
keymap("n", "<Leader>fh", "<cmd>Telescope help_tags<cr>", opts)
|
||||||
|
keymap("n", "<Leader>fr", "<cmd>Telescope repo list<cr>", opts)
|
||||||
|
|
35
modules/editors/neovim/lua/config/treesitter.lua
Normal file
35
modules/editors/neovim/lua/config/treesitter.lua
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
require("nvim-treesitter.configs").setup({
|
||||||
|
ignore_install = {},
|
||||||
|
highlight = {
|
||||||
|
enable = true,
|
||||||
|
disable = {},
|
||||||
|
},
|
||||||
|
indent = { enable = true },
|
||||||
|
incremental_selection = {
|
||||||
|
enable = true,
|
||||||
|
keymaps = {
|
||||||
|
init_selection = "gnn",
|
||||||
|
node_incremental = "grn",
|
||||||
|
scope_incremental = "grc",
|
||||||
|
node_decremental = "grm",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
-- Extensions
|
||||||
|
autotag = { enable = true },
|
||||||
|
context_commentstring = { enable = true },
|
||||||
|
matchup = { enable = true },
|
||||||
|
rainbow = { enable = true },
|
||||||
|
textobjects = {
|
||||||
|
select = {
|
||||||
|
enable = true,
|
||||||
|
keymaps = {
|
||||||
|
["af"] = "@function.outer",
|
||||||
|
["if"] = "@function.inner",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
vim.opt.foldmethod = "expr"
|
||||||
|
vim.opt.foldexpr = "nvim_treesitter#foldexpr()"
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user