feat: started working on nvim config
This commit is contained in:
parent
e1328143a2
commit
860cb11bcc
14
dotfiles/neovim/init.lua
Normal file
14
dotfiles/neovim/init.lua
Normal 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()
|
11
dotfiles/neovim/lua/my/keymaps.lua
Normal file
11
dotfiles/neovim/lua/my/keymaps.lua
Normal 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
|
68
flake.lock
68
flake.lock
|
@ -48,6 +48,37 @@
|
|||
"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": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
|
@ -132,6 +163,22 @@
|
|||
"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": {
|
||||
"inputs": {
|
||||
"agnoster": "agnoster",
|
||||
|
@ -142,9 +189,30 @@
|
|||
"nixos-unstable": "nixos-unstable",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"nixpkgs-unstable": "nixpkgs-unstable",
|
||||
"vim-extra-plugins": "vim-extra-plugins",
|
||||
"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": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
|
|
|
@ -23,6 +23,8 @@
|
|||
|
||||
githubNvimTheme.url = "github:projekt0n/github-nvim-theme";
|
||||
githubNvimTheme.flake = false;
|
||||
|
||||
vim-extra-plugins.url = "github:m15a/nixpkgs-vim-extra-plugins";
|
||||
};
|
||||
|
||||
outputs = inputs@{ self, nixpkgs, home-manager, ... }:
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
# vscodium
|
||||
vscode
|
||||
vim
|
||||
neovim
|
||||
my-neovim
|
||||
# emacs
|
||||
|
||||
# chat apps
|
||||
|
|
14
modules/applications/neovim.nix
Normal file
14
modules/applications/neovim.nix
Normal 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 ];
|
||||
};
|
||||
};
|
||||
}
|
|
@ -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)
|
||||
];
|
||||
}
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
{ system }:
|
||||
{ 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, ... }: {
|
||||
nix.registry.nixpkgs.flake = nixpkgs;
|
||||
nixpkgs.overlays = [
|
||||
vim-extra-plugins.overlay
|
||||
(self: super: {
|
||||
# inherit nixos-unstable;
|
||||
unstable = import nixpkgs-unstable {
|
||||
|
|
14
modules/overlays/neovim.nix
Normal file
14
modules/overlays/neovim.nix
Normal 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
53
oldVimConfig.vim
Normal 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>"
|
Loading…
Reference in a new issue