2021-10-04 08:23:05 -07:00
|
|
|
{ pkgs, ... }:
|
|
|
|
|
|
|
|
|
2021-10-10 01:34:18 -07:00
|
|
|
let
|
2022-02-25 06:04:20 -08:00
|
|
|
customPlugins = {
|
|
|
|
vim-zettel = pkgs.vimUtils.buildVimPlugin {
|
|
|
|
name = "vim-zettel";
|
|
|
|
src = pkgs.fetchFromGitHub {
|
|
|
|
owner = "michal-h21";
|
|
|
|
repo = "vim-zettel";
|
|
|
|
rev = "929d90eec62e6f693c2702d2b6f76a93f2f1689d";
|
|
|
|
sha256 = "1fzKmknfVlEYwqeXgbKITbb2/PJ023iJyMz6vak3qh4=";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
vimwiki-dev = pkgs.vimUtils.buildVimPlugin {
|
|
|
|
name = "vimwiki-dev";
|
|
|
|
src = pkgs.fetchFromGitHub {
|
|
|
|
owner = "vimwiki";
|
|
|
|
repo = "vimwiki";
|
|
|
|
rev = "d035a3428c6343b4f218e51340ddf690ad8c57ee";
|
|
|
|
sha256 = "000000000000000000000000PJ023iJyMz6vak3qh4=";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
taskwiki-t = pkgs.vimUtils.buildVimPluginFrom2Nix {
|
|
|
|
pname = "taskwiki";
|
|
|
|
version = "2021-09-22";
|
|
|
|
src = pkgs.fetchFromGitHub {
|
|
|
|
owner = "tools-life";
|
|
|
|
repo = "taskwiki";
|
|
|
|
rev = "c4392c36c01cfffcb06f460d722990b98bc53bdb";
|
|
|
|
sha256 = "QrxFqu/Y6FykXGqIlK52+nDwmnBhubURl6v2Zc/KwPw=";
|
|
|
|
};
|
|
|
|
meta.homepage = "https://github.com/tools-life/taskwiki/";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
my-python-packages = python-packages: with python-packages; [
|
|
|
|
tasklib
|
|
|
|
pynvim
|
|
|
|
six
|
2022-02-25 09:32:15 -08:00
|
|
|
python-lsp-server
|
|
|
|
pylsp-mypy
|
|
|
|
python-lsp-black
|
|
|
|
pylint
|
2022-02-25 06:04:20 -08:00
|
|
|
# other python packages you want
|
|
|
|
];
|
|
|
|
python-with-my-packages = pkgs.python3.withPackages my-python-packages;
|
2021-10-10 01:34:18 -07:00
|
|
|
in
|
2022-02-25 06:04:20 -08:00
|
|
|
{
|
|
|
|
environment.variables.EDITOR = "nvim";
|
|
|
|
environment.shellAliases = {
|
|
|
|
k = "vim -c :VimwikiIndex";
|
|
|
|
kz = "vim -c :VimwikiIndex -c :ZettelNew";
|
|
|
|
};
|
|
|
|
environment.systemPackages = with pkgs // customPlugins; [
|
|
|
|
nodejs
|
|
|
|
python-with-my-packages
|
|
|
|
clojure-lsp
|
|
|
|
rnix-lsp
|
2022-02-25 09:32:15 -08:00
|
|
|
terraform-lsp
|
|
|
|
# Other LSPs
|
2022-02-25 06:04:20 -08:00
|
|
|
( neovim.override {
|
|
|
|
vimAlias = true;
|
|
|
|
withPython3 = true;
|
|
|
|
extraPython3Packages = pkgs: with pkgs; [ tasklib six ];
|
|
|
|
configure = {
|
2021-10-04 08:23:05 -07:00
|
|
|
packages.myPlugins = with pkgs.vimPlugins; {
|
|
|
|
start = [
|
|
|
|
vim-nix
|
|
|
|
fzf-vim
|
|
|
|
vim-elixir
|
|
|
|
emmet-vim
|
|
|
|
nerdtree
|
2022-02-25 09:32:15 -08:00
|
|
|
ayu-vim
|
2021-10-04 08:23:05 -07:00
|
|
|
goyo-vim
|
|
|
|
vim-sneak
|
|
|
|
csv-vim
|
|
|
|
rainbow_parentheses-vim
|
|
|
|
vim-surround
|
|
|
|
vim-devicons
|
2022-02-25 09:32:15 -08:00
|
|
|
# kitaab stuff
|
|
|
|
vimwiki
|
2021-10-04 08:23:05 -07:00
|
|
|
taskwiki
|
2021-10-10 01:34:18 -07:00
|
|
|
vim-zettel
|
2022-02-25 06:04:20 -08:00
|
|
|
telescope-nvim
|
|
|
|
plenary-nvim
|
2022-02-25 10:50:52 -08:00
|
|
|
bufferline-nvim
|
2022-02-25 09:32:15 -08:00
|
|
|
# lsp stuff
|
|
|
|
ale
|
|
|
|
nvim-lspconfig
|
|
|
|
nvim-cmp
|
2022-02-25 10:20:07 -08:00
|
|
|
cmp-nvim-lsp
|
2022-02-25 09:32:15 -08:00
|
|
|
nvim-lsp-ts-utils
|
|
|
|
cmp-conjure
|
|
|
|
cmp-buffer
|
|
|
|
cmp-tabnine
|
|
|
|
lspkind-nvim
|
|
|
|
# git stuff
|
|
|
|
vim-fugitive
|
|
|
|
gitsigns-nvim
|
|
|
|
fzf-checkout-vim
|
2022-02-25 06:04:20 -08:00
|
|
|
# Clojure stuff
|
|
|
|
conjure
|
|
|
|
vim-sexp
|
|
|
|
vim-sexp-mappings-for-regular-people
|
2022-02-25 09:32:15 -08:00
|
|
|
# testing
|
|
|
|
#vim-processing
|
|
|
|
#vim-tidal
|
2021-10-04 08:23:05 -07:00
|
|
|
];
|
|
|
|
};
|
2022-02-25 06:04:20 -08:00
|
|
|
|
|
|
|
customRC = ''
|
|
|
|
set tabstop=2
|
|
|
|
set showmatch
|
|
|
|
set shiftwidth=2
|
|
|
|
set noexpandtab
|
|
|
|
set autoindent
|
2022-02-25 09:32:15 -08:00
|
|
|
set undofile
|
2022-02-25 06:04:20 -08:00
|
|
|
|
|
|
|
" set foldmethod=indent " fold based on indent
|
|
|
|
set number
|
|
|
|
set nocompatible
|
|
|
|
set relativenumber
|
|
|
|
set showtabline=2
|
|
|
|
set noexpandtab
|
|
|
|
set autowriteall
|
2021-10-04 08:23:05 -07:00
|
|
|
syntax on
|
2022-02-25 06:04:20 -08:00
|
|
|
set list lcs=tab:\|\
|
|
|
|
filetype plugin on
|
|
|
|
|
|
|
|
set termguicolors
|
|
|
|
let ayucolor="mirage"
|
|
|
|
colorscheme ayu
|
2021-10-04 08:23:05 -07:00
|
|
|
|
2022-02-25 06:04:20 -08:00
|
|
|
" set spell
|
|
|
|
set spelllang=en_gb
|
2021-10-04 08:23:05 -07:00
|
|
|
|
2022-02-25 06:04:20 -08:00
|
|
|
" window
|
2022-02-25 06:55:19 -08:00
|
|
|
nmap <leader>wh :topleft vnew<CR>
|
2022-02-25 06:04:20 -08:00
|
|
|
nmap <leader>wl :botright vnew<CR>
|
2022-02-25 06:55:19 -08:00
|
|
|
nmap <leader>wk :topleft new<CR>
|
2022-02-25 06:04:20 -08:00
|
|
|
nmap <leader>wj :botright new<CR>
|
2022-02-08 02:03:49 -08:00
|
|
|
|
2022-02-25 06:04:20 -08:00
|
|
|
" tabs
|
|
|
|
nmap <leader>rt :retab!<CR>
|
2021-10-04 08:23:05 -07:00
|
|
|
|
|
|
|
let mapleader = "\<Space>"
|
2022-02-25 06:04:20 -08:00
|
|
|
let maplocalleader = ","
|
2021-10-04 08:23:05 -07:00
|
|
|
|
|
|
|
" moving splits with vim movements.
|
|
|
|
:tnoremap <A-h> <C-\><C-N><C-w>h
|
|
|
|
:tnoremap <A-j> <C-\><C-N><C-w>j
|
|
|
|
:tnoremap <A-k> <C-\><C-N><C-w>k
|
|
|
|
:tnoremap <A-l> <C-\><C-N><C-w>l
|
|
|
|
:inoremap <A-h> <C-\><C-N><C-w>h
|
|
|
|
:inoremap <A-j> <C-\><C-N><C-w>j
|
|
|
|
:inoremap <A-k> <C-\><C-N><C-w>k
|
|
|
|
:inoremap <A-l> <C-\><C-N><C-w>l
|
|
|
|
:nnoremap <A-h> <leader>h
|
|
|
|
:nnoremap <A-j> <leader>j
|
|
|
|
:nnoremap <A-k> <leader>k
|
|
|
|
:nnoremap <A-l> <leader>l
|
|
|
|
:nnoremap <F5> "=strftime("%Y-%m-%d %H:%M:")
|
|
|
|
:inoremap <F5> <C-R>=strftime("%Y-%m-%d %H:%M:")
|
|
|
|
|
2022-02-25 06:04:20 -08:00
|
|
|
" telescope
|
|
|
|
" Find files using Telescope command-line sugar.
|
|
|
|
nnoremap <leader>ff <cmd>Telescope find_files<cr>
|
|
|
|
nnoremap <leader>fg <cmd>Telescope live_grep<cr>
|
|
|
|
nnoremap <leader>fb <cmd>Telescope buffers<cr>
|
|
|
|
nnoremap <leader>fh <cmd>Telescope help_tags<cr>
|
2022-02-08 02:03:49 -08:00
|
|
|
|
2022-02-25 06:04:20 -08:00
|
|
|
" exit normal mode in terminal
|
|
|
|
:tnoremap <C-n> <C-\><C-n>
|
2021-10-04 08:23:05 -07:00
|
|
|
|
2022-02-25 06:04:20 -08:00
|
|
|
" Sexp in Conjure (since it's fennel)
|
|
|
|
" let g:sexp_filetypes = [ "fennel" ]
|
2021-10-10 01:34:18 -07:00
|
|
|
|
2022-02-25 06:04:20 -08:00
|
|
|
let g:rainbow_active = 0
|
|
|
|
autocmd BufReadPost,BufNewFile c,py,nix RainbowParenthesesToggleAll
|
2021-10-04 08:23:05 -07:00
|
|
|
|
2022-02-25 06:55:19 -08:00
|
|
|
" general commands
|
2021-10-04 08:23:05 -07:00
|
|
|
map <leader>t :NERDTreeToggle<CR>
|
|
|
|
map <leader>s :w<CR>
|
|
|
|
map <leader>q :wq<CR>
|
2022-02-25 06:04:20 -08:00
|
|
|
map <leader>r :RainbowParenthesesToggleAll<CR>
|
2022-02-25 06:55:19 -08:00
|
|
|
map <leader><BS> :noh<CR>
|
2022-02-25 07:58:16 -08:00
|
|
|
nnoremap Y y$
|
|
|
|
" center moving
|
|
|
|
nnoremap n nzzzv
|
|
|
|
nnoremap N Nzzzv
|
|
|
|
nnoremap J mzJ'z
|
|
|
|
" undo points
|
|
|
|
inoremap , ,<c-g>u
|
|
|
|
inoremap . .<c-g>u
|
|
|
|
inoremap ! !<c-g>u
|
|
|
|
inoremap ? ?<c-g>u
|
|
|
|
inoremap ( (<c-g>u
|
|
|
|
inoremap ) )<c-g>u
|
|
|
|
inoremap [ [<c-g>u
|
|
|
|
inoremap ] ]<c-g>u
|
|
|
|
inoremap { {<c-g>u
|
|
|
|
inoremap } }<c-g>u
|
|
|
|
" moving text
|
|
|
|
vnoremap J :m '>+1<CR>gv=gv
|
|
|
|
vnoremap K :m '>-2<CR>gv=gv
|
|
|
|
inoremap <c-j> <esc>:m .+1<CR>==
|
|
|
|
inoremap <c-k> <esc>:m .-2<CR>==
|
|
|
|
nnoremap <leader>j <esc>:m .+1<CR>==
|
|
|
|
nnoremap <leader>k <esc>:m .-2<CR>==
|
2022-02-25 09:32:15 -08:00
|
|
|
" Pasting
|
|
|
|
:map <leader>sy :!xclip -i<CR><CR>
|
|
|
|
:vmap <leader>sy "*y
|
|
|
|
:map <leader>sp :r!xclip -o<CR>
|
2022-02-25 06:55:19 -08:00
|
|
|
|
|
|
|
" git
|
|
|
|
nmap <leader>gd :SignifyDiff<CR>
|
|
|
|
map <leader>ghu :SignifyHunkUndo<CR>
|
|
|
|
nmap <leader>gl :SignifyList<CR>
|
2022-02-25 07:58:16 -08:00
|
|
|
nnoremap <leader>ga :G fetch --all
|
2022-02-25 06:55:19 -08:00
|
|
|
nmap <leader>gs :G<CR>
|
|
|
|
nmap <leader>gh :diffget //3
|
|
|
|
nmap <leader>gl :diffget //2
|
2022-02-25 07:58:16 -08:00
|
|
|
nmap <leader>gc :GCheckout<CR>
|
2022-02-25 06:55:19 -08:00
|
|
|
|
|
|
|
" kitaab
|
2022-02-25 06:04:20 -08:00
|
|
|
map <leader>zs :ZettelSearch<CR>
|
|
|
|
map <leader>zo :ZettelOpen<CR>
|
|
|
|
map <leader>zn :ZettelNew<CR>
|
2021-10-04 08:23:05 -07:00
|
|
|
|
|
|
|
" NERDTree
|
|
|
|
" open on directory
|
|
|
|
autocmd StdinReadPre * let s:std_in=1
|
|
|
|
|
2022-02-25 06:55:19 -08:00
|
|
|
" fzf
|
|
|
|
let g:fzf_layout = { 'window': { 'width': 0.8, 'height': 0.8 } }
|
|
|
|
|
2022-02-25 06:04:20 -08:00
|
|
|
" ALE + clj-kondo
|
2022-02-25 09:32:15 -08:00
|
|
|
let g:ale_linters = {'clojure': ['clj-kondo'], 'python': ['black', 'pylint']}
|
2022-02-08 02:03:49 -08:00
|
|
|
|
2021-10-04 08:23:05 -07:00
|
|
|
" if hidden is not set, TextEdit might fail.
|
|
|
|
set hidden
|
|
|
|
|
|
|
|
" Some servers have issues with backup files, see #649
|
|
|
|
set nobackup
|
|
|
|
set nowritebackup
|
|
|
|
|
|
|
|
" Better display for messages
|
|
|
|
set cmdheight=2
|
|
|
|
|
|
|
|
" You will have bad experience for diagnostic messages when it's default 4000.
|
|
|
|
set updatetime=300
|
|
|
|
|
|
|
|
" don't give |ins-completion-menu| messages.
|
|
|
|
set shortmess+=c
|
|
|
|
|
|
|
|
" always show signcolumns
|
|
|
|
set signcolumn=yes
|
|
|
|
|
2022-02-25 09:32:15 -08:00
|
|
|
|
|
|
|
" lsp commands
|
|
|
|
nnoremap <leader>vd :lua vim.lsp.buf.definition()<CR>
|
|
|
|
nnoremap <leader>vi :lua vim.lsp.buf.implementation()<CR>
|
|
|
|
nnoremap <leader>vsh :lua vim.lsp.buf.signature_help()<CR>
|
|
|
|
nnoremap <leader>vrr :lua vim.lsp.buf.references()<CR>
|
|
|
|
nnoremap <leader>vrn :lua vim.lsp.buf.rename()<CR>
|
|
|
|
nnoremap <leader>vh :lua vim.lsp.buf.hover()<CR>
|
|
|
|
nnoremap <leader>vca :lua vim.lsp.buf.code_action()<CR>
|
|
|
|
nnoremap <leader>vsd :lua vim.lsp.diagnostic.show_line_diagnostics(); vim.lsp.util.show_line_diagnostics()<CR>
|
|
|
|
nnoremap <leader>vn :lua vim.lsp.diagnostic.goto_next()<CR>
|
|
|
|
nnoremap <leader>vll :call LspLocationList()<CR>
|
|
|
|
|
|
|
|
"bufferline
|
|
|
|
" These commands will navigate through buffers in order regardless of which mode you are using
|
|
|
|
nnoremap <silent>[b :BufferLineCycleNext<CR>
|
|
|
|
nnoremap <silent>b] :BufferLineCyclePrev<CR>
|
|
|
|
|
|
|
|
" lua config
|
|
|
|
lua <<EOF
|
2022-02-25 10:50:52 -08:00
|
|
|
-- Setup nvim-cmp.
|
|
|
|
local cmp = require'cmp'
|
|
|
|
cmp.setup({
|
|
|
|
mapping = {
|
|
|
|
['<C-b>'] = cmp.mapping(cmp.mapping.scroll_docs(-4), { 'i', 'c' }),
|
|
|
|
['<C-f>'] = cmp.mapping(cmp.mapping.scroll_docs(4), { 'i', 'c' }),
|
|
|
|
['<C-Space>'] = cmp.mapping(cmp.mapping.complete(), { 'i', 'c' }),
|
|
|
|
['<C-y>'] = cmp.config.disable, -- Specify `cmp.config.disable` if you want to remove the default `<C-y>` mapping.
|
|
|
|
['<C-e>'] = cmp.mapping({
|
|
|
|
i = cmp.mapping.abort(),
|
|
|
|
c = cmp.mapping.close(),
|
|
|
|
}),
|
|
|
|
['<CR>'] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
|
|
|
|
},
|
|
|
|
sources = cmp.config.sources({
|
|
|
|
{ name = 'nvim_lsp' },
|
|
|
|
}, {
|
|
|
|
{ name = 'buffer' },
|
|
|
|
})
|
|
|
|
})
|
|
|
|
-- Use buffer source for `/` (if you enabled `native_menu`, this won't work anymore).
|
|
|
|
cmp.setup.cmdline('/', {
|
|
|
|
sources = {
|
|
|
|
{ name = 'buffer' },
|
|
|
|
{ name = "nvim_lsp"},
|
|
|
|
{ name = "path" },
|
|
|
|
{ name = 'conjure'},
|
|
|
|
{ name = 'cmp_tabnine'},
|
|
|
|
}
|
|
|
|
})
|
|
|
|
-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
|
|
|
|
cmp.setup.cmdline(':', {
|
|
|
|
sources = cmp.config.sources({
|
|
|
|
{ name = 'path' }
|
|
|
|
}, {
|
|
|
|
{ name = 'cmdline' }
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
-- Setup lspconfig.
|
|
|
|
-- local capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities())
|
|
|
|
-- require'lspconfig'nvim_lsp.setup {}
|
|
|
|
-- require'lspconfig'clojure_lsp.setup {}
|
|
|
|
-- require'lspconfig'rnix.setup {}
|
|
|
|
-- require'lspconfig'pylsp.setup {}
|
|
|
|
-- require'lspconfig'terraform_lsp.setup {}
|
|
|
|
|
|
|
|
-- Bufferline
|
|
|
|
require('bufferline').setup {}
|
|
|
|
EOF
|
2021-10-04 08:23:05 -07:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
}
|
|
|
|
)];
|
|
|
|
}
|