Worf: git+vim
This commit is contained in:
parent
b1d57cc4a6
commit
3ff9efd865
|
@ -16,9 +16,10 @@
|
|||
# System packages for all users
|
||||
environment = {
|
||||
systemPackages = with pkgs; [
|
||||
findutils
|
||||
gnugrep
|
||||
ripgrep
|
||||
wget
|
||||
git
|
||||
];
|
||||
|
||||
variables = {
|
||||
|
@ -39,12 +40,12 @@
|
|||
fonts = {
|
||||
fontDir.enable = true;
|
||||
fonts = with pkgs; [
|
||||
source-code-pro
|
||||
font-awesome
|
||||
fira-code
|
||||
hack-font
|
||||
(nerdfonts.override {
|
||||
fonts = [
|
||||
"FiraCode"
|
||||
"Hack"
|
||||
];
|
||||
})
|
||||
];
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
}: {
|
||||
|
||||
imports = [
|
||||
./neovim.nix
|
||||
./zsh.nix
|
||||
];
|
||||
|
||||
|
@ -14,12 +15,34 @@
|
|||
discord
|
||||
exa
|
||||
iterm2
|
||||
neovim
|
||||
nix-index
|
||||
nodejs
|
||||
slack
|
||||
spotify
|
||||
vscode
|
||||
];
|
||||
|
||||
programs.git = {
|
||||
enable = true;
|
||||
|
||||
extraConfig = {
|
||||
pull.rebase = "true";
|
||||
color.ui = "auto";
|
||||
init.defaultBranch = "main";
|
||||
|
||||
user = {
|
||||
name = "Felix Albrigtsen";
|
||||
email = "felix@albrigtsen.it";
|
||||
};
|
||||
};
|
||||
ignores = [
|
||||
"*~"
|
||||
"*.swp"
|
||||
".DS_Store"
|
||||
".vscode"
|
||||
];
|
||||
};
|
||||
|
||||
# Copy Applications to ~/Applications to allow them to be launched from Spotlight
|
||||
disabledModules = [ "targets/darwin/linkapps.nix" ];
|
||||
home.activation = lib.mkIf pkgs.stdenv.isDarwin {
|
||||
|
|
|
@ -0,0 +1,109 @@
|
|||
{ pkgs, lib, inputs, config, ...}:
|
||||
let
|
||||
# fromGitHub = rev: ref: repo: pkgs.vimUtils.buildVimPluginFrom2Nix {
|
||||
# pname = "${lib.strings.sanitizeDerivationName repo}";
|
||||
# version = ref;
|
||||
# src = builtins.fetchGit {
|
||||
# url = "https://github.com/${repo}.git";
|
||||
# ref = ref;
|
||||
# rev = rev;
|
||||
# };
|
||||
# };
|
||||
in {
|
||||
programs.neovim = {
|
||||
enable = true;
|
||||
defaultEditor = true;
|
||||
viAlias = true;
|
||||
vimAlias = true;
|
||||
vimdiffAlias = true;
|
||||
plugins = with pkgs.vimPlugins; [
|
||||
lightline-vim
|
||||
vim-lightline-coc
|
||||
|
||||
vim-commentary
|
||||
vim-fugitive
|
||||
|
||||
nerdtree
|
||||
nerdtree-git-plugin
|
||||
vim-devicons
|
||||
|
||||
nvim-lspconfig
|
||||
copilot-vim
|
||||
nvim-treesitter
|
||||
|
||||
coc-nvim
|
||||
coc-pyright
|
||||
|
||||
vim-nix
|
||||
];
|
||||
|
||||
extraConfig = ''
|
||||
let mapleader = ','
|
||||
|
||||
" Integrate status with lightline
|
||||
let g:lightline = {
|
||||
\ 'active': {
|
||||
\ 'left': [[ 'coc_info', 'coc_hints', 'coc_errors', 'coc_warnings', 'coc_ok' ], [ 'coc_status' ]]
|
||||
\ }
|
||||
\ }
|
||||
|
||||
" register components:
|
||||
call lightline#coc#register()
|
||||
|
||||
" GoTo code navigation.
|
||||
nmap <silent> gd <Plug>(coc-definition)
|
||||
nmap <silent> gy <Plug>(coc-type-definition)
|
||||
nmap <silent> gi <Plug>(coc-implementation)
|
||||
nmap <silent> gr <Plug>(coc-references)
|
||||
|
||||
" Use K to show documentation in preview window.
|
||||
nnoremap <silent> K :call ShowDocumentation()<CR>
|
||||
function! ShowDocumentation()
|
||||
if CocAction('hasProvider', 'hover')
|
||||
call CocActionAsync('doHover')
|
||||
else
|
||||
call feedkeys('K', 'in')
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" Enable syntax folding with coc
|
||||
command! -nargs=* Fold :call CocAction('fold', <f-args>)
|
||||
|
||||
inoremap <silent><expr> <CR> coc#pum#visible() ? coc#pum#confirm()
|
||||
\: "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>"
|
||||
|
||||
" Highlight the symbol and its references when holding the cursor.
|
||||
autocmd CursorHold * silent call CocActionAsync('highlight')
|
||||
|
||||
" Symbol renaming.
|
||||
nmap <leader>rn <Plug>(coc-rename)
|
||||
|
||||
" Use CTRL-S for selections ranges.
|
||||
" Requires 'textDocument/selectionRange' support of language server.
|
||||
nmap <silent> <C-s> <Plug>(coc-range-select)
|
||||
xmap <silent> <C-s> <Plug>(coc-range-select)
|
||||
|
||||
" Step through diagnostics
|
||||
nmap <silent> <g <Plug>(coc-diagnostic-prev)
|
||||
nmap <silent> >g <Plug>(coc-diagnostic-next)
|
||||
|
||||
" Nerdtree-settings
|
||||
" Toggle nerdtree on Ctrl+t
|
||||
nmap <silent> <C-t> :NERDTreeToggle<CR>
|
||||
autocmd VimEnter * NERDTree " Autostart nerdtree on vim startup
|
||||
autocmd VimEnter * wincmd p " Unselect nerdtree window
|
||||
" Close vim is Nerdtree is the only buffer left
|
||||
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
|
||||
|
||||
" List and switch buffers on Ctrl+k
|
||||
nnoremap <C-k> :set nomore <Bar> :ls <Bar> :set more <CR>:b<Space>
|
||||
|
||||
" Show trailing whitespace
|
||||
highlight ExtraWhitespace ctermbg=red guibg=red
|
||||
match ExtraWhitespace /\s\+$/
|
||||
|
||||
" Disable search highlights
|
||||
map <Leader><Space> :noh<CR>
|
||||
'';
|
||||
};
|
||||
}
|
Loading…
Reference in New Issue