mirror of
https://github.com/buckley310/nixos-config.git
synced 2024-12-21 19:24:15 +00:00
add lunarvim
This commit is contained in:
parent
2ce76126de
commit
c5c8719dc7
4 changed files with 64 additions and 114 deletions
|
@ -1,45 +1,28 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
{
|
||||
programs.neovim = {
|
||||
enable = true;
|
||||
viAlias = true;
|
||||
vimAlias = true;
|
||||
defaultEditor = true;
|
||||
configure = {
|
||||
packages.sconfig.start = with pkgs.vimPlugins; [
|
||||
airline
|
||||
bufferline-nvim
|
||||
coc-nvim
|
||||
coc-tsserver
|
||||
nerdtree
|
||||
nerdtree-git-plugin
|
||||
vim-autoformat
|
||||
vim-code-dark
|
||||
vim-devicons
|
||||
vim-gitgutter
|
||||
vim-nix
|
||||
vim-startify
|
||||
vim-terraform
|
||||
] ++
|
||||
# skip syntax-highlight on nixos 23.05
|
||||
lib.optional
|
||||
(vim-nerdtree-syntax-highlight.version != "2021-01-11")
|
||||
(vim-nerdtree-syntax-highlight);
|
||||
environment.variables.EDITOR = "vim";
|
||||
|
||||
customRC = ''
|
||||
source ${./init.vim}
|
||||
luafile ${./init.lua}
|
||||
if filereadable(expand("~/.config/nvim/init.vim"))
|
||||
source ~/.config/nvim/init.vim
|
||||
endif
|
||||
'';
|
||||
};
|
||||
};
|
||||
environment.etc."lvim.lua".source = ./init.lua;
|
||||
|
||||
environment.etc."my-settings.sh".text = ''
|
||||
mkdir -p ~/.config/lvim
|
||||
echo 'vim.cmd("luafile /etc/lvim.lua")' >~/.config/lvim/config.lua
|
||||
'';
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
lunarvim
|
||||
nodePackages.prettier
|
||||
|
||||
(writeShellScriptBin "black" ''
|
||||
exec ${pkgs.python3.pkgs.black}/bin/black "$@"
|
||||
'')
|
||||
|
||||
(writeShellScriptBin "vi" ''
|
||||
exec lvim "$@"
|
||||
'')
|
||||
|
||||
(writeShellScriptBin "vim" ''
|
||||
exec lvim "$@"
|
||||
'')
|
||||
];
|
||||
}
|
||||
|
|
|
@ -1,5 +1,20 @@
|
|||
require("bufferline").setup {
|
||||
options = {
|
||||
separator_style = "slant"
|
||||
}
|
||||
lvim.format_on_save = true
|
||||
|
||||
vim.opt.relativenumber = true
|
||||
vim.opt.shiftwidth = 4
|
||||
vim.opt.tabstop = 4
|
||||
vim.opt.whichwrap = ""
|
||||
|
||||
local formatters = require "lvim.lsp.null-ls.formatters"
|
||||
formatters.setup {
|
||||
{ exe = "nixpkgs-fmt", filetypes = { "nix" } },
|
||||
{ exe = "black", filetypes = { "python" } },
|
||||
{
|
||||
name = "prettier",
|
||||
filetypes = {
|
||||
"json",
|
||||
"typescript",
|
||||
"yaml"
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
|
@ -1,76 +0,0 @@
|
|||
"misc
|
||||
set mouse=
|
||||
set encoding=utf-8
|
||||
set number relativenumber
|
||||
set list listchars=tab:\|\ ,trail:-
|
||||
set nowrap
|
||||
set scrolloff=9
|
||||
set tabstop=4
|
||||
set shiftwidth=4
|
||||
|
||||
set termguicolors
|
||||
colorscheme codedark
|
||||
|
||||
nnoremap <space>H :call CocActionAsync('doHover')<cr>
|
||||
|
||||
|
||||
"configure plugins
|
||||
let g:gitgutter_sign_removed = "\uE0B8"
|
||||
let g:gitgutter_sign_removed_first_line = "\uE0BC"
|
||||
let g:gitgutter_sign_modified_removed = '~~'
|
||||
set updatetime=500
|
||||
|
||||
let g:startify_custom_header = "''"
|
||||
let g:startify_custom_indices = map(range(1,100), 'string(v:val)')
|
||||
|
||||
let NERDTreeMinimalUI=1
|
||||
let g:NERDTreeExtensionHighlightColor = {}
|
||||
let g:NERDTreeExtensionHighlightColor['nix'] = "689FB6"
|
||||
let g:NERDTreeExtensionHighlightColor['tf'] = "834F79"
|
||||
|
||||
let g:WebDevIconsUnicodeDecorateFileNodesExtensionSymbols = {}
|
||||
let g:WebDevIconsUnicodeDecorateFileNodesExtensionSymbols['tf'] = "\uE69A"
|
||||
|
||||
|
||||
"auto formatting
|
||||
let g:formatters_python = ['black']
|
||||
|
||||
let g:formatdef_nixpkgsfmt="'nixpkgs-fmt'"
|
||||
let g:formatters_nix = ['nixpkgsfmt']
|
||||
|
||||
let g:formatdef_prettier="'prettier --stdin-filepath ' . expand('%:p')"
|
||||
let g:formatters_js = ['prettier']
|
||||
let g:formatters_json = ['prettier']
|
||||
let g:formatters_ts = ['prettier']
|
||||
let g:formatters_yaml = ['prettier']
|
||||
|
||||
autocmd BufWritePre * :Autoformat
|
||||
|
||||
|
||||
"menus
|
||||
nnoremap <silent> <space>e :NERDTreeFocus<CR>:vertical resize 31<CR>
|
||||
nnoremap <silent> <space>o :Startify<CR>
|
||||
|
||||
|
||||
"buffers
|
||||
nnoremap <silent> <space>w :q<CR>
|
||||
nnoremap <silent> <space>q :bd<CR>
|
||||
nnoremap <silent> <space>d :bnext<CR>
|
||||
nnoremap <silent> <space>a :bprevious<CR>
|
||||
|
||||
tnoremap <C-x> <C-\><C-n>
|
||||
|
||||
|
||||
"window shortcuts
|
||||
nnoremap <space>h <C-W>h
|
||||
nnoremap <space>j <C-W>j
|
||||
nnoremap <space>k <C-W>k
|
||||
nnoremap <space>l <C-W>l
|
||||
|
||||
nnoremap <space><left> <C-W>h
|
||||
nnoremap <space><down> <C-W>j
|
||||
nnoremap <space><up> <C-W>k
|
||||
nnoremap <space><right> <C-W>l
|
||||
|
||||
nnoremap <space>v <C-W>v
|
||||
nnoremap <space>s <C-W>s
|
28
pkgs/lunarvim.nix
Normal file
28
pkgs/lunarvim.nix
Normal file
|
@ -0,0 +1,28 @@
|
|||
#
|
||||
# https://github.com/NixOS/nixpkgs/pull/257063
|
||||
#
|
||||
|
||||
{ pkgs }:
|
||||
(
|
||||
(
|
||||
pkgs.callPackage
|
||||
(pkgs.fetchurl {
|
||||
url = "https://raw.githubusercontent.com/NixOS/nixpkgs/266e0f99a483d8e699f32b050c55981fd950de70/pkgs/by-name/lu/lunarvim/package.nix";
|
||||
sha256 = "fa44f06a517c686d181f35ee255d4e0c00c6f52473cf1a3b9586c4e511efb7d7";
|
||||
})
|
||||
{ }
|
||||
|
||||
).overrideAttrs (_: {
|
||||
patches = [
|
||||
(
|
||||
pkgs.fetchurl {
|
||||
url = "https://github.com/LunarVim/LunarVim/commit/d187cbd03fbc8bd1b59250869e0e325518bf8798.patch";
|
||||
sha256 = "00677d3d5a4882d7ee5709e0494a5d8f7c58cea8bdcf467ce59222f9cc493366";
|
||||
}
|
||||
)
|
||||
];
|
||||
})
|
||||
|
||||
).override (_: {
|
||||
python3.withPackages = _: pkgs.emptyDirectory;
|
||||
})
|
Loading…
Reference in a new issue