From 7ac08713c8784218b78ccb928907f96522467542 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tanguy=20G=C3=A9r=C3=B4me?= Date: Mon, 14 Apr 2025 19:44:14 +0300 Subject: [PATCH] New neovim config --- .config/fish/config.fish | 10 ++++ .config/foot/foot.ini | 3 +- .config/nvim/init.lua | 105 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 117 insertions(+), 1 deletion(-) create mode 100644 .config/nvim/init.lua diff --git a/.config/fish/config.fish b/.config/fish/config.fish index aad61e7..073b334 100644 --- a/.config/fish/config.fish +++ b/.config/fish/config.fish @@ -25,9 +25,13 @@ if status is-interactive export PATH="$PATH:/Users/kapnoc/pkg/flutter/bin" + export PATH=":$HOME/.cargo/bin:$PATH:$HOME/.local/bin" + export EDITOR='nvim' export PAGER='less -R' + export GPG_TTY=(tty) + # common use aliases alias ..='cd ..' alias cl='clear' @@ -48,6 +52,12 @@ if status is-interactive alias gps='git push' alias gs='git status' + function wttr -a location + set -q location[1]; or set location "Helsinki" + curl -H "Accept-Language: $LANG" "wttr.in/$location?u" + end + + # less used aliases # wttr() # { diff --git a/.config/foot/foot.ini b/.config/foot/foot.ini index c1d4a93..610d318 100644 --- a/.config/foot/foot.ini +++ b/.config/foot/foot.ini @@ -2,6 +2,7 @@ # shell=$SHELL (if set, otherwise user's default shell from /etc/passwd) # term=foot (or xterm-256color if built with -Dterminfo=disabled) +term=xterm-256color # login-shell=no # app-id=foot # globally set wayland app-id. Default values are "foot" and "footclient" for desktop and server mode @@ -79,7 +80,7 @@ color = 2e3440 d8dee9 # long-press-delay=400 [colors] -# alpha=1.0 +alpha=0.9 # background=242424 # foreground=ffffff # flash=7f7f00 diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua new file mode 100644 index 0000000..9ccbb25 --- /dev/null +++ b/.config/nvim/init.lua @@ -0,0 +1,105 @@ +local vim = vim +local Plug = vim.fn['plug#'] + +vim.call('plug#begin') + +Plug 'tpope/vim-repeat' +Plug 'tpope/vim-commentary' +Plug 'tpope/vim-surround' +Plug 'jiangmiao/auto-pairs' +Plug 'mbbill/undotree' + +Plug 'ibhagwan/fzf-lua' + +Plug 'itchyny/lightline.vim' + +-- js/ts/... +Plug 'pangloss/vim-javascript' +Plug 'leafgarland/typescript-vim' +Plug 'peitalin/vim-jsx-typescript' + +-- html +Plug 'mattn/emmet-vim' + +Plug('neoclide/coc.nvim', {['branch'] = 'release'}) + +-- style +Plug 'loctvl842/monokai-pro.nvim' + +vim.call('plug#end') + + +vim.g.coc_global_extensions = { 'coc-tsserver', 'coc-html', 'coc-json', 'coc-pyright' } + +-- coc +vim.cmd([[if isdirectory('./node_modules') && isdirectory('./node_modules/prettier') + let g:coc_global_extensions += ['coc-prettier'] +endif]]) + +-- disabled eslint in favor of xo +vim.cmd([[if isdirectory('./node_modules') && isdirectory('./node_modules/eslint') + let g:coc_global_extensions += ['coc-eslint'] +endif]]) + +-- coc shortcuts +vim.cmd([[inoremap y coc#pum#visible() ? coc#pum#confirm() : "\"]]) +vim.cmd([[nnoremap gK :call CocAction('doHover')]]) +vim.cmd([[nmap gd (coc-definition)]]) +vim.cmd([[nmap gy (coc-type-definition)]]) +vim.cmd([[nmap gr (coc-references)]]) +vim.cmd([[nmap [g (coc-diagnostic-prev)]]) +vim.cmd([[nmap ]g (coc-diagnostic-next)]]) +vim.cmd([[nnoremap d :CocList diagnostics]]) +vim.cmd([[nnoremap s :CocList -I symbols]]) +vim.cmd([[nmap do (coc-codeaction)]]) +vim.cmd([[nmap rn (coc-rename)]]) +vim.cmd([[nmap xo :!npx xo --fix %]]) + + +local fzflua = require('fzf-lua') +fzflua.setup{ + files = { + find_opts = [[\( -path "*/build/*" -o -path "*/.git/*" -o -path "*/node_modules/*" \) -prune -false -o -type f]], + fd_opts = [[--color=never --hidden --type f --type l --exclude "(.git|node_modules)"]], + }, + grep = { + grep_opts = [[--exclude-dir=node_modules --exclude-dir=build --exclude-dir=.git --binary-files=without-match --line-number --recursive --color=auto -e]], + rg_opts = [[--glob '!{**/node_modules/,**/build/,.git/} --column --line-number --no-heading --color=always --smart-case --max-columns=4096 -e']] + } +} +vim.keymap.set('n', 'ff', fzflua.files, { desc = 'fzf-lua find files' }) +vim.keymap.set('n', 'fg', fzflua.live_grep, { desc = 'fzf-lua live grep' }) +vim.keymap.set('n', 'fb', fzflua.buffers, { desc = 'fzf-lua buffers' }) + +-- style +vim.g.t_Co = 256 +vim.cmd.colorscheme('monokai-pro-light') +vim.g.lightline = { colorscheme = 'monokaipro', mode_map = { n = 'N', i = 'I', R = 'R', v = 'V', V = 'VL', c = 'C', s = 'S', S = 'SL', t = 'T' }, active = { left = { { 'mode', 'paste' }, { 'readonly', 'relativepath', 'modified' } } } } + +-- select last paste in visual mode +vim.cmd([[nnoremap gb '`[' . strpart(getregtype(), 0, 1) . '`]']]) + +vim.bo.undofile=true + +vim.cmd([[ +" autocmd ColorScheme * highlight ExtraWhitespace ctermbg=red guibg=red +" autocmd Syntax * syn match ExtraWhitespace /\s\+$\| \+\ze\t/ + +" js/ts/... +autocmd Filetype javascript setlocal ts=2 sw=2 expandtab +autocmd Filetype typescript setlocal ts=2 sw=2 expandtab +autocmd Filetype json setlocal ts=2 sw=2 expandtab +autocmd Filetype typescriptreact setlocal ts=2 sw=2 expandtab +autocmd Filetype html setlocal ts=2 sw=2 expandtab +autocmd Filetype htmldjango setlocal ts=2 sw=2 expandtab +autocmd Filetype scss setlocal ts=2 sw=2 expandtab +autocmd Filetype css setlocal ts=2 sw=2 expandtab +autocmd Filetype python setlocal ts=4 sts=4 sw=4 expandtab +]]) + + + + + + +