Compare commits
No commits in common. "2c3b306495070c8b20a1f28f9f7143917bbff9e6" and "d3b42cf643d03d675d19ec6259bb33538eaa706e" have entirely different histories.
2c3b306495
...
d3b42cf643
10 changed files with 75 additions and 48 deletions
1
.envrc
1
.envrc
|
@ -1 +0,0 @@
|
|||
use flake
|
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -5,5 +5,3 @@ result
|
|||
result-*
|
||||
|
||||
lazy-lock.json
|
||||
|
||||
/.direnv
|
||||
|
|
26
flake.nix
26
flake.nix
|
@ -19,19 +19,37 @@
|
|||
|
||||
outputs = inputs:
|
||||
inputs.flake-utils.lib.eachDefaultSystem (system: let
|
||||
inherit (inputs.nixpkgs) lib;
|
||||
pkgs = inputs.nixpkgs.legacyPackages.${system};
|
||||
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 {
|
||||
### nix {run,shell,build}
|
||||
packages.default = pkgs.callPackage ./package.nix {inherit runtimeDeps src;};
|
||||
|
||||
### nix fmt
|
||||
formatter = treefmtEval.config.build.wrapper;
|
||||
|
||||
### nix flake check
|
||||
checks.formatting = treefmtEval.config.build.check inputs.self;
|
||||
checks = {formatting = treefmtEval.config.build.check inputs.self;};
|
||||
|
||||
### nix develop
|
||||
devShells.default = pkgs.mkShellNoCC {
|
||||
packages = with pkgs; [
|
||||
lua-language-server
|
||||
devShells.default = pkgs.mkShell {
|
||||
nativeBuildInputs = with pkgs; [
|
||||
stylua
|
||||
];
|
||||
};
|
||||
|
|
|
@ -13,9 +13,6 @@ vim.opt.cursorline = true
|
|||
vim.opt.number = true
|
||||
vim.opt.relativenumber = true
|
||||
|
||||
-- Breakindent
|
||||
vim.opt.breakindent = true
|
||||
|
||||
-- Mouse
|
||||
vim.cmd([[
|
||||
aunmenu PopUp.How-to\ disable\ mouse
|
||||
|
@ -32,10 +29,7 @@ vim.opt.ignorecase = true
|
|||
vim.opt.smartcase = true
|
||||
|
||||
-- System integration
|
||||
-- https://github.com/nvim-lua/kickstart.nvim/blob/7201dc480134f41dd1be1f8f9b8f8470aac82a3b/init.lua#L113-L119
|
||||
vim.schedule(function()
|
||||
vim.opt.clipboard = "unnamedplus"
|
||||
end)
|
||||
vim.opt.clipboard = "unnamedplus"
|
||||
vim.opt.swapfile = false
|
||||
vim.opt.undofile = true
|
||||
|
||||
|
@ -48,3 +42,12 @@ vim.opt.tabstop = 2
|
|||
vim.opt.laststatus = 3
|
||||
vim.opt.showmode = false -- Handled by lualine
|
||||
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,19 +6,12 @@ return {
|
|||
"hrsh7th/cmp-cmdline",
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
"hrsh7th/cmp-path",
|
||||
"saadparwaiz1/cmp_luasnip",
|
||||
"neovim/nvim-lspconfig",
|
||||
|
||||
-- Snippets
|
||||
{
|
||||
"L3MON4D3/LuaSnip", -- snippet engine
|
||||
dependencies = {
|
||||
"rafamadriz/friendly-snippets", -- pre-configured snippet texts
|
||||
config = function()
|
||||
require("luasnip.loaders.from_vscode").lazy_load()
|
||||
end,
|
||||
},
|
||||
},
|
||||
"saadparwaiz1/cmp_luasnip", -- nvim-cmp source
|
||||
},
|
||||
event = { "InsertEnter", "CmdlineEnter" },
|
||||
opts = function()
|
||||
|
@ -30,6 +23,9 @@ return {
|
|||
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
|
||||
end
|
||||
|
||||
require("mason").setup()
|
||||
require("luasnip.loaders.from_vscode").lazy_load()
|
||||
|
||||
cmp.setup({
|
||||
-- keybinds
|
||||
-- see: https://github.com/hrsh7th/nvim-cmp/wiki/Example-mappings
|
||||
|
@ -37,8 +33,10 @@ return {
|
|||
["<Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
elseif luasnip.locally_jumpable(1) then
|
||||
luasnip.jump(1)
|
||||
elseif luasnip.expand_or_jumpable() then
|
||||
luasnip.expand_or_jump()
|
||||
elseif has_words_before() then
|
||||
cmp.complete()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
|
@ -47,27 +45,14 @@ return {
|
|||
["<S-Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
elseif luasnip.locally_jumpable(-1) then
|
||||
elseif luasnip.jumpable(-1) then
|
||||
luasnip.jump(-1)
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, { "i", "s" }),
|
||||
|
||||
["<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),
|
||||
|
||||
["<CR>"] = cmp.mapping.confirm(),
|
||||
["<Up>"] = cmp.mapping.select_prev_item({ behavior = "select" }),
|
||||
["<Down>"] = cmp.mapping.select_next_item({ behavior = "select" }),
|
||||
},
|
||||
|
|
|
@ -1,8 +1,17 @@
|
|||
return {
|
||||
"neovim/nvim-lspconfig",
|
||||
dependencies = {
|
||||
-- Portable package manager
|
||||
"williamboman/mason.nvim",
|
||||
"williamboman/mason-lspconfig.nvim",
|
||||
},
|
||||
|
||||
init = function()
|
||||
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({
|
||||
capabilities = capabilities,
|
||||
})
|
||||
|
|
|
@ -15,7 +15,7 @@ return {
|
|||
end,
|
||||
keys = {
|
||||
{
|
||||
"<leader>f",
|
||||
"<leader>lf",
|
||||
function()
|
||||
vim.lsp.buf.format()
|
||||
end,
|
||||
|
|
|
@ -2,10 +2,7 @@ return {
|
|||
"nvim-tree/nvim-tree.lua",
|
||||
opts = {
|
||||
view = {
|
||||
side = "right",
|
||||
},
|
||||
renderer = {
|
||||
symlink_destination = false, -- usually too long
|
||||
adaptive_size = true,
|
||||
},
|
||||
},
|
||||
init = function()
|
||||
|
|
|
@ -7,8 +7,8 @@ return {
|
|||
opts = {},
|
||||
cmd = "Telescope",
|
||||
keys = {
|
||||
{ "<leader>f", "<cmd>Telescope find_files<CR>", desc = "Find 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" },
|
||||
},
|
||||
}
|
||||
|
|
18
package.nix
Normal file
18
package.nix
Normal file
|
@ -0,0 +1,18 @@
|
|||
{
|
||||
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