SGNCJXFTNOBCRXUD3Y7OZPWD442RAYDZ2H36QVK6NLOSLO3ZDWCQC {description = "My flake";inputs = {nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";home-manager = {url = "github:nix-community/home-manager";inputs.nixpkgs.follows = "nixpkgs";};plugin-onedark.url = "github:navarasu/onedark.nvim";plugin-onedark.flake = false;};outputs ={ self, nixpkgs, ... }@inputs:letsystem = "x86_64-linux";pkgs = import nixpkgs {inherit system;};in{homeConfigurations."vimjoyer" = inputs.home-manager.lib.homeManagerConfiguration {inherit pkgs;modules = [ ./nixos/home.nix ];extraSpecialArgs = {inherit inputs;};};};}
{config,pkgs,inputs,...}:{home.username = "vimjoyer";home.homeDirectory = "/home/vimjoyer";home.stateVersion = "22.11"; # Please read the comment before changing.nixpkgs = {overlays = [(final: prev: {vimPlugins = prev.vimPlugins // {own-onedark-nvim = prev.vimUtils.buildVimPlugin {name = "onedark";src = inputs.plugin-onedark;};};})];};programs.neovim =lettoLua = str: "lua << EOF\n${str}\nEOF\n";toLuaFile = file: "lua << EOF\n${builtins.readFile file}\nEOF\n";in{enable = true;viAlias = true;vimAlias = true;vimdiffAlias = true;extraPackages = with pkgs; [lua-language-serverrnix-lspxclipwl-clipboard];plugins = with pkgs.vimPlugins; [{plugin = nvim-lspconfig;config = toLuaFile ./nvim/plugin/lsp.lua;}{plugin = comment-nvim;config = toLua "require(\"Comment\").setup()";}{plugin = gruvbox-nvim;config = "colorscheme gruvbox";}neodev-nvimnvim-cmp{plugin = nvim-cmp;config = toLuaFile ./nvim/plugin/cmp.lua;}{plugin = telescope-nvim;config = toLuaFile ./nvim/plugin/telescope.lua;}telescope-fzf-native-nvimcmp_luasnipcmp-nvim-lspluasnipfriendly-snippetslualine-nvimnvim-web-devicons{plugin = (nvim-treesitter.withPlugins (p: [p.tree-sitter-nixp.tree-sitter-vimp.tree-sitter-bashp.tree-sitter-luap.tree-sitter-pythonp.tree-sitter-json]));config = toLuaFile ./nvim/plugin/treesitter.lua;}vim-nix# {# plugin = vimPlugins.own-onedark-nvim;# config = "colorscheme onedark";# }];extraLuaConfig = ''${builtins.readFile ./nvim/options.lua}'';# extraLuaConfig = ''# ${builtins.readFile ./nvim/options.lua}# ${builtins.readFile ./nvim/plugin/lsp.lua}# ${builtins.readFile ./nvim/plugin/cmp.lua}# ${builtins.readFile ./nvim/plugin/telescope.lua}# ${builtins.readFile ./nvim/plugin/treesitter.lua}# ${builtins.readFile ./nvim/plugin/other.lua}# '';};programs.home-manager.enable = true;}
{config,pkgs,inputs,rootPath,...}:{programs.neovim =lettoLua = str: "lua << EOF\n${str}\nEOF\n";toLuaFile = file: "lua << EOF\n${builtins.readFile file}\nEOF\n";configPath = rootPath + /config/nvim;in{enable = true;viAlias = true;vimAlias = true;vimdiffAlias = true;extraPackages = with pkgs; [nilxclipwl-clipboard];plugins = with pkgs.vimPlugins; [{plugin = vim-tmux-navigator;}{plugin = nvim-lspconfig;config = toLuaFile (configPath + /plugin/lsp.lua);}{plugin = comment-nvim;config = toLua "require(\"Comment\").setup()";}{plugin = gruvbox-nvim;config = "colorscheme gruvbox";}neodev-nvimnvim-cmp{plugin = nvim-cmp;config = toLuaFile (configPath + /plugin/cmp.lua);}{plugin = telescope-nvim;config = toLuaFile (configPath + /plugin/telescope.lua);}telescope-fzf-native-nvimcmp_luasnipcmp-nvim-lspluasnipfriendly-snippetslualine-nvimnvim-web-devicons{plugin = (nvim-treesitter.withPlugins (p: [p.tree-sitter-nixp.tree-sitter-vimp.tree-sitter-bashp.tree-sitter-luap.tree-sitter-pythonp.tree-sitter-jsonp.tree-sitter-rust]));config = toLuaFile (configPath + /plugin/treesitter.lua);}vim-nix# {# plugin = vimPlugins.own-onedark-nvim;# config = "colorscheme onedark";# }];extraLuaConfig = ''${builtins.readFile (configPath + /options.lua)}'';# extraLuaConfig = ''# ${builtins.readFile ./nvim/options.lua}# ${builtins.readFile ./nvim/plugin/lsp.lua}# ${builtins.readFile ./nvim/plugin/cmp.lua}# ${builtins.readFile ./nvim/plugin/telescope.lua}# ${builtins.readFile ./nvim/plugin/treesitter.lua}# ${builtins.readFile ./nvim/plugin/other.lua}# '';};}
vim.g.mapleader = ' 'vim.g.maplocalleader = ' 'vim.o.clipboard = 'unnamedplus'vim.o.number = true-- vim.o.relativenumber = truevim.o.signcolumn = 'yes'vim.o.tabstop = 4vim.o.shiftwidth = 4vim.o.updatetime = 300vim.o.termguicolors = truevim.o.mouse = 'a'
local cmp = require('cmp')local luasnip = require('luasnip')require('luasnip.loaders.from_vscode').lazy_load()luasnip.config.setup {}cmp.setup {snippet = {expand = function(args)luasnip.lsp_expand(args.body)end,},mapping = cmp.mapping.preset.insert {['<C-n>'] = cmp.mapping.select_next_item(),['<C-p>'] = cmp.mapping.select_prev_item(),['<C-d>'] = cmp.mapping.scroll_docs(-4),['<C-f>'] = cmp.mapping.scroll_docs(4),['<C-Space>'] = cmp.mapping.complete {},['<CR>'] = cmp.mapping.confirm {behavior = cmp.ConfirmBehavior.Replace,select = true,},['<Tab>'] = cmp.mapping(function(fallback)if cmp.visible() thencmp.select_next_item()elseif luasnip.expand_or_locally_jumpable() thenluasnip.expand_or_jump()elsefallback()endend, { 'i', 's' }),['<S-Tab>'] = cmp.mapping(function(fallback)if cmp.visible() thencmp.select_prev_item()elseif luasnip.locally_jumpable(-1) thenluasnip.jump(-1)elsefallback()endend, { 'i', 's' }),},sources = {{ name = 'nvim_lsp' },{ name = 'luasnip' },},}
local on_attach = function(_, bufnr)local bufmap = function(keys, func)vim.keymap.set('n', keys, func, { buffer = bufnr })endbufmap('<leader>r', vim.lsp.buf.rename)bufmap('<leader>a', vim.lsp.buf.code_action)bufmap('gd', vim.lsp.buf.definition)bufmap('gD', vim.lsp.buf.declaration)bufmap('gI', vim.lsp.buf.implementation)bufmap('<leader>D', vim.lsp.buf.type_definition)bufmap('gr', require('telescope.builtin').lsp_references)bufmap('<leader>s', require('telescope.builtin').lsp_document_symbols)bufmap('<leader>S', require('telescope.builtin').lsp_dynamic_workspace_symbols)bufmap('K', vim.lsp.buf.hover)vim.api.nvim_buf_create_user_command(bufnr, 'Format', function(_)vim.lsp.buf.format()end, {})endlocal capabilities = vim.lsp.protocol.make_client_capabilities()capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities)require('neodev').setup()require('lspconfig').lua_ls.setup {on_attach = on_attach,capabilities = capabilities,root_dir = function()return vim.loop.cwd()end,cmd = { "lua-lsp" },settings = {Lua = {workspace = { checkThirdParty = false },telemetry = { enable = false },},}}
require('telescope').setup({extensions = {fzf = {fuzzy = true, -- false will only do exact matchingoverride_generic_sorter = true, -- override the generic sorteroverride_file_sorter = true, -- override the file sortercase_mode = "smart_case", -- or "ignore_case" or "respect_case"-- the default case_mode is "smart_case"}}})require('telescope').load_extension('fzf')
{"redhat.telemetry.enabled" = "false";"git.openRepositoryInParentFolders" = "never";"workbench.colorTheme" = "Catppuccin Macchiato";"remote.SSH.remotePlatform" = {"192.168.1.73" = "linux";};"dart.debugExternalPackageLibraries" = "false";"dart.debugSdkLibraries" = "false";"jupyter.askForKernelRestart" = "false";"editor.formatOnSave" = "true";"editor.defaultFormatter" = "ms-python.black-formatter";"[rust]" = {"editor.defaultFormatter" = "rust-lang.rust-analyzer";};"supermaven.enableFixWithSupermaven" = "false";"files.readonlyInclude" = {"*/.cargo/registry/src/*/*.rs" = "true";"*/lib/rustlib/src/rust/library/*/*.rs" = "true";};"gruvboxMaterial.darkContrast" = "hard";"gruvboxMaterial.darkWorkbench" = "flat";"sync.gist" = "018a6296ccb3c3c4570c447035e76a38";"sync.autoUpload" = "true";"sync.autoDownload" = "true";"git.autofetch" = "true";"editor.inlayHints.enabled" = "offUnlessPressed";"workbench.activityBar.location" = "hidden";"workbench.iconTheme" = "catppuccin-macchiato";"editor.fontLigatures" = "true";}