mirror of
https://github.com/Nickiel12/nicks-nix-config.git
synced 2024-11-22 12:49:32 -08:00
added vim and rust and nix autocomplete
This commit is contained in:
parent
995019d348
commit
e115a557c6
6 changed files with 126 additions and 7 deletions
|
@ -24,7 +24,7 @@ in
|
|||
efiSupport = true;
|
||||
enable = true;
|
||||
version = 2;
|
||||
useOSProber = true;
|
||||
# useOSProber = true;
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -107,7 +107,7 @@ in
|
|||
# List packages installed in system profile. To search, run:
|
||||
# $ nix search wget
|
||||
environment.systemPackages = with pkgs; [
|
||||
vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default.
|
||||
# vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default.
|
||||
# wget
|
||||
];
|
||||
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
./home.nix
|
||||
./modules/zsh.nix
|
||||
./modules/urxvt.nix
|
||||
./modules/vim.nix
|
||||
];
|
||||
};
|
||||
}
|
||||
|
|
1
home.nix
1
home.nix
|
@ -31,6 +31,7 @@ in
|
|||
obsidian
|
||||
powerline
|
||||
|
||||
nodejs # required for coc-nvim
|
||||
# Gui application
|
||||
firefox
|
||||
libsForQt5.kate
|
||||
|
|
31
modules/vim.nix
Normal file
31
modules/vim.nix
Normal file
|
@ -0,0 +1,31 @@
|
|||
{ config, pkgs, ... }:
|
||||
|
||||
let
|
||||
|
||||
in
|
||||
{
|
||||
programs.vim = {
|
||||
enable = true;
|
||||
plugins = with pkgs.vimPlugins;
|
||||
let
|
||||
moonfly = pkgs.vimUtils.buildVimPlugin {
|
||||
name = "moonfly";
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "bluz71";
|
||||
repo = "vim-moonfly-colors";
|
||||
rev = "d51e3ad78654aa479d59adb81a98f179d595bdee";
|
||||
sha256 = "0uHEB8uNQeGpVWuZfyrVAWTyefJMCitTmNpHmKVFOaQ=";
|
||||
};
|
||||
};
|
||||
in [
|
||||
moonfly
|
||||
coc-rust-analyzer
|
||||
coc-nvim
|
||||
rust-vim
|
||||
vim-nix
|
||||
];
|
||||
|
||||
extraConfig = builtins.readFile ../rsrcs/.vimrc;
|
||||
};
|
||||
|
||||
}
|
|
@ -40,9 +40,4 @@ in
|
|||
source = ../rsrcs/.p10k.zsh;
|
||||
};
|
||||
|
||||
# programs.zsh.ohMyZsh = {
|
||||
# enable = true;
|
||||
|
||||
|
||||
# };
|
||||
}
|
||||
|
|
91
rsrcs/.vimrc
Normal file
91
rsrcs/.vimrc
Normal file
|
@ -0,0 +1,91 @@
|
|||
set autoindent
|
||||
set expandtab
|
||||
set tabstop=4
|
||||
set shiftwidth=4
|
||||
set foldmethod=syntax
|
||||
set foldlevel=20
|
||||
set number
|
||||
syntax on
|
||||
syntax enable
|
||||
filetype plugin indent on
|
||||
|
||||
|
||||
" Having longer updatetime (default is 4000 ms = 4 s) leads to noticeable
|
||||
" delays and poor user experience.
|
||||
set updatetime=300
|
||||
|
||||
set signcolumn=number
|
||||
|
||||
|
||||
" Use tab for trigger completion with characters ahead and navigate.
|
||||
" NOTE: Use command ':verbose imap <tab>' to make sure tab is not mapped by
|
||||
" other plugin before putting this into your config.
|
||||
inoremap <silent><expr> <TAB>
|
||||
\ pumvisible() ? "\<C-n>" :
|
||||
\ CheckBackspace() ? "\<TAB>" :
|
||||
\ coc#refresh()
|
||||
inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>"
|
||||
|
||||
function! CheckBackspace() abort
|
||||
let col = col('.') - 1
|
||||
return !col || getline('.')[col - 1] =~# '\s'
|
||||
endfunction
|
||||
|
||||
" Use <c-space> to trigger completion.
|
||||
if has('nvim')
|
||||
inoremap <silent><expr> <c-space> coc#refresh()
|
||||
else
|
||||
inoremap <silent><expr> <c-@> coc#refresh()
|
||||
endif
|
||||
|
||||
|
||||
" Use `[g` and `]g` to navigate diagnostics
|
||||
" Use `:CocDiagnostics` to get all diagnostics of current buffer in location list.
|
||||
nmap <silent> [g <Plug>(coc-diagnostic-prev)
|
||||
nmap <silent> ]g <Plug>(coc-diagnostic-next)
|
||||
|
||||
" 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
|
||||
|
||||
" Highlight the symbol and its references when holding the cursor.
|
||||
autocmd CursorHold * silent call CocActionAsync('highlight')
|
||||
|
||||
" Symbol renaming.
|
||||
nmap <leader>rn <Plug>(coc-rename)
|
||||
|
||||
" Formatting selected code.
|
||||
xmap <leader>f <Plug>(coc-format-selected)
|
||||
nmap <leader>f <Plug>(coc-format-selected)
|
||||
let g:rustfmt_autosave = 1
|
||||
|
||||
" Add `:Format` command to format current buffer.
|
||||
command! -nargs=0 Format :call CocActionAsync('format')
|
||||
|
||||
" Add `:Fold` command to fold current buffer.
|
||||
command! -nargs=? Fold :call CocAction('fold', <f-args>)
|
||||
|
||||
" Add `:OR` command for organize imports of the current buffer.
|
||||
command! -nargs=0 OR :call CocActionAsync('runCommand', 'editor.action.organizeImport')
|
||||
|
||||
" Add (Neo)Vim's native statusline support.
|
||||
" NOTE: Please see `:h coc-status` for integrations with external plugins that
|
||||
" provide custom statusline: lightline.vim, vim-airline.
|
||||
set statusline^=%{coc#status()}%{get(b:,'coc_current_function','')}
|
||||
|
||||
|
||||
colorscheme moonfly
|
||||
set number
|
Loading…
Reference in a new issue