Compare commits
5 commits
d3b42cf643
...
2c3b306495
Author | SHA1 | Date | |
---|---|---|---|
2c3b306495 | |||
92228a6538 | |||
0e8168454e | |||
21e917990e | |||
de29df20b3 |
10 changed files with 48 additions and 75 deletions
1
.envrc
Normal file
1
.envrc
Normal file
|
@ -0,0 +1 @@
|
||||||
|
use flake
|
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -5,3 +5,5 @@ result
|
||||||
result-*
|
result-*
|
||||||
|
|
||||||
lazy-lock.json
|
lazy-lock.json
|
||||||
|
|
||||||
|
/.direnv
|
||||||
|
|
26
flake.nix
26
flake.nix
|
@ -19,37 +19,19 @@
|
||||||
|
|
||||||
outputs = inputs:
|
outputs = inputs:
|
||||||
inputs.flake-utils.lib.eachDefaultSystem (system: let
|
inputs.flake-utils.lib.eachDefaultSystem (system: let
|
||||||
inherit (inputs.nixpkgs) lib;
|
|
||||||
pkgs = inputs.nixpkgs.legacyPackages.${system};
|
pkgs = inputs.nixpkgs.legacyPackages.${system};
|
||||||
treefmtEval = inputs.treefmt-nix.lib.evalModule pkgs ./treefmt.nix;
|
treefmtEval = inputs.treefmt-nix.lib.evalModule pkgs ./treefmt.nix;
|
||||||
|
|
||||||
runtimeDeps = with pkgs; [
|
|
||||||
# mason / tree-sitter
|
|
||||||
gcc
|
|
||||||
cargo
|
|
||||||
nodejs
|
|
||||||
|
|
||||||
# telescope
|
|
||||||
ripgrep
|
|
||||||
fd
|
|
||||||
];
|
|
||||||
src = lib.fileset.toSource {
|
|
||||||
fileset = lib.fileset.fileFilter (file: file.hasExt "lua") ./.;
|
|
||||||
root = ./.;
|
|
||||||
};
|
|
||||||
in {
|
in {
|
||||||
### nix {run,shell,build}
|
|
||||||
packages.default = pkgs.callPackage ./package.nix {inherit runtimeDeps src;};
|
|
||||||
|
|
||||||
### nix fmt
|
### nix fmt
|
||||||
formatter = treefmtEval.config.build.wrapper;
|
formatter = treefmtEval.config.build.wrapper;
|
||||||
|
|
||||||
### nix flake check
|
### nix flake check
|
||||||
checks = {formatting = treefmtEval.config.build.check inputs.self;};
|
checks.formatting = treefmtEval.config.build.check inputs.self;
|
||||||
|
|
||||||
### nix develop
|
### nix develop
|
||||||
devShells.default = pkgs.mkShell {
|
devShells.default = pkgs.mkShellNoCC {
|
||||||
nativeBuildInputs = with pkgs; [
|
packages = with pkgs; [
|
||||||
|
lua-language-server
|
||||||
stylua
|
stylua
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
|
@ -13,6 +13,9 @@ vim.opt.cursorline = true
|
||||||
vim.opt.number = true
|
vim.opt.number = true
|
||||||
vim.opt.relativenumber = true
|
vim.opt.relativenumber = true
|
||||||
|
|
||||||
|
-- Breakindent
|
||||||
|
vim.opt.breakindent = true
|
||||||
|
|
||||||
-- Mouse
|
-- Mouse
|
||||||
vim.cmd([[
|
vim.cmd([[
|
||||||
aunmenu PopUp.How-to\ disable\ mouse
|
aunmenu PopUp.How-to\ disable\ mouse
|
||||||
|
@ -29,7 +32,10 @@ vim.opt.ignorecase = true
|
||||||
vim.opt.smartcase = true
|
vim.opt.smartcase = true
|
||||||
|
|
||||||
-- System integration
|
-- System integration
|
||||||
vim.opt.clipboard = "unnamedplus"
|
-- https://github.com/nvim-lua/kickstart.nvim/blob/7201dc480134f41dd1be1f8f9b8f8470aac82a3b/init.lua#L113-L119
|
||||||
|
vim.schedule(function()
|
||||||
|
vim.opt.clipboard = "unnamedplus"
|
||||||
|
end)
|
||||||
vim.opt.swapfile = false
|
vim.opt.swapfile = false
|
||||||
vim.opt.undofile = true
|
vim.opt.undofile = true
|
||||||
|
|
||||||
|
@ -42,12 +48,3 @@ vim.opt.tabstop = 2
|
||||||
vim.opt.laststatus = 3
|
vim.opt.laststatus = 3
|
||||||
vim.opt.showmode = false -- Handled by lualine
|
vim.opt.showmode = false -- Handled by lualine
|
||||||
vim.opt.signcolumn = "yes" -- Prevents shifting
|
vim.opt.signcolumn = "yes" -- Prevents shifting
|
||||||
|
|
||||||
-- Neovide specific settings
|
|
||||||
if vim.g.neovide then
|
|
||||||
vim.opt.guifont = "monospace:h12"
|
|
||||||
|
|
||||||
-- Terminal-emulator-like copy/pasting
|
|
||||||
vim.api.nvim_set_keymap("n", "<C-C>", '"+y', { noremap = true, silent = true })
|
|
||||||
vim.api.nvim_set_keymap("n", "<C-V>", '"+p', { noremap = true, silent = true })
|
|
||||||
end
|
|
||||||
|
|
|
@ -6,12 +6,19 @@ return {
|
||||||
"hrsh7th/cmp-cmdline",
|
"hrsh7th/cmp-cmdline",
|
||||||
"hrsh7th/cmp-nvim-lsp",
|
"hrsh7th/cmp-nvim-lsp",
|
||||||
"hrsh7th/cmp-path",
|
"hrsh7th/cmp-path",
|
||||||
|
"saadparwaiz1/cmp_luasnip",
|
||||||
"neovim/nvim-lspconfig",
|
"neovim/nvim-lspconfig",
|
||||||
|
|
||||||
-- Snippets
|
-- Snippets
|
||||||
"L3MON4D3/LuaSnip", -- snippet engine
|
{
|
||||||
"rafamadriz/friendly-snippets", -- pre-configured snippet texts
|
"L3MON4D3/LuaSnip", -- snippet engine
|
||||||
"saadparwaiz1/cmp_luasnip", -- nvim-cmp source
|
dependencies = {
|
||||||
|
"rafamadriz/friendly-snippets", -- pre-configured snippet texts
|
||||||
|
config = function()
|
||||||
|
require("luasnip.loaders.from_vscode").lazy_load()
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
event = { "InsertEnter", "CmdlineEnter" },
|
event = { "InsertEnter", "CmdlineEnter" },
|
||||||
opts = function()
|
opts = function()
|
||||||
|
@ -23,9 +30,6 @@ return {
|
||||||
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
|
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
|
||||||
end
|
end
|
||||||
|
|
||||||
require("mason").setup()
|
|
||||||
require("luasnip.loaders.from_vscode").lazy_load()
|
|
||||||
|
|
||||||
cmp.setup({
|
cmp.setup({
|
||||||
-- keybinds
|
-- keybinds
|
||||||
-- see: https://github.com/hrsh7th/nvim-cmp/wiki/Example-mappings
|
-- see: https://github.com/hrsh7th/nvim-cmp/wiki/Example-mappings
|
||||||
|
@ -33,10 +37,8 @@ return {
|
||||||
["<Tab>"] = cmp.mapping(function(fallback)
|
["<Tab>"] = cmp.mapping(function(fallback)
|
||||||
if cmp.visible() then
|
if cmp.visible() then
|
||||||
cmp.select_next_item()
|
cmp.select_next_item()
|
||||||
elseif luasnip.expand_or_jumpable() then
|
elseif luasnip.locally_jumpable(1) then
|
||||||
luasnip.expand_or_jump()
|
luasnip.jump(1)
|
||||||
elseif has_words_before() then
|
|
||||||
cmp.complete()
|
|
||||||
else
|
else
|
||||||
fallback()
|
fallback()
|
||||||
end
|
end
|
||||||
|
@ -45,14 +47,27 @@ return {
|
||||||
["<S-Tab>"] = cmp.mapping(function(fallback)
|
["<S-Tab>"] = cmp.mapping(function(fallback)
|
||||||
if cmp.visible() then
|
if cmp.visible() then
|
||||||
cmp.select_prev_item()
|
cmp.select_prev_item()
|
||||||
elseif luasnip.jumpable(-1) then
|
elseif luasnip.locally_jumpable(-1) then
|
||||||
luasnip.jump(-1)
|
luasnip.jump(-1)
|
||||||
else
|
else
|
||||||
fallback()
|
fallback()
|
||||||
end
|
end
|
||||||
end, { "i", "s" }),
|
end, { "i", "s" }),
|
||||||
|
|
||||||
["<CR>"] = cmp.mapping.confirm(),
|
["<CR>"] = cmp.mapping(function(fallback)
|
||||||
|
if cmp.visible() then
|
||||||
|
if luasnip.expandable() then
|
||||||
|
luasnip.expand()
|
||||||
|
else
|
||||||
|
cmp.confirm({
|
||||||
|
select = true,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
else
|
||||||
|
fallback()
|
||||||
|
end
|
||||||
|
end),
|
||||||
|
|
||||||
["<Up>"] = cmp.mapping.select_prev_item({ behavior = "select" }),
|
["<Up>"] = cmp.mapping.select_prev_item({ behavior = "select" }),
|
||||||
["<Down>"] = cmp.mapping.select_next_item({ behavior = "select" }),
|
["<Down>"] = cmp.mapping.select_next_item({ behavior = "select" }),
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,17 +1,8 @@
|
||||||
return {
|
return {
|
||||||
"neovim/nvim-lspconfig",
|
"neovim/nvim-lspconfig",
|
||||||
dependencies = {
|
|
||||||
-- Portable package manager
|
|
||||||
"williamboman/mason.nvim",
|
|
||||||
"williamboman/mason-lspconfig.nvim",
|
|
||||||
},
|
|
||||||
|
|
||||||
init = function()
|
init = function()
|
||||||
local capabilities = require("cmp_nvim_lsp").default_capabilities() -- needed for nvim-cmp
|
local capabilities = require("cmp_nvim_lsp").default_capabilities() -- needed for nvim-cmp
|
||||||
require("mason").setup()
|
|
||||||
require("mason-lspconfig").setup()
|
|
||||||
|
|
||||||
-- lspconfig
|
|
||||||
require("lspconfig").lua_ls.setup({
|
require("lspconfig").lua_ls.setup({
|
||||||
capabilities = capabilities,
|
capabilities = capabilities,
|
||||||
})
|
})
|
||||||
|
|
|
@ -15,7 +15,7 @@ return {
|
||||||
end,
|
end,
|
||||||
keys = {
|
keys = {
|
||||||
{
|
{
|
||||||
"<leader>lf",
|
"<leader>f",
|
||||||
function()
|
function()
|
||||||
vim.lsp.buf.format()
|
vim.lsp.buf.format()
|
||||||
end,
|
end,
|
||||||
|
|
|
@ -2,7 +2,10 @@ return {
|
||||||
"nvim-tree/nvim-tree.lua",
|
"nvim-tree/nvim-tree.lua",
|
||||||
opts = {
|
opts = {
|
||||||
view = {
|
view = {
|
||||||
adaptive_size = true,
|
side = "right",
|
||||||
|
},
|
||||||
|
renderer = {
|
||||||
|
symlink_destination = false, -- usually too long
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
init = function()
|
init = function()
|
||||||
|
|
|
@ -7,8 +7,8 @@ return {
|
||||||
opts = {},
|
opts = {},
|
||||||
cmd = "Telescope",
|
cmd = "Telescope",
|
||||||
keys = {
|
keys = {
|
||||||
{ "<leader>f", "<cmd>Telescope find_files<CR>", desc = "Find files" },
|
|
||||||
{ "<leader><leader>", "<cmd>Telescope oldfiles<CR>", desc = "Recent files" },
|
{ "<leader><leader>", "<cmd>Telescope oldfiles<CR>", desc = "Recent files" },
|
||||||
|
{ "<leader>sf", "<cmd>Telescope find_files<CR>", desc = "Find files" },
|
||||||
{ "<leader>sg", "<cmd>Telescope live_grep<CR>", desc = "Live grep" },
|
{ "<leader>sg", "<cmd>Telescope live_grep<CR>", desc = "Live grep" },
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
18
package.nix
18
package.nix
|
@ -1,18 +0,0 @@
|
||||||
{
|
|
||||||
lib,
|
|
||||||
wrapNeovimUnstable,
|
|
||||||
neovim-unwrapped,
|
|
||||||
neovimUtils,
|
|
||||||
runtimeDeps ? null,
|
|
||||||
src ? null,
|
|
||||||
...
|
|
||||||
} @ args:
|
|
||||||
wrapNeovimUnstable neovim-unwrapped (neovimUtils.makeNeovimConfig args
|
|
||||||
// {
|
|
||||||
# FIXME: append instead of override the entire wrapperArgs
|
|
||||||
wrapperArgs = ["--prefix" "PATH" ":" "${lib.makeBinPath runtimeDeps}"];
|
|
||||||
luaRcContent = ''
|
|
||||||
vim.cmd [[set runtimepath^=${src}]]
|
|
||||||
${builtins.readFile "${src}/init.lua"}
|
|
||||||
'';
|
|
||||||
})
|
|
Loading…
Reference in a new issue