Major NVIM refactor (ty fire :3)

This commit is contained in:
stitchy 2024-11-03 12:23:54 +00:00
parent e1aa67dbb2
commit d73ecb1bdb
Signed by: stitchy
SSH key fingerprint: SHA256:yz2SoxdnY67tfY5Jzb0f2v8f5W3o/IF359kbcquWip8
8 changed files with 274 additions and 182 deletions

View file

@ -88,6 +88,7 @@ dwindle {
misc {
layers_hog_keyboard_focus=true
middle_click_paste=true
vfr=1
vrr=on
disable_hyprland_logo=true

View file

@ -1,155 +1,28 @@
" (Neo)vim Configuration
" By Flying_Stitchman
" 4 Jan 2022
" (Neo)vim Configuration
" By Flying_Stitchman 4 Jan 2022
" Basic Configuration
syntax on
set spell
set hlsearch
set ignorecase
set number relativenumber
set noswapfile
" Move this to the keymap file at some point later
inoremap jk <ESC>
xnoremap gy "+y
let mapleader = "`"
let mapleader = " "
" fast move
noremap J 6j
noremap K 6k
noremap H <Cmd>BufferLineCyclePrev<CR>
noremap L <Cmd>BufferLineCycleNext<CR>
" Moving between windows
noremap <C-h> <C-w>h
noremap <C-j> <C-w>j
noremap <C-k> <C-w>k
noremap <C-l> <C-w>l
" fix it
noremap gh K
noremap M J
tnoremap <Esc> <C-\><C-n>
" Good indents "
set tabstop=2
set shiftwidth=2
set expandtab
" Make Lines Wrap Properly
set linebreak
set wrap
" True Color Support
if has('nvim')
set t_8f=[38;2;%lu;%lu;%lum
set t_8b=[48;2;%lu;%lu;%lum
set termguicolors
endif
"colorscheme cwcolors
" Highlight Trailing Spaces
let c_space_errors=1
set noincsearch
" Plugs
"call plug#begin()
"Plug 'neovim/nvim-lspconfig'
"Plug 'jackguo380/vim-lsp-cxx-highlight'
"Plug 'folke/tokyonight.nvim', { 'branch': 'main' }
"Plug 'tribela/vim-transparent'
"Plug 'hrsh7th/nvim-cmp'
"Plug 'hrsh7th/cmp-nvim-lsp'
"Plug 'saadparwaiz1/cmp_luasnip'
"Plug 'L3MON4D3/LuaSnip'
"call plug#end()
let g:airline#extensions#wordcount#filetypes = '\vasciidoc|help|mail|markdown|markdown.pandoc|org|rst|tex|text'
set laststatus=2 " enables vim-airline.
" C Syntax highlighting
lua << EOF
require'lspconfig'.rust_analyzer.setup{}
require'lspconfig'.texlab.setup{}
require'lspconfig'.svls.setup{}
require'lspconfig'.pylsp.setup{
settings = {
pylsp = {
plugins = {
pycodestyle = {
ignore = {'W391'},
maxLineLength = 100
},
pylint = {
enabled = false
},
pyflakes = {
enabled = true
}
}
}
}
}
require'lspconfig'.ccls.setup{
init_options = {
highlight = {
lsRanges = true;
}
}
}
-- Add additional capabilities supported by nvim-cmp
local capabilities = require("cmp_nvim_lsp").default_capabilities()
local lspconfig = require('lspconfig')
-- Enable some language servers with the additional completion capabilities offered by nvim-cmp
local servers = { 'clangd', 'rust_analyzer', 'tsserver' }
for _, lsp in ipairs(servers) do
lspconfig[lsp].setup {
-- on_attach = my_custom_on_attach,
capabilities = capabilities,
}
end
-- luasnip setup
local luasnip = require 'luasnip'
-- nvim-cmp setup
local cmp = require 'cmp'
cmp.setup {
snippet = {
expand = function(args)
luasnip.lsp_expand(args.body)
end,
},
mapping = cmp.mapping.preset.insert({
['<C-u>'] = cmp.mapping.scroll_docs(-4), -- Up
['<C-d>'] = cmp.mapping.scroll_docs(4), -- Down
-- C-b (back) C-f (forward) for snippet placeholder navigation.
['<C-Space>'] = cmp.mapping.complete(),
['<CR>'] = cmp.mapping.confirm {
behavior = cmp.ConfirmBehavior.Replace,
select = true,
},
['<Tab>'] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif luasnip.expand_or_jumpable() then
luasnip.expand_or_jump()
else
fallback()
end
end, { 'i', 's' }),
['<S-Tab>'] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif luasnip.jumpable(-1) then
luasnip.jump(-1)
else
fallback()
end
end, { 'i', 's' }),
}),
sources = {
{ name = 'nvim_lsp' },
{ name = 'luasnip' },
},
}
EOF
" Color Themes
colorscheme tokyonight
hi Comment guifg=#e69dc5
hi Linenr guifg=#a672f3
" nvim builtin option config
luafile /etc/nixos/config/nvim/lua/options.lua
" nvim keymapping
luafile /etc/nixos/config/nvim/lua/keymap.lua
" Main Config stuffs
luafile /etc/nixos/config/nvim/nvim.lua

View file

@ -0,0 +1,39 @@
-- Options File
local opt = vim.opt
-- Basic Options I like
opt.hlsearch = true
opt.ignorecase = true
opt.relativenumber = true
opt.spell = true
opt.swapfile = false
opt.syntax = "on"
-- Had this disabled before might not like
opt.incsearch = true
-- 24-bit color
opt.termguicolors = true
-- Good indents
opt.tabstop = 2
opt.shiftwidth = 2
opt.expandtab = true
-- Show trailing whitespace but fancy
opt.list = true
opt.listchars = {
tab = "",
trail = "",
nbsp = "",
}
-- Make Lines Wrap Properly
opt.linebreak = true
opt.wrap = true
-- Colors
vim.cmd("colorscheme tokyonight")
vim.cmd("hi Comment guifg=#e69dc5")
vim.cmd("hi Linenr guifg=#a672f3")

147
config/nvim/nvim.lua Normal file
View file

@ -0,0 +1,147 @@
-- This will need some refactoring as it is mostly a
-- copy and paste from the previous single-file .vim config
require'lspconfig'.rust_analyzer.setup{}
require'lspconfig'.texlab.setup{}
require'lspconfig'.svls.setup{}
require'lspconfig'.pylsp.setup{
settings = {
pylsp = {
plugins = {
pycodestyle = {
ignore = {'W391'},
maxLineLength = 100
},
pylint = {
enabled = false
},
pyflakes = {
enabled = true
}
}
}
}
}
require'lspconfig'.ccls.setup{
init_options = {
highlight = {
lsRanges = true;
}
}
}
-- Add additional capabilities supported by nvim-cmp
local capabilities = require("cmp_nvim_lsp").default_capabilities()
local lspconfig = require('lspconfig')
-- Enable some language servers with the additional completion capabilities offered by nvim-cmp
local servers = { 'clangd', 'rust_analyzer', 'ts_ls', 'typst_lsp', 'vhdl_ls' }
for _, lsp in ipairs(servers) do
lspconfig[lsp].setup {
-- on_attach = my_custom_on_attach,
capabilities = capabilities,
}
end
-- luasnip setup
local luasnip = require 'luasnip'
-- nvim-cmp setup
local cmp = require 'cmp'
cmp.setup {
snippet = {
expand = function(args)
luasnip.lsp_expand(args.body)
end,
},
mapping = cmp.mapping.preset.insert({
['<C-u>'] = cmp.mapping.scroll_docs(-4), -- Up
['<C-d>'] = cmp.mapping.scroll_docs(4), -- Down
-- C-b (back) C-f (forward) for snippet placeholder navigation.
['<C-Space>'] = cmp.mapping.complete(),
['<CR>'] = cmp.mapping.confirm {
behavior = cmp.ConfirmBehavior.Replace,
select = true,
},
['<Tab>'] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif luasnip.expand_or_jumpable() then
luasnip.expand_or_jump()
else
fallback()
end
end, { 'i', 's' }),
['<S-Tab>'] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif luasnip.jumpable(-1) then
luasnip.jump(-1)
else
fallback()
end
end, { 'i', 's' }),
}),
sources = {
{ name = 'nvim_lsp' },
{ name = 'luasnip' },
},
}
--[[
u.-*'M'*-.u
x` _____ `x
o` _| ___| `o
, | |___ ,
3 |_ | E
' | _ | '
o, |_| |_| ,o
x". ."x
n"--.W.--"n
Kiloroy Was Here
]]
package.path = package.path .. ";/etc/nixos/config/nvim"
-- Funky plugins
require("bufferline").setup({ options = {
always_show_bufferline = true,
show_buffer_close_icons = false,
separator_style = "slope",
style_preset = {
require("bufferline").style_preset.no_italic,
},
offsets = {
{
filetype = "neo-tree",
text = "File Explorer",
highlight = "Directory",
text_align = "left",
},
},
},})
require("ibl").setup()
require("gitsigns").setup()
require("which-key").setup({ global = false })
require("telescope").setup()
require("neo-tree").setup()
require("spaceman").setup({
workspaces = {
"/etc/nixos",
{ "config", "/etc/nixos/config/" },
{ "home", "~/" },
},
directories = {
"~/Documents/Classes",
"~/Documents/Repos",
},
use_default_keymaps = true,
hooks = {
before_move = "Neotree close",
}
})
vim.keymap.set("n", "<leader>e", function()
require("neo-tree.command").execute({ action = "show", position = "right", toggle = true, dir = vim.loop.cwd() })
end, { desc = "Open Neotree", remap = true })

View file

@ -17,6 +17,10 @@ alias kon="ncmpcpp -b ~/.config/ncmpcpp/bindings"
alias myip="curl ifconfig.me"
alias ghidra="_JAVA_AWT_WM_NONREPARENTING=1 ghidra"
alias ls='eza'
alias l='ls -l'
alias la='ls -la'
alias ll='ls -l'
alias lla='ls -la'
alias v="nvim" # Launch neovim with 'v'
alias mountUSB="mount /home/flyingstitchman/ExternalDrive" # Automagically mount and unmount my flashdrive
alias umountUSB="umount /home/flyingstitchman/ExternalDrive"
@ -31,6 +35,15 @@ alias tree="eza --tree"
alias icat="kitty +kitten icat"
alias qsus="NIXPKGS_ALLOW_UNFREE=1 nix-shell -p quartus-prime-lite -I nixpkgs=https://github.com/NixOS/nixpkgs/archive/fe7ab74a86d78ba00d144aa7a8da8c71a200c563.tar.gz"
# thanks fire :3
alias c='clear'
alias lg='lazygit'
# Future fire, this is for a meme.
nya() {
args=$(echo $@ | sed 's/nya/git/g')
git $args 2>&1 >/dev/null | sed 's/git/nya/g' | sed 's/GIT/NYA/g' | sed 's/Git/Nya/g'
}
# Automatically get new programs for autocompletion
zshcache_time="$(date +%s%N)"
@ -97,9 +110,7 @@ export EDITOR=nvim
#export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket)
export PATH="${PATH}:/home/flyingstitchman/.cargo/bin"
# Ibus
GTK_IM_MODULE=fcitx
QT_IM_MODULE=fcitx
# Fcitx for Xwayland
XMODIFIERS=@im=fcitx
# Clean Up

View file

@ -15,33 +15,40 @@ let
"megapixels"
] pkgs;
pcPkgs = lib.attrVals [
#osu-lazer
"dracula-theme"
"wl-clipboard"
"brightnessctl"
"clipman"
"powertop"
"easyeffects"
"mutt-wizard"
"gamescope"
"cyrus-sasl-xoauth2"
"dracula-theme"
"easyeffects"
"gamescope"
"libnotify"
"networkmanager-openvpn"
"mutt-wizard"
"powertop"
"wl-clipboard"
# temporary home manager things
"eww"
"ifuse"
"img2pdf"
"inotify-tools"
"eww"
"jq"
"pandoc"
#"texliveFull"
"typst"
"socat"
"libimobiledevice"
"ifuse"
] pkgs ++ [ inputs.osu-nixos pkgs.wineWowPackages.stableFull ];
"socat"
"typst"
] pkgs ++ [ pkgs.wineWowPackages.stableFull ];
serverPkgs = lib.attrVals [
#"package"
] pkgs;
spaceman-nvim = pkgs.vimUtils.buildVimPlugin {
name = "spaceman-nvim";
src = pkgs.fetchFromGitHub {
owner = "FireIsGood";
repo = "spaceman.nvim";
rev = "7910d202073bcc5f567481426f771b3737451dd9";
hash = "sha256-VvKce2uiFzv0TjoJfEX461p9tY9aE237Xr1q/Lw3Utw=";
};
};
in
{
options = {
@ -64,11 +71,14 @@ in
"glib"
"gnumake"
"gnupg"
"neofetch"
"p7zip"
"pinentry"
"neofetch"
"typst-lsp"
"unzip"
"vhdl-ls"
"wget"
"zip"
"zoxide"
] pkgs)
++ (lib.optionals config.stitchyconf.artPkgs.enable artPkgs)
@ -87,14 +97,22 @@ in
customRC = builtins.readFile ../config/nvim/init.vim;
packages.myVimPackage = with pkgs.vimPlugins; {
start = [
nvim-lspconfig
nvim-cmp
bufferline-nvim
cmp-nvim-lsp
luasnip
cmp_luasnip
gitsigns-nvim
indent-blankline-nvim
lazy-nvim
luasnip
neo-tree-nvim
nvim-cmp
nvim-lspconfig
spaceman-nvim
telescope-nvim
tokyonight-nvim
vim-lsp-cxx-highlight
typst-vim
vim-lsp-cxx-highlight
which-key-nvim
];
};
};

View file

@ -8,9 +8,12 @@
"nvidia-settings"
"nvidia-x11"
"osu-lazer"
"quartus-prime-lite"
"quartus-prime-lite-unwrapped"
"steam"
"steam-original"
"steam-run"
"steam-unwrapped"
];
nixpkgs.config.permittedInsecurePackages = [
"olm-3.2.16"
@ -23,11 +26,12 @@
programs = {
firefox.enable = true;
hyprland.enable = true;
openvpn3.enable = true;
kdeconnect.enable = true;
steam = {
enable = true;
remotePlay.openFirewall = true;
};
wireshark.enable = true;
};
security.pam.services.swaylock = {};

View file

@ -11,17 +11,18 @@ let
] pkgs;
pcPkgs = lib.attrVals [
"activitywatch"
"awatcher"
"anki"
"awatcher"
"dunst"
"foliate"
"foot"
"grim"
"hunspell"
"hyprpaper"
"imv"
"isync"
"kitty"
"hunspell"
"hyprpaper"
"lazygit"
"libreoffice"
"librewolf"
"lynx"
@ -33,14 +34,13 @@ let
"notmuch"
"okular"
"osu-lazer"
"pavucontrol"
"pass"
"pavucontrol"
"playerctl"
"prismlauncher"
"pstree"
"qt5ct"
"qt6ct"
"qbittorrent"
"qt6ct"
"slurp"
"swaylock-effects"
"tofi"
@ -63,7 +63,6 @@ in
usbutils
yt-dlp
(python311.withPackages (lib.attrVals [ "matplotlib" "python-lsp-server" "sympy"]))
#(octaveFull.withPackages (lib.attrVals ["symbolic"]))
]
++ (lib.optionals (nixosConfig.stitchyconf.form == "handheld") handheldPkgs)
++ (lib.optionals (nixosConfig.stitchyconf.form == "pc") pcPkgs);