From efc9e2196ab0dccd0ca6e51cc73716279b390583 Mon Sep 17 00:00:00 2001 From: Steffen Rademacker Date: Thu, 2 Dec 2021 18:08:39 +0100 Subject: [PATCH] Space-leader, hop, gruvbox and fzf-lua etc. --- install/2_cli-tools.sh | 3 +- nvim/autocommands.vim | 2 +- nvim/coc-settings.json | 3 -- nvim/init.vim | 11 ++++--- nvim/keymappings.vim | 18 +++++------ nvim/leaderkeys.vim | 8 ++--- nvim/plugins.vim | 71 +++++++++++++++++++++++++----------------- tmux.conf | 7 ++--- zsh/aliases | 1 - zsh/exports | 3 -- 10 files changed, 66 insertions(+), 61 deletions(-) diff --git a/install/2_cli-tools.sh b/install/2_cli-tools.sh index 0b656f1..2e1c8c4 100755 --- a/install/2_cli-tools.sh +++ b/install/2_cli-tools.sh @@ -6,7 +6,7 @@ brew tap homebrew/services # install additional brew packages -- see _install.sh too brew install clipper -brew install exa +brew install fd brew install fzf brew install glances brew install homebrew-ffmpeg/ffmpeg/ffmpeg --with-fdk-aac --with-rav1e @@ -15,7 +15,6 @@ brew install lazygit brew install nnn brew install ripgrep brew install starship -brew install tree ln -s ~/dotfiles/lazygit ~/.config/lazygit ln -s ~/Dotfiles/starship.toml ~/.config/starship.toml diff --git a/nvim/autocommands.vim b/nvim/autocommands.vim index c1351bd..723cb49 100644 --- a/nvim/autocommands.vim +++ b/nvim/autocommands.vim @@ -21,5 +21,5 @@ augroup init " special settings for json5, css and scss: better BEM autocmd BufNewFile,BufRead *.{json5,css,scss} set iskeyword+=- - autocmd BufNewFile,BufRead *.scss set ft=scss.css + autocmd BufNewFile,BufRead *.scss set ft=sass.css augroup END diff --git a/nvim/coc-settings.json b/nvim/coc-settings.json index 8e238b7..86df9dc 100644 --- a/nvim/coc-settings.json +++ b/nvim/coc-settings.json @@ -1,7 +1,6 @@ // Installed extensions are: //////////////////////////// // coc-calc -// coc-eslint8 // -- fall back to non-8 when supported offically // coc-html // coc-json // coc-markdownlint @@ -10,7 +9,6 @@ // coc-snippets // coc-tsserver // coc-yaml -// coc-yank { "coc.preferences.formatOnSaveFiletypes": [ "typescriptreact", @@ -20,7 +18,6 @@ "yaml" ], // linters config - "eslint.autoFixOnSave": true, "javascript.format.enabled": false, "javascript.validate.enable": false, "typescript.format.enabled": false, diff --git a/nvim/init.vim b/nvim/init.vim index 405a072..08074e0 100644 --- a/nvim/init.vim +++ b/nvim/init.vim @@ -1,15 +1,18 @@ call plug#begin('~/.config/nvim/plugged') -" Plugins +" Dependencies for other plugins Plug 'rktjmp/lush.nvim' Plug 'kyazdani42/nvim-web-devicons' +Plug 'vijaymarupudi/nvim-fzf' + +" Colorscheme Plug 'ellisonleao/gruvbox.nvim' +" Plugins Plug 'christoomey/vim-tmux-navigator' -Plug 'easymotion/vim-easymotion' +Plug 'phaazon/hop.nvim' Plug 'editorconfig/editorconfig-vim' -Plug 'junegunn/fzf', { 'do': { -> fzf#install() } } -Plug 'junegunn/fzf.vim' +Plug 'ibhagwan/fzf-lua' Plug 'neoclide/coc.nvim', { 'branch': 'release' } Plug 'neovim/nvim-lspconfig' Plug 'nvim-lualine/lualine.nvim' diff --git a/nvim/keymappings.vim b/nvim/keymappings.vim index 0ed50df..1d390a9 100644 --- a/nvim/keymappings.vim +++ b/nvim/keymappings.vim @@ -1,4 +1,8 @@ " remap semi-colon to be colon in normal an visual mode +nnoremap Q +nnoremap K + +" deactivate stupid ex-mode and man-page stuff nnoremap ; : vnoremap ; : @@ -12,10 +16,9 @@ vnoremap v nnoremap j v:count ? (v:count > 5 ? "m'" . v:count : '') . 'j' : 'gj' nnoremap k v:count ? (v:count > 5 ? "m'" . v:count : '') . 'k' : 'gk' -" behave - yank just like D and C +" sane yanking and copying to clipboard/alfred-history nnoremap Y y$ - -" auto-yanking with clipper for selected yanking, see leader-y mapping +nnoremap yy yy :call system('nc localhost 8377', @0) vnoremap y y :call system('nc localhost 8377', @0) " Keeping it centered @@ -35,9 +38,8 @@ nnoremap :blast nnoremap :bp nnoremap :bn -" Bubble/indent lines using unimpaired -" using left alt + hjkl on mac usgerman keyboard -" those are some weird mappings, but they work! +" Bubble/indent lines using unimpaired using left alt + hjkl +" on mac: weird mappings, but they work! nmap ˚ [e nmap ∆ ]e nmap ˙ << @@ -46,7 +48,3 @@ vmap ˚ [egv vmap ∆ ]egv vmap ˙ gv - -" deactivate stupid ex-mode and man-page stuff -nnoremap Q -nnoremap K diff --git a/nvim/leaderkeys.vim b/nvim/leaderkeys.vim index 2edc091..8612c9f 100644 --- a/nvim/leaderkeys.vim +++ b/nvim/leaderkeys.vim @@ -1,5 +1,6 @@ -let g:mapleader="," -let g:maplocalleader="," +nnoremap +let g:mapleader=' ' +let g:maplocalleader='' " Zoom / Restore window. function! s:ToggleZoom() abort @@ -24,9 +25,6 @@ nnoremap - sj " Opens an edit command with the path of the currently edited file filled in nnoremap o :e =expand("%:p:h") . "/" -" Yank to clipboard with clipper -- see https://github.com/wincent/clipper -nnoremap y :call system('nc localhost 8377', @0) - " Find merge conflict markers nnoremap gf /\v^[<\|=>]{7}( .*\|$) diff --git a/nvim/plugins.vim b/nvim/plugins.vim index ee2954d..d5c1d72 100644 --- a/nvim/plugins.vim +++ b/nvim/plugins.vim @@ -14,6 +14,20 @@ require('lualine').setup({ }, }) +require('hop').setup() + +require('fzf-lua').setup({ + winopts = { + width = 0.80, + height = 0.78, + row = 0.45, + col = 0.48, + }, +}) + +-- LSP-config +require('lspconfig').eslint.setup({}) + require('lspconfig').stylelint_lsp.setup({ settings = { stylelintplus = { @@ -26,7 +40,7 @@ require('lspconfig').stylelint_lsp.setup({ }) require('lspconfig').cssls.setup({ - filetypes = { 'css', 'scss' }, + filetypes = { 'css', 'scss', 'sass' }, settings = { css = { validate = false, @@ -34,48 +48,55 @@ require('lspconfig').cssls.setup({ scss = { validate = false, }, + sass = { + validate = false, + }, }, }) EOF -nnoremap , :BufferLinePick -nnoremap ] :BufferLineCycleNext -nnoremap [ :BufferLineCyclePrev - " fugitive nnoremap gs :G20+ nnoremap gd :Gvdiff20+ -nnoremap gc :Gcommit20+ +nnoremap gc :Git commit20+ nnoremap gw :Gwrite20+ -nnoremap gb :Gblame20+ +nnoremap gb :Git blame20+ " fzf -nnoremap , :Files -nnoremap . :Buffers -nnoremap l :Lines -nnoremap a :Rg -nnoremap h :History: -nnoremap / :History/ -nnoremap c :Commits - -" EasyMotion -let g:EasyMotion_do_mapping=0 -let g:EasyMotion_smartcase=1 -nmap j (easymotion-overwin-f2) +nnoremap , lua require('fzf-lua').files() +nnoremap ` lua require('fzf-lua').files({ cwd = '~/' }) +nnoremap . lua require('fzf-lua').buffers() +nnoremap l lua require('fzf-lua').lines() +nnoremap a lua require('fzf-lua').grep_project() +nnoremap ; lua require('fzf-lua').command_history() +nnoremap / lua require('fzf-lua').search_history() +nnoremap c lua require('fzf-lua').git_commits() +nnoremap b lua require('fzf-lua').git_branches() + +" Hop +nnoremap j lua require('hop').hint_words() " Floaterm let g:floaterm_keymap_toggle = 't' -let g:floaterm_width = 0.9 -let g:floaterm_height = 0.62 +let g:floaterm_width = 0.8 +let g:floaterm_height = 0.8 let g:floaterm_autoclose = 1 let g:floaterm_opener = 'edit' let g:floaterm_borderchars = '─│─│╭╮╯╰' let g:floaterm_title = '' -hi FloatermBorder guibg='#282828' guifg='#a89984' +hi FloatermBorder guibg='#282828' guifg='#fbf1c7' nnoremap - :FloatermNew nnn nnoremap g :FloatermNew lazygit + + " COC.vim +" TODO LSP-alternatives +" nmap c (coc-rename) +" nmap e (coc-diagnostic-next) +" xmap f (coc-format-selected) +" nmap f (coc-format-selected) + inoremap \ pumvisible() ? coc#_select_confirm() : \ coc#expandableOrJumpable() ? "\=coc#rpc#request('doKeymap', ['snippets-expand-jump',''])\" : @@ -115,12 +136,6 @@ function! s:show_documentation() endif endfunction -" Leader mappings -nmap c (coc-rename) -nmap e (coc-diagnostic-next) -xmap f (coc-format-selected) -nmap f (coc-format-selected) - " Selection ranges nmap (coc-range-select) xmap (coc-range-select) diff --git a/tmux.conf b/tmux.conf index 0d5cc0a..5b738c9 100644 --- a/tmux.conf +++ b/tmux.conf @@ -25,7 +25,7 @@ bind -n WheelUpPane if-shell -F -t = "#{mouse_any_flag}" "send-keys -M" "if -Ft= bind -n WheelDownPane select-pane -t= \; send-keys -M bind -n C-WheelUpPane select-pane -t= \; copy-mode -e \; send-keys -M -# Custom statusbar +# Custom statusbar, gruvbox style set -g status-style bg=black,fg=yellow,default set -g pane-border-style 'fg=#504945' set -g pane-active-border-style 'fg=#504945' @@ -34,12 +34,11 @@ set -g display-panes-active-colour blue set -g display-panes-colour brightred set -g status-left-length 100 set -g status-right-length 100 -set -g status-left '#[fg=black,bg=white] ⧉ #S #[fg=white,bg=default,nobold]' -set -g status-right '#[fg=white,bg=default,nobold] #(whoami)@#h #[fg=black,bg=white,nobold] %d.%m.%Y ¦ %H:%M ' +set -g status-left '#[fg=black,bg=white] ⧉ #S #[fg=white,bg=default,nobold] ' +set -g status-right '#[fg=white,bg=default,nobold]#(whoami)@#h #[fg=black,bg=white,nobold] %d.%m.%Y ¦ %H:%M ' set -g window-status-format '#[fg=white,bg=default] #I #W ' set -g window-status-current-format '#[fg=blue,bg=black]#[fg=black,bg=blue] #I #W #[fg=blue,bg=black]#[fg=blue,bg=black,nobold]' - # Plugin configuration set -g @resurrect-processes 'nnn v nvim m neomutt' set -g @continuum-restore 'on' diff --git a/zsh/aliases b/zsh/aliases index 3f62369..eb209db 100644 --- a/zsh/aliases +++ b/zsh/aliases @@ -13,7 +13,6 @@ alias ggps='git push origin $(current_branch)' alias gmo='$EDITOR $(git ls-files -m)' alias gs="git status" alias lg='lazygit' -alias e='exa -la' alias m='neomutt' alias mutt='neomutt' alias nb="npm run build" diff --git a/zsh/exports b/zsh/exports index ba77ab9..99beabd 100644 --- a/zsh/exports +++ b/zsh/exports @@ -36,9 +36,6 @@ export PATH="$PYENV_ROOT/bin:$PATH" # fzf colors export FZF_DEFAULT_COMMAND="rg --files --hidden --follow --glob '!.git'" -export FZF_DEFAULT_OPTS=$FZF_DEFAULT_OPTS' - --color=fg:#cdcecf,bg:#192330,hl:#b4a2df,fg+:#cdcecf,bg+:#283648,hl+:#fabd2f - --color=info:#83a598,prompt:#bdae93,spinner:#fabd2f,pointer:#b4a2df,marker:#b4a2df,header:#665c54' # n node version management export N_PREFIX="$HOME/n"; [[ :$PATH: == *":$N_PREFIX/bin:"* ]] || PATH+=":$N_PREFIX/bin" # Added by n-install (see http://git.io/n-install-repo).