diff --git a/modules/desktop.nix b/modules/desktop.nix index 380b922..118ad50 100644 --- a/modules/desktop.nix +++ b/modules/desktop.nix @@ -83,6 +83,7 @@ in with lib; { # custom scripts window-screenshot desktop-ctl em-record em-play em-play-loop pa_applet + brightnessctl ]; # i3 {{{ xsession = { @@ -178,6 +179,9 @@ in with lib; { "XF86AudioPlay" = "exec playerctl play"; "XF86AudioStop" = "exec playerctl stop"; + "XF86MonBrightnessUp" = "exec brightnessctl set 5%+"; + "XF86MonBrightnessDown" = "exec brightnessctl set 5%-"; + # macros "${mod}+q" = "exec em-record.sh"; "${mod}+p" = "exec em-play.sh"; diff --git a/modules/neovim.nix b/modules/neovim.nix index 6aa4ae9..431b830 100644 --- a/modules/neovim.nix +++ b/modules/neovim.nix @@ -54,9 +54,11 @@ in with lib; { coc = { enable = true; settings = { - rust-analyzer.server.path = "${pkgs.rust-analyzer.outPath}/bin/rust-analyzer"; + rust-analyzer.server.path = "${pkgs.rust-analyzer}/bin/rust-analyzer"; }; pluginConfig = '' + let mapleader = "\" + nmap gd (coc-definition) nmap gy (coc-type-definition) nmap gi (coc-implementation) @@ -65,7 +67,57 @@ in with lib; { nmap gr (coc-rename) nmap ac (coc-codeaction) nmap qf (coc-fix-current) - ''; + + + " Use tab for trigger completion with characters ahead and navigate. + " NOTE: There's always complete item selected by default, you may want to enable + " no select by `"suggest.noselect": true` in your configuration file. + " NOTE: Use command ':verbose imap ' to make sure tab is not mapped by + " other plugin before putting this into your config. + inoremap + \ coc#pum#visible() ? coc#pum#next(1) : + \ CheckBackspace() ? "\" : + \ coc#refresh() + inoremap coc#pum#visible() ? coc#pum#prev(1) : "\" + + if has('nvim-0.4.0') || has('patch-8.2.0750') + nnoremap coc#float#has_scroll() ? coc#float#scroll(1) : "\" + nnoremap coc#float#has_scroll() ? coc#float#scroll(0) : "\" + inoremap coc#float#has_scroll() ? "\=coc#float#scroll(1)\" : "\" + inoremap coc#float#has_scroll() ? "\=coc#float#scroll(0)\" : "\" + vnoremap coc#float#has_scroll() ? coc#float#scroll(1) : "\" + vnoremap coc#float#has_scroll() ? coc#float#scroll(0) : "\" + endif + + + " Make to accept selected completion item or notify coc.nvim to format + " u breaks current undo, please make your own choice. + inoremap coc#pum#visible() ? coc#pum#confirm() + \: "\u\\=coc#on_enter()\" + + function! CheckBackspace() abort + let col = col('.') - 1 + return !col || getline('.')[col - 1] =~# '\s' + endfunction + " Make to accept selected completion item or notify coc.nvim to format + " u breaks current undo, please make your own choice. + inoremap coc#pum#visible() ? coc#pum#confirm() + \: "\u\\=coc#on_enter()\" + + function! CheckBackspace() abort + let col = col('.') - 1 + return !col || getline('.')[col - 1] =~# '\s' + endfunction + + " Use to trigger completion. + if has('nvim') + inoremap coc#refresh() + else + inoremap coc#refresh() + endif + + nmap rn (coc-rename) + ''; }; # }}} extraConfig = '' @@ -91,48 +143,6 @@ in with lib; { set cindent set tabstop=4 set shiftwidth=4 - - " Emacs Insert mode/command mode hotkeys {{{ - " movement - inoremap - inoremap - inoremap - inoremap - cnoremap - cnoremap - cnoremap - cnoremap - - inoremap $ - inoremap _ - cnoremap $ - cnoremap _ - - inoremap - inoremap - inoremap ) - inoremap ( - cnoremap - cnoremap - cnoremap ) - cnoremap ( - - inoremap ggi - inoremap > Gi - cnoremap ggi - cnoremap > Gi - - " editing - inoremap - inoremap db - inoremap de - cnoremap - cnoremap db - cnoremap de - - inoremap / - inoremap ? - " }}} ''; }; };