add %update feature to kitaab, and move to nightly
This commit is contained in:
parent
c932240a83
commit
71b0502b3a
|
@ -19,6 +19,55 @@ let
|
|||
sha256 = "rs3NTZwWdsmBGXnrgUeVxUiNjbN/ULxJHifPYJD9mT4=";
|
||||
};
|
||||
};
|
||||
nvim-luapad = pkgs.vimUtils.buildVimPluginFrom2Nix {
|
||||
name = "nvim-luapad";
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "rafcamlet";
|
||||
repo = "nvim-luapad";
|
||||
rev = "9815e2659ce8e2ef4b55e401531cf09b6423e0ea";
|
||||
sha256 = "gMaS5YFi3+gmUIfkCMEt9vhm8XSgv54Cquv5+WCWeTo=";
|
||||
};
|
||||
};
|
||||
leap = pkgs.vimUtils.buildVimPluginFrom2Nix {
|
||||
name = "leap";
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "ggandor";
|
||||
repo = "leap.nvim";
|
||||
rev = "1bb1fec369b1e9ae96e6ff1b829ea9272c51f844";
|
||||
sha256 = "dH0v1D5q5OlMLA/omTDMb/taKyIgQ5VfVMYXJ609k/k=";
|
||||
};
|
||||
};
|
||||
nvim-navic = pkgs.vimUtils.buildVimPlugin {
|
||||
name = "nvim-navic";
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "SmiteshP";
|
||||
repo = "nvim-navic";
|
||||
rev = "096b23e73c84a653fd317c0c10261875fa573a6d";
|
||||
sha256 = "vX7ZVJxgatIicmijehtaRvyHxk1i4gFfXrbPM/+VoFc=";
|
||||
};
|
||||
};
|
||||
my-lualine-nvim = pkgs.vimUtils.buildVimPluginFrom2Nix {
|
||||
pname = "lualine.nvim";
|
||||
version = "2022-05-13";
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "nvim-lualine";
|
||||
repo = "lualine.nvim";
|
||||
rev = "a4e4517ac32441dd92ba869944741f0b5f468531";
|
||||
sha256 = "18q935aicddai7j99ln61wz1di6lhwzs11x8fxgq704kfap1l2fj";
|
||||
};
|
||||
meta.homepage = "https://github.com/nvim-lualine/lualine.nvim/";
|
||||
};
|
||||
my-which-key-nvim = pkgs.vimUtils.buildVimPluginFrom2Nix {
|
||||
pname = "which-key.nvim";
|
||||
version = "2022-05-04";
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "folke";
|
||||
repo = "which-key.nvim";
|
||||
rev = "bd4411a2ed4dd8bb69c125e339d837028a6eea71";
|
||||
sha256 = "0vf685xgdb967wmvffk1pfrvbhg1jkvzp1kb7r0vs90mg8gpv1aj";
|
||||
};
|
||||
meta.homepage = "https://github.com/folke/which-key.nvim/";
|
||||
};
|
||||
};
|
||||
|
||||
my-python-packages = python-packages: with python-packages; [
|
||||
|
@ -39,12 +88,19 @@ in
|
|||
k = "cd ~/kitaab/vimwiki; vim -c :VimwikiIndex; cd $OLDPWD";
|
||||
kz = "cd ~/kitaab/vimwiki; vim -c :VimwikiIndex -c :ZettelNew; cd $OLDPWD";
|
||||
};
|
||||
# Add %update to the highlight clause for vimwiki files
|
||||
home.file.".config/nvim/after/syntax/vimwiki.vim".text = ''
|
||||
" match with %update
|
||||
syntax match VimwikiPlaceholder /^\s*%update\ze\%(\s.*\)\?$/ nextgroup=VimwikiPlaceholderParam skipwhite
|
||||
'';
|
||||
|
||||
#environment.systemPackages = with customPlugins; [ tidal ];
|
||||
programs.neovim = {
|
||||
enable = true;
|
||||
|
||||
extraConfig = ''
|
||||
" so our custom files still get included
|
||||
set runtimepath+=/home/anish/.config/nvim/
|
||||
set tabstop=2
|
||||
set showmatch
|
||||
set shiftwidth=2
|
||||
|
@ -61,7 +117,6 @@ in
|
|||
set showtabline=2
|
||||
set noexpandtab
|
||||
set autowriteall
|
||||
syntax on
|
||||
set list lcs=tab:\|\
|
||||
filetype plugin on
|
||||
|
||||
|
@ -90,6 +145,9 @@ in
|
|||
" always show signcolumns
|
||||
set signcolumn=yes
|
||||
|
||||
let mapleader = "\<Space>"
|
||||
let maplocalleader = ","
|
||||
|
||||
" window
|
||||
nmap <leader>wh :topleft vnew<CR>
|
||||
nmap <leader>wl :botright vnew<CR>
|
||||
|
@ -100,9 +158,6 @@ in
|
|||
nmap <leader>rt :retab!<CR>
|
||||
vmap <leader>rt :retab!<CR>
|
||||
|
||||
let mapleader = "\<Space>"
|
||||
let maplocalleader = ","
|
||||
|
||||
" moving splits with vim movements.
|
||||
:tnoremap <A-h> <C-\><C-N><C-w>h
|
||||
:tnoremap <A-j> <C-\><C-N><C-w>j
|
||||
|
@ -421,11 +476,25 @@ in
|
|||
|
||||
-- Setup lspconfig
|
||||
require("lsp-format").setup {}
|
||||
require("nvim-navic").setup {}
|
||||
local format = require("lsp-format")
|
||||
local navic = require("nvim-navic")
|
||||
|
||||
local capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities())
|
||||
require('lspconfig').clojure_lsp.setup {on_attach = require "lsp-format".on_attach}
|
||||
require('lspconfig').rnix.setup {on_attach = require "lsp-format".on_attach}
|
||||
require('lspconfig').pylsp.setup {on_attach = require "lsp-format".on_attach,
|
||||
require('lspconfig').clojure_lsp.setup {
|
||||
on_attach = function(client, bufnr)
|
||||
format.on_attach()
|
||||
navic.attach(client, bufnr)
|
||||
end
|
||||
}
|
||||
require('lspconfig').rnix.setup {
|
||||
on_attach = require "lsp-format".on_attach
|
||||
}
|
||||
require('lspconfig').terraform_lsp.setup {
|
||||
on_attach = require "lsp-format".on_attach
|
||||
}
|
||||
require('lspconfig').pylsp.setup {
|
||||
on_attach = require "lsp-format".on_attach,
|
||||
settings = {
|
||||
pylsp = {
|
||||
configurationSources = { "flake8", "mypy", "black" },
|
||||
|
@ -443,7 +512,6 @@ in
|
|||
},
|
||||
},
|
||||
}
|
||||
require('lspconfig').terraform_lsp.setup {on_attach = require "lsp-format".on_attach}
|
||||
|
||||
require('gitsigns').setup { sign_priority=80 }
|
||||
|
||||
|
@ -460,29 +528,30 @@ in
|
|||
local gps = require('nvim-gps')
|
||||
require('lualine').setup {
|
||||
options = { theme = 'ayu' },
|
||||
sections = {
|
||||
lualine_c = {
|
||||
'filename', { gps.get_location, condition=gps.is_available },
|
||||
},
|
||||
lualine_y = {
|
||||
function()
|
||||
local msg = 'No Active Lsp'
|
||||
local buf_ft = vim.api.nvim_buf_get_option(0, 'filetype')
|
||||
local clients = vim.lsp.get_active_clients()
|
||||
if next(clients) == nil then
|
||||
return msg
|
||||
end
|
||||
for _, client in ipairs(clients) do
|
||||
local filetypes = client.config.filetypes
|
||||
if filetypes and vim.fn.index(filetypes, buf_ft) ~= -1 then
|
||||
return client.name
|
||||
end
|
||||
end
|
||||
return msg
|
||||
end
|
||||
},
|
||||
}
|
||||
}
|
||||
-- sections = {
|
||||
-- lualine_c = {
|
||||
-- 'filename', { gps.get_location, condition=gps.is_available },
|
||||
-- },
|
||||
-- lualine_y = {
|
||||
-- function()
|
||||
-- local msg = 'No Active Lsp'
|
||||
-- local buf_ft = vim.api.nvim_buf_get_option(0, 'filetype')
|
||||
-- local clients = vim.lsp.get_active_clients()
|
||||
-- if next(clients) == nil then
|
||||
-- return msg
|
||||
-- end
|
||||
-- for _, client in ipairs(clients) do
|
||||
-- local filetypes = client.config.filetypes
|
||||
-- if filetypes and vim.fn.index(filetypes, buf_ft) ~= -1 then
|
||||
-- return client.name
|
||||
-- end
|
||||
-- end
|
||||
-- return msg
|
||||
-- end
|
||||
-- },
|
||||
-- }
|
||||
-- }
|
||||
|
||||
-- nvim-lint
|
||||
-- require('lint').linters_by_ft = {
|
||||
|
@ -496,11 +565,33 @@ in
|
|||
map('t', '<A-i>', '<C-\\><C-n><CMD>lua require("FTerm").toggle()<CR>', opts)
|
||||
|
||||
-- Custom functions
|
||||
-- updateDate = function()
|
||||
-- for line in file.lines()
|
||||
-- if line.is_empty()
|
||||
-- line = os.time(<format>)
|
||||
-- return
|
||||
function update_date()
|
||||
local time = os.date("%Y-%m-%d %H:%M")
|
||||
local message = "%update " .. time
|
||||
local lines = vim.api.nvim_buf_get_lines(0, 0,4,false)
|
||||
for i=1,4,1 do
|
||||
if (lines[i]:len() == 0) then
|
||||
vim.api.nvim_buf_set_lines(0, i-1, i, false, {message, ""})
|
||||
return
|
||||
end
|
||||
end
|
||||
if (lines[4]:len() ~= 0) then
|
||||
vim.api.nvim_buf_set_lines(0, 3, 4, false, {message})
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
vim.api.nvim_create_autocmd(
|
||||
"BufWritePre",
|
||||
{ pattern = { "*.wiki" }, callback = update_date}
|
||||
)
|
||||
|
||||
-- set spelling for text files
|
||||
vim.api.nvim_create_autocmd(
|
||||
{ "BufRead", "BufNewFile" },
|
||||
{ pattern = { "*.wiki", "*.txt", "*.md", "*.tex" },
|
||||
command = "setlocal spell" }
|
||||
)
|
||||
|
||||
-- auto session
|
||||
require('auto-session').setup {
|
||||
|
@ -510,6 +601,7 @@ in
|
|||
vim.o.sessionoptions="blank,buffers,curdir,folds,help,tabpages,winsize,winpos,terminal"
|
||||
|
||||
require("which-key").setup{}
|
||||
require('leap').set_default_keymaps()
|
||||
EOF
|
||||
|
||||
'';
|
||||
|
@ -535,7 +627,6 @@ in
|
|||
];
|
||||
plugins = with pkgs.vimPlugins // customPlugins; [
|
||||
# ui
|
||||
which-key-nvim
|
||||
fzf-vim
|
||||
nerdtree
|
||||
neovim-ayu
|
||||
|
@ -548,7 +639,6 @@ in
|
|||
undotree
|
||||
telescope-nvim
|
||||
plenary-nvim
|
||||
lualine-nvim
|
||||
nvim-gps
|
||||
nvim-treesitter
|
||||
nvim-treesitter-context
|
||||
|
@ -601,6 +691,13 @@ in
|
|||
|
||||
vim-tidal
|
||||
# experimental
|
||||
nvim-luapad
|
||||
nvim-navic
|
||||
leap
|
||||
# TODO break with nvim 0.8.0
|
||||
# these are here until i upgrade my nixos channnel in the flake
|
||||
my-which-key-nvim
|
||||
my-lualine-nvim
|
||||
# vim-processing
|
||||
];
|
||||
withPython3 = true;
|
||||
|
|
Loading…
Reference in a new issue