1
0
mirror of https://github.com/kmein/niveum synced 2026-03-16 10:11:08 +01:00

feat: make obsidian-vim and neovim bearable

This commit is contained in:
2023-07-09 23:26:49 +02:00
parent 074e229d5f
commit 24f838370d
7 changed files with 50 additions and 37 deletions

View File

@@ -305,7 +305,7 @@
new-mac = pkgs.callPackage packages/new-mac.nix {};
nix-git = pkgs.callPackage packages/nix-git.nix {};
nix-index-update = pkgs.callPackage packages/nix-index-update.nix {inherit system;};
notemenu = pkgs.callPackage packages/notemenu.nix {};
notemenu = pkgs.callPackage packages/notemenu.nix {niveumPackages = self.packages.${system};};
opustags = pkgs.callPackage packages/opustags.nix {};
pls = pkgs.callPackage packages/pls.nix {};
qrpaste = pkgs.callPackage packages/qrpaste.nix {};

View File

@@ -2,9 +2,9 @@ local cmp = require'cmp'
cmp.setup({
snippet = {
expand = function(args) {
expand = function(args)
require("luasnip").lsp_expand(args.body)
},
end,
},
mapping = cmp.mapping.preset.insert({
['<C-b>'] = cmp.mapping.scroll_docs(-4),
@@ -76,7 +76,7 @@ local lsp_flags = {
}
language_servers = {
clangd = {},`
clangd = {},
pyright = {}, -- pyright
tsserver = {}, -- typescript-language-server
elmls = {}, -- elm-language-server

View File

@@ -3,27 +3,12 @@ vnoremap a= :Tabularize /=<CR>
vnoremap a; :Tabularize /::<CR>
vnoremap a- :Tabularize /-><CR>
nnoremap <C-p> :FZF<CR>
nnoremap <C-l> :Rg<CR>
let g:fzf_layout = { 'down': '~15%' }
colorscheme dim
" transparent background
hi Normal guibg=NONE ctermbg=NONE
let mapleader = ","
let maplocalleader="\\"
" noremap <Leader>h :<C-u>split<CR>
" noremap <Leader>v :<C-u>vsplit<CR>
noremap <Leader>gs :Git<CR>
noremap <Leader>gc :Git commit<CR>
noremap <leader>n :bn<CR>
noremap <leader>p :bp<CR>
noremap <leader>c :bd<CR>
noremap <leader>b :Buffers<CR>
noremap <leader>t :Tags<CR>
" reindent whole file
noremap <leader>i mzgg=G`z
@@ -34,11 +19,8 @@ nnoremap S :%s//g<Left><Left>
" Hit `%` on `if` to jump to `else`.
runtime macros/matchit.vim
filetype plugin indent on
set autoindent
set notitle
set nospell
set smartcase ignorecase " you need these two
set backspace=indent,eol,start
set hidden
set ruler
@@ -49,23 +31,13 @@ set path+=**
set splitbelow splitright
set wildmenu wildmode=longest,list,full
set shortmess+=ac
set nowritebackup noswapfile
set mouse=a
set showmatch
set encoding=utf8 ffs=unix,dos,mac
set smartindent
set wrap
set hlsearch
set clipboard=unnamedplus
set nopaste
set list listchars=tab:⇥\ ,extends:,precedes:,nbsp:␣,trailshowbreak=¬
set foldlevelstart=30
nnoremap <C-H> :set nohlsearch
iabbrev ddate <C-R>=strftime("%F")<CR>
iabbrev dtime <C-R>=strftime("%F %T")<CR>
fun! TrimWhitespace()
let l:save = winsaveview()
keeppatterns %s/\s\+$//e

28
lib/vim/shared.vim Normal file
View File

@@ -0,0 +1,28 @@
nnoremap <C-p> :FZF<CR>
nnoremap <C-l> :Rg<CR>
let g:fzf_layout = { 'down': '~15%' }
" transparent background
hi Normal guibg=NONE ctermbg=NONE
let mapleader = ","
let maplocalleader="\\"
noremap <leader>n :bn<CR>
noremap <leader>p :bp<CR>
noremap <leader>c :bd<CR>
noremap <leader>b :Buffers<CR>
noremap <leader>t :Tags<CR>
filetype plugin indent on
set autoindent
set smartcase ignorecase " you need these two
set nowritebackup noswapfile
set mouse=a
set encoding=utf8 ffs=unix,dos,mac
set wrap
set list listchars=tab:⇥\ ,extends:,precedes:,nbsp:␣,trailshowbreak=¬
set clipboard=unnamedplus
set nopaste
iabbrev ddate <C-R>=strftime("%F")<CR>
iabbrev dtime <C-R>=strftime("%F %T")<CR>

View File

@@ -6,6 +6,7 @@
coreutils,
noteDirectory ? "~/cloud/syncthing/obsidian",
currentDates ? false,
niveumPackages,
}:
writers.writeDashBin "notemenu" ''
set -efu
@@ -23,6 +24,6 @@ writers.writeDashBin "notemenu" ''
} | rofi -dmenu -i -p 'notes')
if test "$note_file"
then
alacritty --working-directory ${noteDirectory} -e "$EDITOR" "$note_file"
alacritty --working-directory ${noteDirectory} -e ${niveumPackages.obsidian-vim}/bin/nvim "$note_file"
fi
''

View File

@@ -1,17 +1,29 @@
{
neovim,
vimPlugins,
vault ? "~/cloud/syncthing/obsidian/",
obsidiantVaultDirectory ? "~/cloud/syncthing/obsidian/",
...
}:
neovim.override {
configure = {
customRC = ''
let g:vimwiki_list = [{'path': '${vault}',
source ${../lib/vim/shared.vim}
cd ${obsidiantVaultDirectory}
let g:vimwiki_list = [{'path': '${obsidiantVaultDirectory}',
\ 'syntax': 'markdown', 'ext': '.md'}]
let NERDTreeSortOrder = ['[[-timestamp]]']
" Start NERDTree and put the cursor back in the other window.
autocmd VimEnter * NERDTree ${obsidiantVaultDirectory} | wincmd p
'';
packages.nvim.start = [
vimPlugins.vimwiki
vimPlugins.nerdtree
vimPlugins.fzf-vim
vimPlugins.fzfWrapper
];
};
}

View File

@@ -8,9 +8,9 @@
}: (neovim.override {
configure = {
customRC = ''
luafile ${../lib/vim/init.lua}
source ${../lib/vim/shared.vim}
source ${../lib/vim/init.vim}
luafile ${../lib/vim/init.lua}
'';
packages.nvim = with vimPlugins; {
start = [