diff options
-rw-r--r-- | general/settings.vim | 85 | ||||
-rw-r--r-- | init.vim | 37 | ||||
-rw-r--r-- | keys/mappings.vim | 79 | ||||
-rw-r--r-- | vim-plug/plugins.vim | 7 | ||||
-rw-r--r-- | vscode/windows.vim | 67 |
5 files changed, 183 insertions, 92 deletions
diff --git a/general/settings.vim b/general/settings.vim index ae86008f..5ea7d1ff 100644 --- a/general/settings.vim +++ b/general/settings.vim @@ -1,46 +1,51 @@ " set leader key map <Space> <Leader> -syntax enable " Enables syntax highlighing -set hidden " Required to keep multiple buffers open multiple buffers -set nowrap " Display long lines as just one line -set encoding=utf-8 " The encoding displayed -set pumheight=10 " Makes popup menu smaller -set fileencoding=utf-8 " The encoding written to file -set ruler " Show the cursor position all the time -set cmdheight=2 " More space for displaying messages -set iskeyword+=- " treat dash separated words as a word text object" -set mouse=a " Enable your mouse -set splitbelow " Horizontal splits will automatically be below -set splitright " Vertical splits will automatically be to the right -set t_Co=256 " Support 256 colors -set conceallevel=0 " So that I can see `` in markdown files -set foldcolumn=2 " Folding abilities -set tabstop=2 " Insert 2 spaces for a tab -set shiftwidth=2 " Change the number of space characters inserted for indentation -set smarttab " Makes tabbing smarter will realize you have 2 vs 4 -set expandtab " Converts tabs to spaces -set smartindent " Makes indenting smart -set autoindent " Good auto indent -set laststatus=0 " Always display the status line -set number " Line numbers -set cursorline " Enable highlighting of the current line -set background=dark " tell vim what the background color looks like -set showtabline=2 " Always show tabs -set noshowmode " We don't need to see things like -- INSERT -- anymore -set nobackup " This is recommended by coc -set nowritebackup " This is recommended by coc -set shortmess+=c " Don't pass messages to |ins-completion-menu|. -set signcolumn=yes " Always show the signcolumn, otherwise it would shift the text each time -set updatetime=300 " Faster completion -set timeoutlen=100 " By default timeoutlen is 1000 ms -set formatoptions-=cro " Stop newline continution of comments -set clipboard=unnamedplus " Copy paste between vim and everything else -"set autochdir " Your working directory will always be the same as your working directory +if !exists('g:vscode') + syntax enable " Enables syntax highlighing + set hidden " Required to keep multiple buffers open multiple buffers + set nowrap " Display long lines as just one line + set encoding=utf-8 " The encoding displayed + set pumheight=10 " Makes popup menu smaller + set fileencoding=utf-8 " The encoding written to file + set ruler " Show the cursor position all the time + set cmdheight=2 " More space for displaying messages + set iskeyword+=- " treat dash separated words as a word text object" + set mouse=a " Enable your mouse + set splitbelow " Horizontal splits will automatically be below + set splitright " Vertical splits will automatically be to the right + set t_Co=256 " Support 256 colors + set conceallevel=0 " So that I can see `` in markdown files + set tabstop=2 " Insert 2 spaces for a tab + set shiftwidth=2 " Change the number of space characters inserted for indentation + set smarttab " Makes tabbing smarter will realize you have 2 vs 4 + set expandtab " Converts tabs to spaces + set smartindent " Makes indenting smart + set autoindent " Good auto indent + set laststatus=0 " Always display the status line + set number " Line numbers + set cursorline " Enable highlighting of the current line + set background=dark " tell vim what the background color looks like + set showtabline=2 " Always show tabs + set noshowmode " We don't need to see things like -- INSERT -- anymore + set nobackup " This is recommended by coc + set nowritebackup " This is recommended by coc + set shortmess+=c " Don't pass messages to |ins-completion-menu|. + set signcolumn=yes " Always show the signcolumn, otherwise it would shift the text each time + set updatetime=300 " Faster completion + set timeoutlen=100 " By default timeoutlen is 1000 ms + set formatoptions-=cro " Stop newline continution of comments + set clipboard=unnamedplus " Copy paste between vim and everything else + set incsearch + " set autochdir " Your working directory will always be the same as your working directory + " set foldcolumn=2 " Folding abilities -au! BufWritePost $MYVIMRC source % " auto source when writing to init.vm alternatively you can run :source $MYVIMRC -autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o + au! BufWritePost $MYVIMRC source % " auto source when writing to init.vm alternatively you can run :source $MYVIMRC + autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o + + + " You can't stop me + cmap w!! w !sudo tee % +endif -" You can't stop me -cmap w!! w !sudo tee % @@ -1,16 +1,29 @@ -" Viml Plugins +" ____ _ __ _ +" / _/___ (_) /__ __(_)___ ___ +" / // __ \/ / __/ | / / / __ `__ \ +" _/ // / / / / /__| |/ / / / / / / / +"/___/_/ /_/_/\__(_)___/_/_/ /_/ /_/ + + +" Always source these source $HOME/.config/nvim/vim-plug/plugins.vim source $HOME/.config/nvim/general/settings.vim -source $HOME/.config/nvim/general/paths.vim source $HOME/.config/nvim/keys/mappings.vim -source $HOME/.config/nvim/themes/syntax.vim -source $HOME/.config/nvim/themes/onedark.vim -source $HOME/.config/nvim/themes/airline.vim -source $HOME/.config/nvim/plug-config/coc.vim -source $HOME/.config/nvim/plug-config/rnvimr.vim -source $HOME/.config/nvim/plug-config/fzf.vim -source $HOME/.config/nvim/plug-config/commentary.vim -source $HOME/.config/nvim/plug-config/rainbow.vim +source $HOME/.config/nvim/general/paths.vim -" Lua Plugins -lua require'plug-colorizer' +" Source depending on if VSCode is our client +if exists('g:vscode') + " VSCode extension + source $HOME/.config/nvim/vscode/windows.vim +else + " ordinary neovim + source $HOME/.config/nvim/themes/syntax.vim + source $HOME/.config/nvim/themes/onedark.vim + source $HOME/.config/nvim/themes/airline.vim + source $HOME/.config/nvim/plug-config/coc.vim + source $HOME/.config/nvim/plug-config/rnvimr.vim + source $HOME/.config/nvim/plug-config/fzf.vim + source $HOME/.config/nvim/plug-config/commentary.vim + source $HOME/.config/nvim/plug-config/rainbow.vim + lua require'plug-colorizer' +endif diff --git a/keys/mappings.vim b/keys/mappings.vim index 57a763f1..b1740c0d 100644 --- a/keys/mappings.vim +++ b/keys/mappings.vim @@ -1,42 +1,45 @@ -" Better nav for omnicomplete -inoremap <expr> <c-j> ("\<C-n>") -inoremap <expr> <c-k> ("\<C-p>") - -" Use alt + hjkl to resize windows -nnoremap <M-j> :resize -2<CR> -nnoremap <M-k> :resize +2<CR> -nnoremap <M-h> :vertical resize -2<CR> -nnoremap <M-l> :vertical resize +2<CR> - -" I hate escape more than anything else -inoremap jk <Esc> -inoremap kj <Esc> - -" Easy CAPS -inoremap <c-u> <ESC>viwUi -nnoremap <c-u> viwU<Esc> - -" TAB in general mode will move to text buffer -nnoremap <TAB> :bnext<CR> -" SHIFT-TAB will go back -nnoremap <S-TAB> :bprevious<CR> - -" Alternate way to save -nnoremap <C-s> :w<CR> -" Alternate way to quit -nnoremap <C-Q> :wq!<CR> -" Use control-c instead of escape -nnoremap <C-c> <Esc> -" <TAB>: completion. -inoremap <expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>" + +if !exists('g:vscode') + " Better nav for omnicomplete + inoremap <expr> <c-j> ("\<C-n>") + inoremap <expr> <c-k> ("\<C-p>") + + " I hate escape more than anything else + inoremap jk <Esc> + inoremap kj <Esc> + + " Easy CAPS + " inoremap <c-u> <ESC>viwUi + " nnoremap <c-u> viwU<Esc> + + " TAB in general mode will move to text buffer + nnoremap <TAB> :bnext<CR> + " SHIFT-TAB will go back + nnoremap <S-TAB> :bprevious<CR> + + " Alternate way to save + nnoremap <C-s> :w<CR> + " Alternate way to quit + nnoremap <C-Q> :wq!<CR> + " Use control-c instead of escape + nnoremap <C-c> <Esc> + " <TAB>: completion. + inoremap <expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>" + + + " Better window navigation + nnoremap <C-h> <C-w>h + nnoremap <C-j> <C-w>j + nnoremap <C-k> <C-w>k + nnoremap <C-l> <C-w>l + + " Use alt + hjkl to resize windows + nnoremap <M-j> :resize -2<CR> + nnoremap <M-k> :resize +2<CR> + nnoremap <M-h> :vertical resize -2<CR> + nnoremap <M-l> :vertical resize +2<CR> +endif " Better tabbing vnoremap < <gv vnoremap > >gv - -" Better window navigation -nnoremap <C-h> <C-w>h -nnoremap <C-j> <C-w>j -nnoremap <C-k> <C-w>k -nnoremap <C-l> <C-w>l - diff --git a/vim-plug/plugins.vim b/vim-plug/plugins.vim index e394b58e..c48b6c57 100644 --- a/vim-plug/plugins.vim +++ b/vim-plug/plugins.vim @@ -8,13 +8,16 @@ endif call plug#begin('~/.config/nvim/autoload/plugged') + if !exists('g:vscode') + " VSCode extension + " ordinary neovim " Better Syntax Support Plug 'sheerun/vim-polyglot' " Auto pairs for '(' '[' '{' Plug 'jiangmiao/auto-pairs' " Themes Plug 'christianchiarulli/onedark.vim' - Plug 'kaicataldo/material.vim' + " Plug 'kaicataldo/material.vim' " Intellisense Plug 'neoclide/coc.nvim', {'branch': 'release'} " Status Line @@ -31,7 +34,7 @@ call plug#begin('~/.config/nvim/autoload/plugged') " Add some color Plug 'norcalli/nvim-colorizer.lua' Plug 'junegunn/rainbow_parentheses.vim' - + endif call plug#end() diff --git a/vscode/windows.vim b/vscode/windows.vim new file mode 100644 index 00000000..436bf981 --- /dev/null +++ b/vscode/windows.vim @@ -0,0 +1,67 @@ + +"VSCode +function! s:split(...) abort + let direction = a:1 + let file = a:2 + call VSCodeCall(direction == 'h' ? 'workbench.action.splitEditorDown' : 'workbench.action.splitEditorRight') + if file != '' + call VSCodeExtensionNotify('open-file', expand(file), 'all') + endif +endfunction + +function! s:splitNew(...) + let file = a:2 + call s:split(a:1, file == '' ? '__vscode_new__' : file) +endfunction + +function! s:closeOtherEditors() + call VSCodeNotify('workbench.action.closeEditorsInOtherGroups') + call VSCodeNotify('workbench.action.closeOtherEditors') +endfunction + +function! s:manageEditorSize(...) + let count = a:1 + let to = a:2 + for i in range(1, count ? count : 1) + call VSCodeNotify(to == 'increase' ? 'workbench.action.increaseViewSize' : 'workbench.action.decreaseViewSize') + endfor +endfunction + +command! -complete=file -nargs=? Split call <SID>split('h', <q-args>) +command! -complete=file -nargs=? Vsplit call <SID>split('v', <q-args>) +command! -complete=file -nargs=? New call <SID>split('h', '__vscode_new__') +command! -complete=file -nargs=? Vnew call <SID>split('v', '__vscode_new__') +command! -bang Only if <q-bang> == '!' | call <SID>closeOtherEditors() | else | call VSCodeNotify('workbench.action.joinAllGroups') | endif + +nnoremap <silent> <C-w>s :call <SID>split('h')<CR> +xnoremap <silent> <C-w>s :call <SID>split('h')<CR> + +nnoremap <silent> <C-w>v :call <SID>split('v')<CR> +xnoremap <silent> <C-w>v :call <SID>split('v')<CR> + +nnoremap <silent> <C-w>n :call <SID>splitNew('h', '__vscode_new__')<CR> +xnoremap <silent> <C-w>n :call <SID>splitNew('h', '__vscode_new__')<CR> + +nnoremap <silent> <C-j> :call VSCodeNotify('workbench.action.focusBelowGroup')<CR> +xnoremap <silent> <C-j> :call VSCodeNotify('workbench.action.focusBelowGroup')<CR> +nnoremap <silent> <C-k> :call VSCodeNotify('workbench.action.focusAboveGroup')<CR> +xnoremap <silent> <C-k> :call VSCodeNotify('workbench.action.focusAboveGroup')<CR> +nnoremap <silent> <C-h> :call VSCodeNotify('workbench.action.focusLeftGroup')<CR> +xnoremap <silent> <C-h> :call VSCodeNotify('workbench.action.focusLeftGroup')<CR> +nnoremap <silent> <C-l> :call VSCodeNotify('workbench.action.focusRightGroup')<CR> +xnoremap <silent> <C-l> :call VSCodeNotify('workbench.action.focusRightGroup')<CR> + +nnoremap <silent> <C-w>= :<C-u>call VSCodeNotify('workbench.action.evenEditorWidths')<CR> +xnoremap <silent> <C-w>= :<C-u>call VSCodeNotify('workbench.action.evenEditorWidths')<CR> + +nnoremap <silent> <C-w>> :<C-u>call <SID>manageEditorSize(v:count, 'increase')<CR> +xnoremap <silent> <C-w>> :<C-u>call <SID>manageEditorSize(v:count, 'increase')<CR> +nnoremap <silent> <C-w>+ :<C-u>call <SID>manageEditorSize(v:count, 'increase')<CR> +xnoremap <silent> <C-w>+ :<C-u>call <SID>manageEditorSize(v:count, 'increase')<CR> +nnoremap <silent> <C-w>< :<C-u>call <SID>manageEditorSize(v:count, 'decrease')<CR> +xnoremap <silent> <C-w>< :<C-u>call <SID>manageEditorSize(v:count, 'decrease')<CR> +nnoremap <silent> <C-w>- :<C-u>call <SID>manageEditorSize(v:count, 'decrease')<CR> +xnoremap <silent> <C-w>- :<C-u>call <SID>manageEditorSize(v:count, 'decrease')<CR> + +nnoremap <silent> <C-w>_ :<C-u>call VSCodeNotify('workbench.action.toggleEditorWidths')<CR> + |