mirror of
https://github.com/nmasur/dotfiles
synced 2024-11-12 23:42:56 +00:00
a bit of nix config
This commit is contained in:
parent
f493b263e0
commit
634e8cabac
146
nixos/configuration.nix
Normal file
146
nixos/configuration.nix
Normal file
@ -0,0 +1,146 @@
|
|||||||
|
# Edit this configuration file to define what should be installed on
|
||||||
|
# your system. Help is available in the configuration.nix(5) man page
|
||||||
|
# and in the NixOS manual (accessible by running ‘nixos-help’).
|
||||||
|
|
||||||
|
{ config, pkgs, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
imports =
|
||||||
|
[ # Include the results of the hardware scan.
|
||||||
|
/etc/nixos/hardware-configuration.nix
|
||||||
|
];
|
||||||
|
|
||||||
|
# Use the systemd-boot EFI boot loader.
|
||||||
|
boot.loader.systemd-boot.enable = true;
|
||||||
|
boot.loader.efi.canTouchEfiVariables = true;
|
||||||
|
|
||||||
|
# networking.hostName = "nixos"; # Define your hostname.
|
||||||
|
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
|
||||||
|
|
||||||
|
# Set your time zone.
|
||||||
|
time.timeZone = "America/New_York";
|
||||||
|
|
||||||
|
# The global useDHCP flag is deprecated, therefore explicitly set to false here.
|
||||||
|
# Per-interface useDHCP will be mandatory in the future, so this generated config
|
||||||
|
# replicates the default behaviour.
|
||||||
|
networking.useDHCP = false;
|
||||||
|
networking.interfaces.enp0s31f6.useDHCP = true;
|
||||||
|
networking.interfaces.wlp3s0.useDHCP = true;
|
||||||
|
|
||||||
|
# Configure network proxy if necessary
|
||||||
|
# networking.proxy.default = "http://user:password@proxy:port/";
|
||||||
|
# networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
|
||||||
|
|
||||||
|
# Select internationalisation properties.
|
||||||
|
# i18n.defaultLocale = "en_US.UTF-8";
|
||||||
|
# console = {
|
||||||
|
# font = "Lat2-Terminus16";
|
||||||
|
# keyMap = "us";
|
||||||
|
# };
|
||||||
|
|
||||||
|
# Enable the X11 windowing system.
|
||||||
|
# services.xserver.enable = true;
|
||||||
|
services.xserver = {
|
||||||
|
enable = true;
|
||||||
|
desktopManager = {
|
||||||
|
xterm.enable = false;
|
||||||
|
xfce.enable = true;
|
||||||
|
};
|
||||||
|
displayManager.defaultSession = "xfce";
|
||||||
|
|
||||||
|
# Disable mouse acceleration
|
||||||
|
libinput.mouse.accelProfile = "flat";
|
||||||
|
};
|
||||||
|
|
||||||
|
# Configure keymap in X11
|
||||||
|
services.xserver.layout = "us";
|
||||||
|
services.xserver.xkbOptions = "eurosign:e";
|
||||||
|
|
||||||
|
# Enable CUPS to print documents.
|
||||||
|
# services.printing.enable = true;
|
||||||
|
|
||||||
|
# Enable sound.
|
||||||
|
sound.enable = true;
|
||||||
|
hardware.pulseaudio.enable = true;
|
||||||
|
|
||||||
|
# Enable touchpad support (enabled default in most desktopManager).
|
||||||
|
# services.xserver.libinput.enable = true;
|
||||||
|
|
||||||
|
# Replace sudo with doas
|
||||||
|
security = {
|
||||||
|
|
||||||
|
# Remove sudo
|
||||||
|
sudo.enable = false;
|
||||||
|
|
||||||
|
# Add doas
|
||||||
|
doas = {
|
||||||
|
enable = true;
|
||||||
|
|
||||||
|
# No password required
|
||||||
|
wheelNeedsPassword = false;
|
||||||
|
|
||||||
|
# Pass environment variables from user to root
|
||||||
|
# Also requires removing password here
|
||||||
|
extraRules = [{
|
||||||
|
groups = [ "wheel" ];
|
||||||
|
noPass = true;
|
||||||
|
keepEnv = true;
|
||||||
|
}];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
# Define a user account. Don't forget to set a password with ‘passwd’.
|
||||||
|
users.users.noah = {
|
||||||
|
|
||||||
|
# Not sure what this means tbh
|
||||||
|
isNormalUser = true;
|
||||||
|
|
||||||
|
# Automatically create a password to start
|
||||||
|
initialPassword = "changeme";
|
||||||
|
|
||||||
|
# Enable sudo privileges
|
||||||
|
extraGroups = [ "wheel" ];
|
||||||
|
|
||||||
|
# Use the fish shell
|
||||||
|
shell = pkgs.fish;
|
||||||
|
};
|
||||||
|
|
||||||
|
# List packages installed in system profile. To search, run:
|
||||||
|
# $ nix search wget
|
||||||
|
environment.systemPackages = with pkgs; [
|
||||||
|
fish
|
||||||
|
vim
|
||||||
|
wget
|
||||||
|
curl
|
||||||
|
home-manager
|
||||||
|
just
|
||||||
|
];
|
||||||
|
|
||||||
|
# Some programs need SUID wrappers, can be configured further or are
|
||||||
|
# started in user sessions.
|
||||||
|
# programs.mtr.enable = true;
|
||||||
|
# programs.gnupg.agent = {
|
||||||
|
# enable = true;
|
||||||
|
# enableSSHSupport = true;
|
||||||
|
# };
|
||||||
|
|
||||||
|
# List services that you want to enable:
|
||||||
|
|
||||||
|
# Enable the OpenSSH daemon.
|
||||||
|
# services.openssh.enable = true;
|
||||||
|
|
||||||
|
# Open ports in the firewall.
|
||||||
|
# networking.firewall.allowedTCPPorts = [ ... ];
|
||||||
|
# networking.firewall.allowedUDPPorts = [ ... ];
|
||||||
|
# Or disable the firewall altogether.
|
||||||
|
# networking.firewall.enable = false;
|
||||||
|
|
||||||
|
# This value determines the NixOS release from which the default
|
||||||
|
# settings for stateful data, like file locations and database versions
|
||||||
|
# on your system were taken. It‘s perfectly fine and recommended to leave
|
||||||
|
# this value at the release version of the first install of this system.
|
||||||
|
# Before changing this value read the documentation for this option
|
||||||
|
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
|
||||||
|
system.stateVersion = "21.05"; # Did you read the comment?
|
||||||
|
|
||||||
|
}
|
31
nixos/flakes/flake.nix
Normal file
31
nixos/flakes/flake.nix
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
{
|
||||||
|
description = "System Config";
|
||||||
|
|
||||||
|
inputs = {
|
||||||
|
nixpkgs.url = "nixpkgs/nixos-21.05";
|
||||||
|
home-manager.url = "github:nix-community/home-manager/release-21.05";
|
||||||
|
home-manager.inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
};
|
||||||
|
|
||||||
|
outputs = { nixpkgs, home-manager, ... }: {
|
||||||
|
let
|
||||||
|
system = "x86_64-linux";
|
||||||
|
|
||||||
|
pkgs = import nixpkgs {
|
||||||
|
inherit system;
|
||||||
|
config = { allowUnfree = true; };
|
||||||
|
};
|
||||||
|
|
||||||
|
lib = nixpkgs.lib;
|
||||||
|
|
||||||
|
in {
|
||||||
|
nixosConfigurations = {
|
||||||
|
nixos = lib.nixosSystem {
|
||||||
|
inherit system;
|
||||||
|
modules = [
|
||||||
|
./configuration.nix
|
||||||
|
]
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
157
nixos/home.nix
Normal file
157
nixos/home.nix
Normal file
@ -0,0 +1,157 @@
|
|||||||
|
{ pkgs, ... }:
|
||||||
|
|
||||||
|
let
|
||||||
|
|
||||||
|
# Import unstable channel (for Neovim 0.5)
|
||||||
|
unstable = import <nixos-unstable> { config = { allowUnfree = true; }; };
|
||||||
|
|
||||||
|
in
|
||||||
|
|
||||||
|
{
|
||||||
|
home.packages = with pkgs; [
|
||||||
|
firefox
|
||||||
|
unzip
|
||||||
|
# alacritty
|
||||||
|
# unstable.neovim
|
||||||
|
tmux
|
||||||
|
rsync
|
||||||
|
ripgrep
|
||||||
|
bat
|
||||||
|
fd
|
||||||
|
exa
|
||||||
|
sd
|
||||||
|
jq
|
||||||
|
tealdeer
|
||||||
|
zoxide
|
||||||
|
unstable._1password-gui
|
||||||
|
];
|
||||||
|
|
||||||
|
programs.alacritty = {
|
||||||
|
enable = true;
|
||||||
|
settings = {
|
||||||
|
window = {
|
||||||
|
dimensions = {
|
||||||
|
columns = 110;
|
||||||
|
lines = 30;
|
||||||
|
};
|
||||||
|
padding = {
|
||||||
|
x = 20;
|
||||||
|
y = 20;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
scrolling.history = 10000;
|
||||||
|
font = {
|
||||||
|
size = 15.0;
|
||||||
|
};
|
||||||
|
key_bindings = [
|
||||||
|
{
|
||||||
|
key = "F";
|
||||||
|
mods = "Super";
|
||||||
|
action = "ToggleFullscreen";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
key = "L";
|
||||||
|
mods = "Super";
|
||||||
|
chars = "\x1F";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
programs.fish = {
|
||||||
|
enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
home.sessionVariables = {
|
||||||
|
EDITOR = "nvim";
|
||||||
|
};
|
||||||
|
|
||||||
|
programs.starship = {
|
||||||
|
enable = true;
|
||||||
|
enableFishIntegration = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
programs.fzf = {
|
||||||
|
enable = true;
|
||||||
|
enableFishIntegration = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
# Other configs
|
||||||
|
xdg.configFile = {
|
||||||
|
"starship.toml".source = ../starship/starship.toml.configlink;
|
||||||
|
#"alacritty/alacritty.yml".source = ../alacritty.configlink/alacritty.yml;
|
||||||
|
# "nvim/init.lua".source = ../nvim.configlink/init.lua;
|
||||||
|
};
|
||||||
|
|
||||||
|
# nixpkgs.overlays = [(
|
||||||
|
# self: super: {
|
||||||
|
# neovim = unstable.neovim;
|
||||||
|
# })
|
||||||
|
# ];
|
||||||
|
nixpkgs.overlays = [
|
||||||
|
(import (builtins.fetchTarball {
|
||||||
|
url = https://github.com/nix-community/neovim-nightly-overlay/archive/master.tar.gz;
|
||||||
|
}))
|
||||||
|
];
|
||||||
|
|
||||||
|
programs.neovim = {
|
||||||
|
enable = true;
|
||||||
|
package = pkgs.neovim-nightly;
|
||||||
|
vimAlias = true;
|
||||||
|
plugins = with pkgs.vimPlugins; [
|
||||||
|
fzf-vim
|
||||||
|
fzfWrapper
|
||||||
|
vim-eunuch
|
||||||
|
vim-vinegar
|
||||||
|
surround
|
||||||
|
commentary
|
||||||
|
repeat
|
||||||
|
gruvbox-nvim
|
||||||
|
nvim-lspconfig
|
||||||
|
lsp-colors-nvim
|
||||||
|
vim-vsnip
|
||||||
|
vim-vsnip-integ
|
||||||
|
nvim-compe
|
||||||
|
tabular
|
||||||
|
vimwiki
|
||||||
|
vim-rooter
|
||||||
|
lualine-nvim
|
||||||
|
nvim-web-devicons
|
||||||
|
nvim-treesitter
|
||||||
|
vim-fish
|
||||||
|
nginx-vim
|
||||||
|
vim-terraform
|
||||||
|
vim-toml
|
||||||
|
vim-helm
|
||||||
|
vim-nix
|
||||||
|
gitsigns-nvim
|
||||||
|
plenary-nvim
|
||||||
|
vim-hexokinase
|
||||||
|
];
|
||||||
|
extraPackages = with pkgs; [
|
||||||
|
nodePackages.pyright
|
||||||
|
rust-analyzer
|
||||||
|
];
|
||||||
|
extraConfig = ''
|
||||||
|
lua << EOF
|
||||||
|
${builtins.readFile ./init.lua}
|
||||||
|
EOF
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
# # Neovim config
|
||||||
|
# home.file = {
|
||||||
|
# ".config/nvim/init.lua".source = ../nvim.configlink/init.lua;
|
||||||
|
# };
|
||||||
|
|
||||||
|
programs.git = {
|
||||||
|
enable = true;
|
||||||
|
userName = "Noah Masur";
|
||||||
|
userEmail = "7386960+nmasur@users.noreply.github.com";
|
||||||
|
extraConfig = {
|
||||||
|
core = {
|
||||||
|
editor = "nvim";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
285
nixos/init.lua
Normal file
285
nixos/init.lua
Normal file
@ -0,0 +1,285 @@
|
|||||||
|
-- LSP Settings
|
||||||
|
-- ============
|
||||||
|
|
||||||
|
require('lspconfig').rust_analyzer.setup{}
|
||||||
|
require('lspconfig').pyright.setup{
|
||||||
|
cmd = { "poetry", "run", "pyright-langserver", "--stdio" }
|
||||||
|
}
|
||||||
|
require'compe'.setup({
|
||||||
|
enabled = true,
|
||||||
|
source = {
|
||||||
|
path = true,
|
||||||
|
buffer = true,
|
||||||
|
nvim_lsp = true,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
if require('lspconfig/util').has_bins('diagnostic-languageserver') then
|
||||||
|
require('lspconfig').diagnosticls.setup{
|
||||||
|
cmd = { "diagnostic-languageserver", "--stdio" },
|
||||||
|
filetypes = { "sh" },
|
||||||
|
on_attach = on_attach,
|
||||||
|
init_options = {
|
||||||
|
filetypes = {
|
||||||
|
sh = "shellcheck",
|
||||||
|
},
|
||||||
|
linters = {
|
||||||
|
shellcheck = {
|
||||||
|
sourceName = "shellcheck",
|
||||||
|
command = "shellcheck",
|
||||||
|
debounce = 100,
|
||||||
|
args = { "--format=gcc", "-" },
|
||||||
|
offsetLine = 0,
|
||||||
|
offsetColumn = 0,
|
||||||
|
formatLines = 1,
|
||||||
|
formatPattern = {
|
||||||
|
"^[^:]+:(\\d+):(\\d+):\\s+([^:]+):\\s+(.*)$",
|
||||||
|
{
|
||||||
|
line = 1,
|
||||||
|
column = 2,
|
||||||
|
message = 4,
|
||||||
|
security = 3
|
||||||
|
}
|
||||||
|
},
|
||||||
|
securities = {
|
||||||
|
error = "error",
|
||||||
|
warning = "warning",
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Auto-complete
|
||||||
|
-- ====================
|
||||||
|
|
||||||
|
-- Auto-complete mapping
|
||||||
|
local t = function(str)
|
||||||
|
return vim.api.nvim_replace_termcodes(str, true, true, true)
|
||||||
|
end
|
||||||
|
|
||||||
|
local check_back_space = function()
|
||||||
|
local col = vim.fn.col('.') - 1
|
||||||
|
if col == 0 or vim.fn.getline('.'):sub(col, col):match('%s') then
|
||||||
|
return true
|
||||||
|
else
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
-- Use (s-)tab to:
|
||||||
|
--- move to prev/next item in completion menuone
|
||||||
|
--- jump to prev/next snippet's placeholder
|
||||||
|
_G.tab_complete = function()
|
||||||
|
if vim.fn.pumvisible() == 1 then
|
||||||
|
return t "<C-n>"
|
||||||
|
elseif vim.fn.call("vsnip#available", {1}) == 1 then
|
||||||
|
return t "<Plug>(vsnip-expand-or-jump)"
|
||||||
|
elseif check_back_space() then
|
||||||
|
return t "<Tab>"
|
||||||
|
else
|
||||||
|
return vim.fn['compe#complete']()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
_G.s_tab_complete = function()
|
||||||
|
if vim.fn.pumvisible() == 1 then
|
||||||
|
return t "<C-p>"
|
||||||
|
elseif vim.fn.call("vsnip#jumpable", {-1}) == 1 then
|
||||||
|
return t "<Plug>(vsnip-jump-prev)"
|
||||||
|
else
|
||||||
|
return t "<S-Tab>"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Auto-complete keybinds
|
||||||
|
vim.api.nvim_set_keymap("i", "<Tab>", "v:lua.tab_complete()", {expr = true})
|
||||||
|
vim.api.nvim_set_keymap("s", "<Tab>", "v:lua.tab_complete()", {expr = true})
|
||||||
|
vim.api.nvim_set_keymap("i", "<S-Tab>", "v:lua.s_tab_complete()", {expr = true})
|
||||||
|
vim.api.nvim_set_keymap("s", "<S-Tab>", "v:lua.s_tab_complete()", {expr = true})
|
||||||
|
|
||||||
|
-- Settings
|
||||||
|
-- ========
|
||||||
|
|
||||||
|
-- Basic Settings
|
||||||
|
vim.o.termguicolors = true -- Set to truecolor
|
||||||
|
vim.cmd[[colorscheme gruvbox]] -- Installed with a plugin
|
||||||
|
vim.o.hidden = true -- Don't unload buffers when leaving them
|
||||||
|
vim.wo.number = true -- Show line numbers
|
||||||
|
vim.wo.relativenumber = true -- Relative numbers instead of absolute
|
||||||
|
vim.o.list = true -- Reveal whitespace with dashes
|
||||||
|
vim.o.expandtab = true -- Tabs into spaces
|
||||||
|
vim.o.shiftwidth = 4 -- Amount to shift with > key
|
||||||
|
vim.o.softtabstop = 4 -- Amount to shift with <TAB> key
|
||||||
|
vim.o.ignorecase = true -- Ignore case when searching
|
||||||
|
vim.o.smartcase = true -- Check case when using capitals in search
|
||||||
|
vim.o.infercase = true -- Don't match cases when completing suggestions
|
||||||
|
vim.o.incsearch = true -- Search while typing
|
||||||
|
vim.o.visualbell = true -- No sounds
|
||||||
|
vim.o.scrolljump = 1 -- Number of lines to scroll
|
||||||
|
vim.o.scrolloff = 3 -- Margin of lines to see while scrolling
|
||||||
|
vim.o.splitright = true -- Vertical splits on the right side
|
||||||
|
vim.o.splitbelow = true -- Horizontal splits on the bottom side
|
||||||
|
vim.o.pastetoggle = "<F3>" -- Use F3 to enter raw paste mode
|
||||||
|
vim.o.clipboard = "unnamedplus" -- Uses system clipboard for yanking
|
||||||
|
vim.o.updatetime = 300 -- Faster diagnostics
|
||||||
|
vim.o.mouse = "nv" -- Mouse interaction / scrolling
|
||||||
|
|
||||||
|
-- Neovim features
|
||||||
|
vim.o.inccommand = "split" -- Live preview search and replace
|
||||||
|
vim.o.completeopt = "menuone,noselect" -- Required for nvim-compe completion
|
||||||
|
|
||||||
|
-- Remember last position when reopening file
|
||||||
|
vim.api.nvim_exec([[
|
||||||
|
if has("autocmd")
|
||||||
|
au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") | exe "normal! g`\"" | endif
|
||||||
|
endif
|
||||||
|
]], false)
|
||||||
|
|
||||||
|
-- Better backup, swap and undo storage
|
||||||
|
vim.o.backup = true -- Easier to recover and more secure
|
||||||
|
vim.bo.swapfile = false -- Instead of swaps, create backups
|
||||||
|
vim.bo.undofile = true -- Keeps undos after quit
|
||||||
|
|
||||||
|
-- Create backup directories if they don't exist
|
||||||
|
vim.api.nvim_exec([[
|
||||||
|
set backupdir=~/.local/share/nvim/backup
|
||||||
|
set undodir=~/.local/share/nvim/undo
|
||||||
|
if !isdirectory(&backupdir)
|
||||||
|
call mkdir(&backupdir, "p")
|
||||||
|
endif
|
||||||
|
if !isdirectory(&undodir)
|
||||||
|
call mkdir(&undodir, "p")
|
||||||
|
endif
|
||||||
|
]], false)
|
||||||
|
|
||||||
|
-- Keep selection when tabbing
|
||||||
|
vim.api.nvim_set_keymap("v", "<", "<gv", {noremap=true})
|
||||||
|
vim.api.nvim_set_keymap("v", ">", ">gv", {noremap=true})
|
||||||
|
|
||||||
|
-- Force filetype patterns that Vim doesn't know about
|
||||||
|
vim.api.nvim_exec([[
|
||||||
|
au BufRead,BufNewFile *.Brewfile setfiletype brewfile
|
||||||
|
au BufRead,BufNewFile tmux.conf* setfiletype tmux
|
||||||
|
au BufRead,BufNewFile *ignore.*link setfiletype gitignore
|
||||||
|
au BufRead,BufNewFile gitconfig.*link setfiletype gitconfig
|
||||||
|
au BufRead,BufNewFile *.toml.*link setfiletype toml
|
||||||
|
au BufRead,BufNewFile *.muttrc setfiletype muttrc
|
||||||
|
au BufRead,BufNewFile .env* set ft=text | set syntax=sh
|
||||||
|
]], false)
|
||||||
|
|
||||||
|
-- LaTeX options
|
||||||
|
vim.api.nvim_exec([[
|
||||||
|
au FileType tex inoremap ;bf \textbf{}<Esc>i
|
||||||
|
au BufWritePost *.tex silent! execute "!pdflatex -output-directory=%:p:h % >/dev/null 2>&1" | redraw!
|
||||||
|
]], false)
|
||||||
|
|
||||||
|
-- Highlight when yanking
|
||||||
|
vim.api.nvim_exec([[
|
||||||
|
au TextYankPost * silent! lua vim.highlight.on_yank { timeout = 250 }
|
||||||
|
]], false)
|
||||||
|
|
||||||
|
-- Rust stuff
|
||||||
|
-- vim.api.nvim_exec([[
|
||||||
|
-- au BufWritePost *.rs silent! execute "%! rustfmt"
|
||||||
|
-- ]], false)
|
||||||
|
|
||||||
|
-- Auto-pairs
|
||||||
|
vim.g.AutoPairsFlyMode = 0
|
||||||
|
|
||||||
|
-- Netrw
|
||||||
|
vim.g.netrw_liststyle = 3 -- Change style to 'tree' view
|
||||||
|
vim.g.netrw_banner = 0 -- Remove useless banner
|
||||||
|
vim.g.netrw_winsize = 15 -- Explore window takes % of page
|
||||||
|
vim.g.netrw_browse_split = 4 -- Open in previous window
|
||||||
|
vim.g.netrw_altv = 1 -- Always split left
|
||||||
|
|
||||||
|
-- Polyglot
|
||||||
|
vim.g.terraform_fmt_on_save = 1 -- Formats with terraform plugin
|
||||||
|
vim.g.rustfmt_autosave = 1 -- Formats with rust plugin
|
||||||
|
|
||||||
|
-- VimWiki
|
||||||
|
vim.g.vimwiki_list = {
|
||||||
|
{
|
||||||
|
["path"] = "$NOTES_PATH",
|
||||||
|
["syntax"] = "markdown",
|
||||||
|
["index"] = "home",
|
||||||
|
["ext"] = ".md"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
vim.g.vimwiki_key_mappings = {
|
||||||
|
["all_maps"] = 1,
|
||||||
|
["mouse"] = 1,
|
||||||
|
}
|
||||||
|
vim.g.vimwiki_auto_chdir = 1 -- Set local dir to Wiki when open
|
||||||
|
vim.g.vimwiki_create_link = 0 -- Don't automatically create new links
|
||||||
|
vim.g.vimwiki_listsyms = " x" -- Set checkbox symbol progression
|
||||||
|
vim.g.vimwiki_table_mappings = 0 -- VimWiki table keybinds interfere with tab completion
|
||||||
|
vim.api.nvim_exec([[
|
||||||
|
au FileType markdown inoremap ;tt <Esc>:AddTag<CR>
|
||||||
|
|
||||||
|
function! PInsert(item)
|
||||||
|
let @z=a:item
|
||||||
|
norm "zpx
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
command! AddTag call fzf#run({'source': 'rg "#[A-Za-z/]+[ |\$]" -o --no-filename --no-line-number | sort | uniq', 'sink': function('PInsert')})
|
||||||
|
]], false)
|
||||||
|
|
||||||
|
-- Status bar
|
||||||
|
require('lualine').setup({
|
||||||
|
options = { theme = 'gruvbox' }
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Remap space as leader key
|
||||||
|
vim.api.nvim_set_keymap("", "<Space>", "<Nop>", {noremap=true, silent=true})
|
||||||
|
vim.g.mapleader = " "
|
||||||
|
vim.g.maplocalleader = " "
|
||||||
|
|
||||||
|
-- Unset search pattern register
|
||||||
|
vim.api.nvim_set_keymap("n", "<CR>", ":noh<CR><CR>", {noremap=true, silent=true})
|
||||||
|
|
||||||
|
-- Shuffle lines around
|
||||||
|
vim.api.nvim_set_keymap("n", "<A-j>", ":m .+1<CR>==", {noremap=true})
|
||||||
|
vim.api.nvim_set_keymap("n", "<A-k>", ":m .-2<CR>==", {noremap=true})
|
||||||
|
vim.api.nvim_set_keymap("i", "<A-j>", "<Esc>:m .+1<CR>==gi", {noremap=true})
|
||||||
|
vim.api.nvim_set_keymap("i", "<A-k>", "<Esc>:m .-2<CR>==gi", {noremap=true})
|
||||||
|
vim.api.nvim_set_keymap("v", "<A-j>", ":m '>+1<CR>gv=gv", {noremap=true})
|
||||||
|
vim.api.nvim_set_keymap("v", "<A-k>", ":m '<-2<CR>gv=gv", {noremap=true})
|
||||||
|
|
||||||
|
-- Fzf (fuzzy finder)
|
||||||
|
vim.api.nvim_set_keymap("n", "<Leader>/", ":Rg<CR>", {noremap=true})
|
||||||
|
vim.api.nvim_set_keymap("n", "<Leader>ff", ":Files<CR>", {noremap=true})
|
||||||
|
vim.api.nvim_set_keymap("n", "<Leader>fr", ":History<CR>", {noremap=true})
|
||||||
|
vim.api.nvim_set_keymap("n", "<Leader>b", ":Buffers<CR>", {noremap=true})
|
||||||
|
vim.api.nvim_set_keymap("n", "<Leader>s", ":BLines<CR>", {noremap=true})
|
||||||
|
|
||||||
|
-- File commands
|
||||||
|
vim.api.nvim_set_keymap("n", "<Leader>q", ":quit<CR>", {noremap=true})
|
||||||
|
vim.api.nvim_set_keymap("n", "<Leader>Q", ":quitall<CR>", {noremap=true})
|
||||||
|
vim.api.nvim_set_keymap("n", "<Leader>fs", ":write<CR>", {noremap=true})
|
||||||
|
vim.api.nvim_set_keymap("n", "<Leader>fe", ":!chmod 755 %<CR><CR>", {noremap=true})
|
||||||
|
vim.api.nvim_set_keymap("n", "<Leader>fn", ":!chmod 644 %<CR><CR>", {noremap=true})
|
||||||
|
vim.api.nvim_set_keymap("n", "<Leader>fd", ":lcd %:p:h<CR>", {silent=true, noremap=true})
|
||||||
|
vim.api.nvim_set_keymap("n", "<Leader>fu", ":lcd ..<CR>", {silent=true, noremap=true})
|
||||||
|
vim.api.nvim_set_keymap("n", "<Leader><Tab>", ":b#<CR>", {silent=true, noremap=true})
|
||||||
|
vim.api.nvim_set_keymap("n", "<Leader>gr", ":!gh repo view -w<CR><CR>", {silent=true, noremap=true})
|
||||||
|
vim.api.nvim_set_keymap("n", "<Leader>tt", [[<Cmd>exe 'edit ~/notes/journal/'.strftime("%Y-%m-%d_%a").'.md'<CR>]], {noremap=true})
|
||||||
|
|
||||||
|
-- Window commands
|
||||||
|
vim.api.nvim_set_keymap("n", "<Leader>wv", ":vsplit<CR>", {noremap=true})
|
||||||
|
vim.api.nvim_set_keymap("n", "<Leader>wh", ":split<CR>", {noremap=true})
|
||||||
|
vim.api.nvim_set_keymap("n", "<Leader>wm", ":only<CR>", {noremap=true})
|
||||||
|
|
||||||
|
-- Tabularize
|
||||||
|
vim.api.nvim_set_keymap("", "<Leader>ta", ":Tabularize /", {noremap=true})
|
||||||
|
vim.api.nvim_set_keymap("", "<Leader>t#", ":Tabularize /#<CR>", {noremap=true})
|
||||||
|
vim.api.nvim_set_keymap("", "<Leader>t\"", ":Tabularize /\"<CR>", {noremap=true})
|
||||||
|
|
||||||
|
-- Vimrc
|
||||||
|
vim.api.nvim_set_keymap("n", "<Leader>fv", ":edit $MYVIMRC<CR>", {noremap=true})
|
||||||
|
vim.api.nvim_set_keymap("n", "<Leader>rr", ":luafile $MYVIMRC<CR>", {noremap=true})
|
||||||
|
|
||||||
|
-- Other
|
||||||
|
vim.api.nvim_set_keymap("n", "<Leader><Space>", ":HopWord<CR>", {noremap=true})
|
||||||
|
vim.api.nvim_set_keymap("t", "<A-CR>", "<C-\\><C-n>", {noremap=true}) -- Exit terminal mode
|
||||||
|
vim.api.nvim_set_keymap("n", "<A-CR>", ":noh<CR>", {noremap=true, silent=true})
|
||||||
|
vim.api.nvim_set_keymap('n', 'Y', 'y$', { noremap = true})
|
11
nixos/justfile
Normal file
11
nixos/justfile
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
# Show these options
|
||||||
|
default:
|
||||||
|
@just --list --list-heading $'Update NixOS config:\n'
|
||||||
|
|
||||||
|
# Update the system
|
||||||
|
system:
|
||||||
|
nixos-rebuild switch -I nixos-config=./configuration.nix
|
||||||
|
|
||||||
|
# Update the user environment
|
||||||
|
home:
|
||||||
|
home-manager switch -f ./home.nix
|
3
nixos/todo.txt
Normal file
3
nixos/todo.txt
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
libratbag (ratbagd) for input devices
|
||||||
|
|
||||||
|
inspiration: https://github.com/JonathanReeve/dotfiles/blob/minimal/dotfiles/home.nix
|
Loading…
Reference in New Issue
Block a user