1
Fork 0

feat: started working on nvim config

This commit is contained in:
Matei Adriel 2022-01-30 20:10:57 +02:00
parent e1328143a2
commit 860cb11bcc
10 changed files with 186 additions and 3 deletions

14
dotfiles/neovim/init.lua Normal file
View file

@ -0,0 +1,14 @@
local cmd = vim.cmd -- to execute Vim commands e.g. cmd('pwd')
local fn = vim.fn -- to call Vim functions e.g. fn.bufnr()
local g = vim.g -- a table to access global variables
local opt = vim.opt -- to set options
-- Basic options
opt.number = true -- Show line numbers
opt.relativenumber = true -- Relative line numbers
-- Set theme
require('github-theme').setup()
-- Import my other files
require('my.keymaps').setup()

View file

@ -0,0 +1,11 @@
local M = {}
local function map(mode, lhs, rhs, opts)
local options = {noremap = true}
if opts then options = vim.tbl_extend('force', options, opts) end
vim.api.nvim_set_keymap(mode, lhs, rhs, options)
end
function M.setup()
map("i", "jj", "<Esc>") -- Remap Esc to
end

View file

@ -48,6 +48,37 @@
"type": "github" "type": "github"
} }
}, },
"flake-compat": {
"flake": false,
"locked": {
"lastModified": 1641205782,
"narHash": "sha256-4jY7RCWUoZ9cKD8co0/4tFARpWB+57+r1bLLvXNJliY=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "b7547d3eed6f32d06102ead8991ec52ab0a4f1a7",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"flake-utils": {
"locked": {
"lastModified": 1638122382,
"narHash": "sha256-sQzZzAbvKEqN9s0bzWuYmRaA03v40gaJ4+iL1LXjaeI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "74f7e4319258e287b0f9cb95426c9853b282730b",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"githubNvimTheme": { "githubNvimTheme": {
"flake": false, "flake": false,
"locked": { "locked": {
@ -132,6 +163,22 @@
"type": "github" "type": "github"
} }
}, },
"nixpkgs_2": {
"locked": {
"lastModified": 1642130244,
"narHash": "sha256-/5FhZkZFQCRQIRFosUQW1zmDrsNHVOJIB/+XgRPHiPU=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "bc59ba15b64d0a0ee1d1764f18b4f3480d2c3e5a",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": { "root": {
"inputs": { "inputs": {
"agnoster": "agnoster", "agnoster": "agnoster",
@ -142,9 +189,30 @@
"nixos-unstable": "nixos-unstable", "nixos-unstable": "nixos-unstable",
"nixpkgs": "nixpkgs", "nixpkgs": "nixpkgs",
"nixpkgs-unstable": "nixpkgs-unstable", "nixpkgs-unstable": "nixpkgs-unstable",
"vim-extra-plugins": "vim-extra-plugins",
"z": "z" "z": "z"
} }
}, },
"vim-extra-plugins": {
"inputs": {
"flake-compat": "flake-compat",
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs_2"
},
"locked": {
"lastModified": 1643552572,
"narHash": "sha256-D7VC0Fp1a7+E03D3NuZNNXO4T44UWOVNBDK1fuKVQD4=",
"owner": "m15a",
"repo": "nixpkgs-vim-extra-plugins",
"rev": "fbc282994561119dd67bdc40566a67a5584ac6b2",
"type": "github"
},
"original": {
"owner": "m15a",
"repo": "nixpkgs-vim-extra-plugins",
"type": "github"
}
},
"z": { "z": {
"flake": false, "flake": false,
"locked": { "locked": {

View file

@ -23,6 +23,8 @@
githubNvimTheme.url = "github:projekt0n/github-nvim-theme"; githubNvimTheme.url = "github:projekt0n/github-nvim-theme";
githubNvimTheme.flake = false; githubNvimTheme.flake = false;
vim-extra-plugins.url = "github:m15a/nixpkgs-vim-extra-plugins";
}; };
outputs = inputs@{ self, nixpkgs, home-manager, ... }: outputs = inputs@{ self, nixpkgs, home-manager, ... }:

View file

@ -34,7 +34,7 @@
# vscodium # vscodium
vscode vscode
vim vim
neovim my-neovim
# emacs # emacs
# chat apps # chat apps

View file

@ -0,0 +1,14 @@
{ wrapNeovim, neovim, tree-sitter, config-nvim, vimPlugins, vimExtraPlugins }:
wrapNeovim neovim {
configure = {
customRC = ''
let g:disable_paq = v:true
luafile ${config-nvim}/init.lua
'';
packages.default = with vimExtraPlugins; {
start = [ config-nvim vimExtraPlugins.github-nvim-theme ];
};
};
}

View file

@ -1 +1,7 @@
{ pkgs, ... }: { nixpkgs.overlays = [ (import ./tweakSources.nix) ]; } { pkgs, ... }: {
nixpkgs.overlays = [
(import ./tweakSources.nix)
# neovim with my own config baked in
(import ./neovim.nix)
];
}

View file

@ -1,9 +1,10 @@
{ system }: { system }:
{ home-manager, nixpkgs, nixpkgs-unstable, nixos-unstable, easy-purescript-nix { home-manager, nixpkgs, nixpkgs-unstable, nixos-unstable, easy-purescript-nix
, easy-dhall-nix, z, agnoster, githubNvimTheme, ... }: , easy-dhall-nix, z, agnoster, githubNvimTheme, vim-extra-plugins, ... }:
({ pkgs, ... }: { ({ pkgs, ... }: {
nix.registry.nixpkgs.flake = nixpkgs; nix.registry.nixpkgs.flake = nixpkgs;
nixpkgs.overlays = [ nixpkgs.overlays = [
vim-extra-plugins.overlay
(self: super: { (self: super: {
# inherit nixos-unstable; # inherit nixos-unstable;
unstable = import nixpkgs-unstable { unstable = import nixpkgs-unstable {

View file

@ -0,0 +1,14 @@
final: prev:
let
config-nvim = final.vimUtils.buildVimPluginFrom2Nix {
name = "config-nvim";
src = ../../dotfiles/neovim;
};
in {
my-neovim = final.callPackage ../applications/neovim.nix {
neovim = final.neovim-nightly;
inherit config-nvim;
};
}

53
oldVimConfig.vim Normal file
View file

@ -0,0 +1,53 @@
" Rebind esc to pressing j twice
:imap jj <Esc>
" Indentation stuff
filetype plugin indent on
set tabstop=2
set shiftwidth=2
set expandtab
" Line numbers
:set relativenumber
:set rnu
" Plugins
call plug#begin('~/.vim/plugged')
Plug 'lervag/vimtex'
" Autocompletion engine
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
" A Vim Plugin for Lively Previewing LaTeX PDF Output
Plug 'xuhdev/vim-latex-live-preview', { 'for': 'tex' }
Plug 'jiangmiao/auto-pairs'
call plug#end()
" ========== Latext setup
" Activate deoplete
let g:deoplete#enable_at_startup = 1
" Minimum character length needed to activate auto-completion.
call deoplete#custom#option('min_pattern_length', 1)
" use fuzzy matcher
call deoplete#custom#source('_', 'matchers', ['matcher_full_fuzzy'])
" Latex autocompletion
call deoplete#custom#var('omni', 'input_patterns', {
\ 'tex': g:vimtex#re#deoplete
\})
let g:latex_view_general_viewer = "zathura"
let g:vimtex_view_method = "zathura"
au FileType tex let b:AutoPairs = AutoPairsDefine({'$' : '$'}, [])
let g:vimtex_compiler_progname = 'nvr'
" deoplete tab-complete
inoremap <expr><tab> pumvisible() ? "\<c-n>" : "\<tab>"