From 97b7e5b9191ad507fdb071857c5d05accf407dda Mon Sep 17 00:00:00 2001 From: Andrew Guschin Date: Sun, 20 Feb 2022 10:33:45 +0400 Subject: Moved vim config into .config/vim and changed plugin manager to vim-plug --- .config/nvim/autoload/projector.vim | 42 ------------------------ .config/nvim/init.vim | 64 ------------------------------------ .config/vim/init.vim | 65 +++++++++++++++++++++++++++++++++++++ 3 files changed, 65 insertions(+), 106 deletions(-) delete mode 100644 .config/nvim/autoload/projector.vim delete mode 100644 .config/nvim/init.vim create mode 100644 .config/vim/init.vim (limited to '.config') diff --git a/.config/nvim/autoload/projector.vim b/.config/nvim/autoload/projector.vim deleted file mode 100644 index 9c60055..0000000 --- a/.config/nvim/autoload/projector.vim +++ /dev/null @@ -1,42 +0,0 @@ -" Allows per-project configuration of keybindings. -" For example, '*.cpp make' will run make on F5 button push -" if .cpp file was opened -let s:commandFormat="au BufReadPost,BufNewFile %s map %s :!%s" - -" Files that plugin searches on startup (relative to pwd) -let s:allowedConfigPaths=[".vim/config", ".vim.conf", "vim.conf"] - -function! s:createCommand(line) - let line=split(a:line) - return printf(s:commandFormat, line[0], line[1], join(line[2:])) -endfunction - -function! s:parseFile(filename) - let commands=[] - for line in readfile(a:filename) - let commands=commands + [s:createCommand(line)] - endfor - return commands -endfunction - -function! s:getConfigs() - let commands=[] - for filename in s:allowedConfigPaths - if filereadable(filename) - let commands=commands + s:parseFile(filename) - endif - endfor - return commands -endfunction - -function! s:applyConfig(config) - for line in a:config - execute line - endfor -endfunction - -function! projector#init() - let config=s:getConfigs() - call s:applyConfig(config) -endfunction - diff --git a/.config/nvim/init.vim b/.config/nvim/init.vim deleted file mode 100644 index 41012e8..0000000 --- a/.config/nvim/init.vim +++ /dev/null @@ -1,64 +0,0 @@ -set nocompatible - -let g:nvim_config_root = expand(':p:h') -set rtp+=~/.config/nvim -set rtp+=~/.config/nvim/bundle/Vundle.vim -call vundle#begin('~/.config/nvim/bundle') - -Plugin 'VundleVim/Vundle.vim' -Plugin 'scrooloose/nerdcommenter' -Plugin 'vim-airline/vim-airline' - -call vundle#end() -filetype plugin indent on - -syntax on -set tabstop=4 -set softtabstop=4 -set shiftwidth=4 -set expandtab -set autochdir -set colorcolumn=80,120 -set formatprg=par\ -w80 -set autoread -au CursorHold,CursorHoldI * checktime -au FocusGained,BufEnter * :checktime - -" Enable clipboard buffer to be used as vim buffer -set clipboard=unnamedplus - -" Settings for gvim -set guioptions-=m "remove menu bar -set guioptions-=T "remove toolbar -set guioptions-=r "remove right-hand scroll bar -set guioptions-=L "remove left-hand scroll bar - -" Set line numbering rules -set relativenumber number -au InsertEnter * set number norelativenumber -au InsertLeave * set relativenumber - -let mapleader="\" - -" Remap splits shortcuts -nnoremap -nnoremap -nnoremap -nnoremap - -nmap s :vsplit -nmap vs :split -nmap f za - -" NERDCommenter config -let g:NERDSpaceDelims = 1 -let g:NERDCommentEmptyLines = 1 -let g:NERDTrimTrailingWhitespace = 1 -let g:NERDTreeChDirMode=2 - -" NERDCommenter shortcuts -nmap c -vmap c - -" Calling my script that allows per-project configuration of tasks keybindings -call projector#init() diff --git a/.config/vim/init.vim b/.config/vim/init.vim new file mode 100644 index 0000000..31f5f93 --- /dev/null +++ b/.config/vim/init.vim @@ -0,0 +1,65 @@ +set nocompatible + +set rtp+=$XDG_CONFIG_HOME/vim/ +call plug#begin("$XDG_CONFIG_HOME/vim/plugins") +Plug 'scrooloose/nerdcommenter' +Plug 'vim-airline/vim-airline' +Plug 'tpope/vim-commentary' +call plug#end() +filetype plugin indent on + +syntax on +set tabstop=4 +set softtabstop=4 +set shiftwidth=4 +set expandtab +set autochdir +set colorcolumn=80,120 +highlight ColorColumn ctermbg=8 guibg=lightgrey +set formatprg=par\ -w80 +set autoread +au CursorHold,CursorHoldI * checktime +au FocusGained,BufEnter * :checktime + +" Enable clipboard buffer to be used as vim buffer +" set clipboard=unnamedplus +set mouse=a + +" Settings for gvim +set guioptions-=m "remove menu bar +set guioptions-=T "remove toolbar +set guioptions-=r "remove right-hand scroll bar +set guioptions-=L "remove left-hand scroll bar + +" Set line numbering rules +set relativenumber number +au InsertEnter * set number norelativenumber +au InsertLeave * set relativenumber + +let mapleader="\" + +" Remap splits shortcuts +nnoremap +nnoremap +nnoremap +nnoremap + +nmap s :vsplit +nmap vs :split + +" NERDCommenter config +let g:NERDSpaceDelims = 1 +let g:NERDDefaultAlign = 'left' +let g:NERDCommentEmptyLines = 0 +let g:NERDTrimTrailingWhitespace = 1 +let g:NERDTreeChDirMode=2 + +" NERDCommenter shortcuts +nmap c +vmap c + +" Copy to clipboard +nmap y "+y +vmap y "+y +nmap d "+d +vmap d "+d -- cgit v1.2.3