emacs has been adapted
This commit is contained in:
+123
@@ -0,0 +1,123 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
# Install Neovim and Neovide using nix-env with the correct attribute path for NixOS
|
||||
echo "Installing Neovim and Neovide..."
|
||||
nix-env -iA nixos.neovim nixos.neovide
|
||||
|
||||
# Create Neovim config directory
|
||||
NVIM_CONFIG_DIR="${XDG_CONFIG_HOME:-$HOME/.config}/nvim"
|
||||
mkdir -p "$NVIM_CONFIG_DIR"
|
||||
|
||||
# Install packer.nvim (plugin manager)
|
||||
PACKER_DIR="${XDG_DATA_HOME:-$HOME/.local/share}/nvim/site/pack/packer/start/packer.nvim"
|
||||
if [ ! -d "$PACKER_DIR" ]; then
|
||||
echo "Installing packer.nvim..."
|
||||
git clone --depth 1 https://github.com/wbthomason/packer.nvim "$PACKER_DIR"
|
||||
fi
|
||||
|
||||
# Write minimal init.lua for literate NixOS
|
||||
cat > "$NVIM_CONFIG_DIR/init.lua" << 'EOF'
|
||||
-- Enable filetype detection, syntax highlighting, and indenting
|
||||
vim.cmd([[
|
||||
filetype plugin indent on
|
||||
syntax on
|
||||
]])
|
||||
|
||||
-- Leader key
|
||||
vim.g.mapleader = " "
|
||||
|
||||
-- Install plugins with Packer
|
||||
local fn = vim.fn
|
||||
local install_path = fn.stdpath('data')..'/site/pack/packer/start/packer.nvim'
|
||||
local packer_bootstrap = false
|
||||
|
||||
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})
|
||||
vim.cmd [[packadd packer.nvim]]
|
||||
end
|
||||
|
||||
require('packer').startup(function(use)
|
||||
-- Plugin manager
|
||||
use 'wbthomason/packer.nvim'
|
||||
|
||||
-- Catppuccin theme
|
||||
use { 'catppuccin/nvim', as = 'catppuccin' }
|
||||
|
||||
-- Orgmode for literate NixOS
|
||||
use {
|
||||
'nvim-orgmode/orgmode',
|
||||
config = function()
|
||||
require('orgmode').setup({
|
||||
org_agenda_files = {'~/Documents/org/*'},
|
||||
org_default_notes_file = '~/Documents/org/notes.org',
|
||||
})
|
||||
end
|
||||
}
|
||||
|
||||
-- Treesitter (better syntax highlighting)
|
||||
use {
|
||||
'nvim-treesitter/nvim-treesitter',
|
||||
run = ':TSUpdate',
|
||||
config = function()
|
||||
require('nvim-treesitter.configs').setup({
|
||||
ensure_installed = {'nix', 'org'},
|
||||
highlight = { enable = true },
|
||||
})
|
||||
end
|
||||
}
|
||||
|
||||
-- LSP (for Nix language server)
|
||||
use {
|
||||
'neovim/nvim-lspconfig',
|
||||
config = function()
|
||||
require('lspconfig').nil_ls.setup({})
|
||||
end
|
||||
}
|
||||
|
||||
-- Telescope (fuzzy finder)
|
||||
use {
|
||||
'nvim-telescope/telescope.nvim',
|
||||
requires = {{'nvim-lua/plenary.nvim'}}
|
||||
}
|
||||
|
||||
-- Automatically set up after cloning packer.nvim
|
||||
if packer_bootstrap then
|
||||
require('packer').sync()
|
||||
end
|
||||
end)
|
||||
|
||||
-- Set Catppuccin theme
|
||||
vim.cmd.colorscheme('catppuccin-mocha')
|
||||
|
||||
-- Keybindings for orgmode
|
||||
vim.api.nvim_set_keymap('n', '<leader>oo', '<cmd>lua require("orgmode").action("agenda.prompt")<cr>', { noremap = true, silent = true })
|
||||
vim.api.nvim_set_keymap('n', '<leader>oc', '<cmd>lua require("orgmode").action("capture.prompt")<cr>', { noremap = true, silent = true })
|
||||
vim.api.nvim_set_keymap('n', '<leader>ot', '<cmd>lua require("orgmode").action("tangle.current_file")<cr>', { noremap = true, silent = true })
|
||||
vim.api.nvim_set_keymap('n', '<leader>oe', '<cmd>lua require("orgmode").action("export.current_file")<cr>', { noremap = true, silent = true })
|
||||
|
||||
-- Auto-install LSP and Treesitter parsers on first run
|
||||
vim.api.nvim_create_autocmd('BufEnter', {
|
||||
pattern = {'*.nix', '*.org'},
|
||||
callback = function()
|
||||
vim.cmd('TSInstall! nix')
|
||||
vim.cmd('TSInstall! org')
|
||||
end,
|
||||
})
|
||||
EOF
|
||||
|
||||
# Install nil (Nix language server)
|
||||
echo "Installing nil (Nix language server)..."
|
||||
nix-env -iA nixos.nil
|
||||
|
||||
# Install Neovide config (optional)
|
||||
NEOVIDE_CONFIG_DIR="${XDG_CONFIG_HOME:-$HOME/.config}/neovide"
|
||||
mkdir -p "$NEOVIDE_CONFIG_DIR"
|
||||
cat > "$NEOVIDE_CONFIG_DIR/config.toml" << 'EOF'
|
||||
[editor]
|
||||
theme = "catppuccin-mocha"
|
||||
EOF
|
||||
|
||||
echo "Setup complete!"
|
||||
echo "Run 'nvim' or 'neovide' to start."
|
||||
echo "In Neovim, run ':PackerSync' to install plugins."
|
||||
Reference in New Issue
Block a user