From 6321a8d62a9f1c1b9418d3e12569dee46114e9a6 Mon Sep 17 00:00:00 2001 From: dimti Date: Sat, 15 Apr 2023 13:34:06 +0300 Subject: [PATCH] * separate vimrc-full with own simple and lighten vimrc config * reformat yadm bootstrap script and adding it a pathogen & vim plugins install --- .config/starship.toml | 9 +- .config/yadm/bootstrap | 53 +++++---- .vimrc | 292 +++---------------------------------------------- .vimrc-full | 275 ++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 333 insertions(+), 296 deletions(-) create mode 100644 .vimrc-full diff --git a/.config/starship.toml b/.config/starship.toml index 36035c0..4fda482 100644 --- a/.config/starship.toml +++ b/.config/starship.toml @@ -5,11 +5,14 @@ $character\ """ right_format = """ +$fill\ $cmd_duration\ -$directory\ $git_branch\ $git_status\ $hostname\ +:\ +$directory\ +$fill\ """ add_newline = false @@ -36,6 +39,10 @@ truncate_to_repo = false truncation_length = 10 truncation_symbol = "…/" +[fill] +symbol = ' ' +style = 'black' + [git_branch] format = "[$branch]($style)" style = "242" diff --git a/.config/yadm/bootstrap b/.config/yadm/bootstrap index 2a32df5..b1517ae 100755 --- a/.config/yadm/bootstrap +++ b/.config/yadm/bootstrap @@ -44,31 +44,41 @@ install_spacevim() { curl -sLf https://spacevim.org/install.sh | bash } -download_font () { - url="https://raw.githubusercontent.com/ryanoasis/nerd-fonts/master/patched-fonts/SourceCodePro/Regular/complete/${1// /%20}" - path="/usr/share/fonts/$1" - if [[ -f "$path" && ! -s "$path" ]] - then - rm "$path" - fi - if [[ -f "$path" ]] - then - success "Downloaded $1" - else - info "Downloading $1" - curl -s -o "$path" "$url" - success "Downloaded $1" - fi +download_font() { + url="https://raw.githubusercontent.com/ryanoasis/nerd-fonts/master/patched-fonts/SourceCodePro/Regular/complete/${1// /%20}" + path="/usr/share/fonts/$1" + if [[ -f "$path" && ! -s "$path" ]]; then + rm "$path" + fi + if [[ -f "$path" ]]; then + success "Downloaded $1" + else + info "Downloading $1" + curl -s -o "$path" "$url" + success "Downloaded $1" + fi +} + +install_fonts() { + download_font "Sauce Code Pro Nerd Font Complete.ttf" + info "Updating font cache, please wait ..." + + fc-cache -fv >/dev/null + success "font cache done!" } -install_fonts () { - download_font "Sauce Code Pro Nerd Font Complete.ttf" - info "Updating font cache, please wait ..." +install_pathogen() { + mkdir -p ~/.vim/autoload ~/.vim/bundle - fc-cache -fv > /dev/null - success "font cache done!" + curl -LSso ~/.vim/autoload/pathogen.vim https://tpo.pe/pathogen.vim } +install_vim_plugins() { + cd ~/.vim/bundle + + git clone https://github.com/tpope/vim-sensible.git + git clone https://github.com/altercation/vim-colors-solarized.git +} #install_nix @@ -76,3 +86,6 @@ install_fonts () { #install_starship #install_spacevim + +install_pathogen +install_vim_plugins diff --git a/.vimrc b/.vimrc index 965b8d3..225324b 100644 --- a/.vimrc +++ b/.vimrc @@ -1,275 +1,17 @@ -" vim: set sw=2 et : - -" Configure plug.vim -if has('nvim') - let vimautoloaddir='~/.config/nvim/site/autoload' -else - let vimautoloaddir='~/.vim/autoload' -endif - -call plug#begin() - -" This is taking care of the plugins -Plug 'junegunn/vim-plug' - -" Neovim is sensible by default -if !has('nvim') - Plug 'tpope/vim-sensible' -endif - -" Editing eye-candy -Plug 'junegunn/goyo.vim' -Plug 'junegunn/limelight.vim' - -" Solarized colorscheme -Plug 'altercation/vim-colors-solarized' - -" Tmux .conf -Plug 'tmux-plugins/vim-tmux' -" Tmux Focus Events -Plug 'tmux-plugins/vim-tmux-focus-events' - -" Automatically detect indentation -Plug 'tpope/vim-sleuth' - -if has('nvim') - " Asynchronous make for neovim - Plug 'neomake/neomake' - " Automated code formatter - Plug 'sbdchd/neoformat' - " Popup terminal - Plug 'kassio/neoterm' - " Nice tree view - Plug 'kyazdani42/nvim-tree.lua' - " Icons for the tree view - Plug 'kyazdani42/nvim-web-devicons' - " A buffer bar - Plug 'noib3/nvim-cokeline' - " Better syntax recognition - Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'} - " Mason is now preferred over LSP Installer - Plug 'williamboman/mason.nvim' - " LSP config - Plug 'neovim/nvim-lspconfig' - Plug 'williamboman/mason-lspconfig.nvim' - " Auto completion - Plug 'hrsh7th/cmp-nvim-lsp' - Plug 'hrsh7th/cmp-nvim-lsp-signature-help' - Plug 'hrsh7th/cmp-buffer' - Plug 'hrsh7th/cmp-path' - Plug 'hrsh7th/cmp-cmdline' - Plug 'hrsh7th/nvim-cmp' - " Snippets - Plug 'hrsh7th/cmp-vsnip' - Plug 'hrsh7th/vim-vsnip' - Plug 'rafamadriz/friendly-snippets' - " Telescope for quick switching - Plug 'nvim-lua/plenary.nvim' - Plug 'nvim-telescope/telescope.nvim' - Plug 'nvim-telescope/telescope-fzf-native.nvim', { 'do': 'make' } - " Copliot here - Plug 'github/copilot.vim' - " Nice colours for our NeoVim - Plug 'ishan9299/nvim-solarized-lua' - Plug 'shaunsingh/solarized.nvim' - - " Show indent lines - Plug 'lukas-reineke/indent-blankline.nvim' - " Status line - Plug 'feline-nvim/feline.nvim' - " Dim inactive windows - Plug 'sunjon/shade.nvim' -endif - -call plug#end() - -if has('nvim') - " Add some colors - set termguicolors - colorscheme solarized-high - - " When writing a buffer (no delay), and on normal mode changes (after 750ms). - call neomake#configure#automake('nw', 750) - " Call Neomake when writing a buffer (no delay) - let g:neomake_open_list = 2 - - " Configure Cokeline - lua << EOF - require('cokeline').setup({ - show_if_buffers_are_at_least = 2 - }) - - local map = vim.api.nvim_set_keymap - - map('n', '', '(cokeline-focus-prev)', { silent = true }) - map('n', '', '(cokeline-focus-next)', { silent = true }) - map('n', 'h', '(cokeline-focus-prev)', { silent = true }) - map('n', 'l', '(cokeline-focus-next)', { silent = true }) -EOF - - " Configure completion and LSP - set completeopt=menu,menuone,noselect - autocmd BufWritePre * lua vim.lsp.buf.formatting_sync(nil, 4000) - - lua <'] = cmp.mapping.scroll_docs(-4), - [''] = cmp.mapping.scroll_docs(4), - [''] = cmp.mapping.complete(), - [''] = cmp.mapping.abort(), - [''] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. - }), - sources = cmp.config.sources({ - { name = 'nvim_lsp' }, - { name = 'nvim_lsp_signature_help' }, - { name = 'vsnip' }, - }, { - { name = 'buffer' }, - }) - }) - - require("mason").setup({ - automatic_installation = true, - }) - require("mason-lspconfig").setup() -EOF - - " Configure NvimTree - lua << EOF - require('nvim-tree').setup() -EOF - nmap n :NvimTreeToggle - - " Configure Telescope - lua << EOF - require('telescope').load_extension('fzf') -EOF - " Find files using Telescope command-line sugar. - nnoremap ff Telescope find_files - nnoremap fg Telescope live_grep - nnoremap fb Telescope buffers - nnoremap fh Telescope help_tags - - " Configure tree-sitter with folding - lua < - -" Configure Goyo -nmap ] :Goyo -function! s:goyo_enter() - if exists('$TMUX') - " Hide the status panel and zoom in the current pane - silent !tmux set status off - " This hackery checks whether the pane is zoomed and toggles the status if - " not - silent !tmux list-panes -F '\#F'|grep -q Z || tmux resize-pane -Z - endif - " All eyes on me - Limelight - " Resize after zoom - if !exists("g:goyo_width") - let g:goyo_width=80 - endif - if !exists("g:goyo_height") - let g:goyo_height='85%' - endif - execute "Goyo ".g:goyo_width."x".g:goyo_height - set scrolloff=999 -endfunction - -function! s:goyo_leave() - if exists('$TMUX') - " Show the status panel and zoom out the current pane - silent !tmux set status on - silent !tmux list-panes -F '\#F'|grep -q Z && tmux resize-pane -Z - endif - Limelight! - set scrolloff=5 -endfunction - -autocmd! User GoyoEnter nested call goyo_enter() -autocmd! User GoyoLeave nested call goyo_leave() - -" Configure Limelight -let g:limelight_conceal_ctermfg = 245 " Solarized Base1 -let g:limelight_conceal_guifg = '#8a8a8a' " Solarized Base1 - -""" -""" Visually indicate long columns -""" Taken from https://www.youtube.com/watch?v=aHm36-na4-4 -""" -highlight ColorColumn ctermbg=magenta -call matchadd('ColorColumn', '\%81v', 100) - -" Prefer two spaces -set shiftwidth=2 -set softtabstop=2 - -" Show me those tabs, BTW -set list -set listchars=trail:~,nbsp:␣,tab:▸\ - -" Easy moves through wrapped lines -nnoremap j gj -nnoremap k gk - -" Work with tmux mouse integration -set mouse=a - -if has('nvim') - set undodir=~/.config/nvim/undodir -else - set undodir=~/.vim/undodir -endif -set undofile +" https://github.com/tpope/vim-pathogen +execute pathogen#infect() + +" https://github.com/altercation/vim-colors-solarized +syntax enable +set background=dark +colorscheme solarized + +" https://vcs.wpstudio.ru/wpstudio/autodeploy +set tabstop=4 " The width of a TAB is set to 4. + " Still it is a \t. It is just that + " Vim will interpret it to be having + " a width of 4. +set shiftwidth=4 " Indents will have a width of 4 +set softtabstop=4 " Sets the number of columns for a TAB +set expandtab " Expand TABs to spaces +set paste " Prevent strange paddings on paste from clipboard diff --git a/.vimrc-full b/.vimrc-full new file mode 100644 index 0000000..965b8d3 --- /dev/null +++ b/.vimrc-full @@ -0,0 +1,275 @@ +" vim: set sw=2 et : + +" Configure plug.vim +if has('nvim') + let vimautoloaddir='~/.config/nvim/site/autoload' +else + let vimautoloaddir='~/.vim/autoload' +endif + +call plug#begin() + +" This is taking care of the plugins +Plug 'junegunn/vim-plug' + +" Neovim is sensible by default +if !has('nvim') + Plug 'tpope/vim-sensible' +endif + +" Editing eye-candy +Plug 'junegunn/goyo.vim' +Plug 'junegunn/limelight.vim' + +" Solarized colorscheme +Plug 'altercation/vim-colors-solarized' + +" Tmux .conf +Plug 'tmux-plugins/vim-tmux' +" Tmux Focus Events +Plug 'tmux-plugins/vim-tmux-focus-events' + +" Automatically detect indentation +Plug 'tpope/vim-sleuth' + +if has('nvim') + " Asynchronous make for neovim + Plug 'neomake/neomake' + " Automated code formatter + Plug 'sbdchd/neoformat' + " Popup terminal + Plug 'kassio/neoterm' + " Nice tree view + Plug 'kyazdani42/nvim-tree.lua' + " Icons for the tree view + Plug 'kyazdani42/nvim-web-devicons' + " A buffer bar + Plug 'noib3/nvim-cokeline' + " Better syntax recognition + Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'} + " Mason is now preferred over LSP Installer + Plug 'williamboman/mason.nvim' + " LSP config + Plug 'neovim/nvim-lspconfig' + Plug 'williamboman/mason-lspconfig.nvim' + " Auto completion + Plug 'hrsh7th/cmp-nvim-lsp' + Plug 'hrsh7th/cmp-nvim-lsp-signature-help' + Plug 'hrsh7th/cmp-buffer' + Plug 'hrsh7th/cmp-path' + Plug 'hrsh7th/cmp-cmdline' + Plug 'hrsh7th/nvim-cmp' + " Snippets + Plug 'hrsh7th/cmp-vsnip' + Plug 'hrsh7th/vim-vsnip' + Plug 'rafamadriz/friendly-snippets' + " Telescope for quick switching + Plug 'nvim-lua/plenary.nvim' + Plug 'nvim-telescope/telescope.nvim' + Plug 'nvim-telescope/telescope-fzf-native.nvim', { 'do': 'make' } + " Copliot here + Plug 'github/copilot.vim' + " Nice colours for our NeoVim + Plug 'ishan9299/nvim-solarized-lua' + Plug 'shaunsingh/solarized.nvim' + + " Show indent lines + Plug 'lukas-reineke/indent-blankline.nvim' + " Status line + Plug 'feline-nvim/feline.nvim' + " Dim inactive windows + Plug 'sunjon/shade.nvim' +endif + +call plug#end() + +if has('nvim') + " Add some colors + set termguicolors + colorscheme solarized-high + + " When writing a buffer (no delay), and on normal mode changes (after 750ms). + call neomake#configure#automake('nw', 750) + " Call Neomake when writing a buffer (no delay) + let g:neomake_open_list = 2 + + " Configure Cokeline + lua << EOF + require('cokeline').setup({ + show_if_buffers_are_at_least = 2 + }) + + local map = vim.api.nvim_set_keymap + + map('n', '', '(cokeline-focus-prev)', { silent = true }) + map('n', '', '(cokeline-focus-next)', { silent = true }) + map('n', 'h', '(cokeline-focus-prev)', { silent = true }) + map('n', 'l', '(cokeline-focus-next)', { silent = true }) +EOF + + " Configure completion and LSP + set completeopt=menu,menuone,noselect + autocmd BufWritePre * lua vim.lsp.buf.formatting_sync(nil, 4000) + + lua <'] = cmp.mapping.scroll_docs(-4), + [''] = cmp.mapping.scroll_docs(4), + [''] = cmp.mapping.complete(), + [''] = cmp.mapping.abort(), + [''] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. + }), + sources = cmp.config.sources({ + { name = 'nvim_lsp' }, + { name = 'nvim_lsp_signature_help' }, + { name = 'vsnip' }, + }, { + { name = 'buffer' }, + }) + }) + + require("mason").setup({ + automatic_installation = true, + }) + require("mason-lspconfig").setup() +EOF + + " Configure NvimTree + lua << EOF + require('nvim-tree').setup() +EOF + nmap n :NvimTreeToggle + + " Configure Telescope + lua << EOF + require('telescope').load_extension('fzf') +EOF + " Find files using Telescope command-line sugar. + nnoremap ff Telescope find_files + nnoremap fg Telescope live_grep + nnoremap fb Telescope buffers + nnoremap fh Telescope help_tags + + " Configure tree-sitter with folding + lua < + +" Configure Goyo +nmap ] :Goyo +function! s:goyo_enter() + if exists('$TMUX') + " Hide the status panel and zoom in the current pane + silent !tmux set status off + " This hackery checks whether the pane is zoomed and toggles the status if + " not + silent !tmux list-panes -F '\#F'|grep -q Z || tmux resize-pane -Z + endif + " All eyes on me + Limelight + " Resize after zoom + if !exists("g:goyo_width") + let g:goyo_width=80 + endif + if !exists("g:goyo_height") + let g:goyo_height='85%' + endif + execute "Goyo ".g:goyo_width."x".g:goyo_height + set scrolloff=999 +endfunction + +function! s:goyo_leave() + if exists('$TMUX') + " Show the status panel and zoom out the current pane + silent !tmux set status on + silent !tmux list-panes -F '\#F'|grep -q Z && tmux resize-pane -Z + endif + Limelight! + set scrolloff=5 +endfunction + +autocmd! User GoyoEnter nested call goyo_enter() +autocmd! User GoyoLeave nested call goyo_leave() + +" Configure Limelight +let g:limelight_conceal_ctermfg = 245 " Solarized Base1 +let g:limelight_conceal_guifg = '#8a8a8a' " Solarized Base1 + +""" +""" Visually indicate long columns +""" Taken from https://www.youtube.com/watch?v=aHm36-na4-4 +""" +highlight ColorColumn ctermbg=magenta +call matchadd('ColorColumn', '\%81v', 100) + +" Prefer two spaces +set shiftwidth=2 +set softtabstop=2 + +" Show me those tabs, BTW +set list +set listchars=trail:~,nbsp:␣,tab:▸\ + +" Easy moves through wrapped lines +nnoremap j gj +nnoremap k gk + +" Work with tmux mouse integration +set mouse=a + +if has('nvim') + set undodir=~/.config/nvim/undodir +else + set undodir=~/.vim/undodir +endif +set undofile