aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xCommon/nvim/lua/basic.lua4
-rwxr-xr-xCommon/nvim/lua/plugins.lua2
-rw-r--r--Common/vimrc411
3 files changed, 6 insertions, 411 deletions
diff --git a/Common/nvim/lua/basic.lua b/Common/nvim/lua/basic.lua
index 82c0194..9e40930 100755
--- a/Common/nvim/lua/basic.lua
+++ b/Common/nvim/lua/basic.lua
@@ -43,7 +43,7 @@ VIM User interface
--]]
-- Set 3 lines to the cursor - when moving vertically using j/k
-vim.opt.so = 3
+-- vim.opt.so = 3
-- set WildMenu
--vim.opt.wildmenu = true
@@ -56,7 +56,7 @@ vim.opt.wildignore:append('*/.git/*,*/.hg/*,*/.svn/*,*/.DS_Store')
--vim.opt.ruler = true
-- Hide buffers when they are abandoned
-vim.opt.hid = true
+-- vim.opt.hid = true
-- Make backspace function normally
vim.opt.backspace = 'eol,start,indent'
diff --git a/Common/nvim/lua/plugins.lua b/Common/nvim/lua/plugins.lua
index b08c2af..2866731 100755
--- a/Common/nvim/lua/plugins.lua
+++ b/Common/nvim/lua/plugins.lua
@@ -17,7 +17,7 @@ return require('packer').startup(function(use)
-- Packer itself :)
use 'wbthomason/packer.nvim'
- -- GitSigns
+ -- Git plugins
use {
'lewis6991/gitsigns.nvim',
config = function()
diff --git a/Common/vimrc b/Common/vimrc
index 098db18..fa27062 100644
--- a/Common/vimrc
+++ b/Common/vimrc
@@ -1,30 +1,3 @@
-
-"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
-" Maintainer:
-" jakobs1n
-"
-" Version:
-" 1.0 - 29/11/19
-"
-" Sections:
-" -> General
-" -> VIM user interface
-" -> Colors and Fonts
-" -> Files and backups
-" -> Text, tab and indent related
-" -> Visual mode related
-" -> Moving around, tabs and buffers
-" -> Status line
-" -> Editing mappings
-" -> vimgrep searching and cope displaying
-" -> Spell checking
-" -> Misc
-" -> Helper functions
-" -> Plugins
-"
-"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
-
-
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => General
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
@@ -43,9 +16,6 @@ set autoread
let mapleader = ","
let g:mapleader = ","
-" Fast saving
-nmap <leader>w :w!<cr>
-
" :W sudo saves the file
" (useful for handling the permission-denied error)
command W w !sudo tee % > /dev/null
@@ -54,32 +24,17 @@ command W w !sudo tee % > /dev/null
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => VIM user interface
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
-" Set 7 lines to the cursor - when moving vertically using j/k
-set so=7
-
-" Avoid garbled characters in Chinese language windows OS
-let $LANG='en'
-set langmenu=en
-source $VIMRUNTIME/delmenu.vim
-source $VIMRUNTIME/menu.vim
+set so=3
" Turn on the WiLd menu
set wildmenu
" Ignore compiled files
-set wildignore=*.o,*~,*.pyc
-if has("win16") || has("win32")
- set wildignore+=.git\*,.hg\*,.svn\*
-else
- set wildignore+=*/.git/*,*/.hg/*,*/.svn/*,*/.DS_Store
-endif
+set wildignore+=*/.git/*,*/.hg/*,*/.svn/*,*/.DS_Store
"Always show current position
set ruler
-" Height of the command bar
-"set cmdheight=2
-
" A buffer becomes hidden when it is abandoned
set hid
@@ -116,15 +71,6 @@ set novisualbell
set t_vb=
set tm=500
-" Properly disable sound on errors on MacVim
-if has("gui_macvim")
- autocmd GUIEnter * set vb t_vb=
-endif
-
-
-" Add a bit extra margin to the left
-set foldcolumn=1
-
" Show leader commands
set showcmd
@@ -137,26 +83,7 @@ set colorcolumn=80
" Enable syntax highlighting
syntax enable
-" Enable 256 colors palette in Gnome Terminal
-if $COLORTERM == 'gnome-terminal'
- set t_Co=256
-endif
-
-try
- colorscheme ron
-
-catch
-endtry
-"so ~/.vim/ThemerVim.vim
-"set background=dark
-
-" Set extra options when running in GUI mode
-if has("gui_running")
- set guioptions-=T
- set guioptions-=e
- set t_Co=256
- set guitablabel=%M\ %t
-endif
+set background=light
" Set utf8 as standard encoding and en_US as the standard language
set encoding=utf8
@@ -183,43 +110,18 @@ set noswapfile
" Use spaces instead of tabs
set expandtab
-" Be smart when using tabs ;)
-" set smarttab
-
" 1 tab == 4 spaces
set shiftwidth=4
set tabstop=4
set softtabstop=4
-" Linebreak on 500 characters
-set lbr
-set tw=500
-
set ai "Auto indent
set si "Smart indent
set wrap "Wrap lines
-" Set options for spesific filetypes
-autocmd FileType vhd setlocal shiftwidth=2
-autocmd FileType vhd setlocal shiftwidth=2
-
-
-""""""""""""""""""""""""""""""
-" => Visual mode related
-""""""""""""""""""""""""""""""
-" Visual mode pressing * or # searches for the current selection
-" Super useful! From an idea by Michael Naumann
-vnoremap <silent> * :<C-u>call VisualSelection('', '')<CR>/<C-R>=@/<CR><CR>
-vnoremap <silent> # :<C-u>call VisualSelection('', '')<CR>?<C-R>=@/<CR><CR>
-
-
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Moving around, tabs, windows and buffers
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
-" Map <Space> to / (search) and Ctrl-<Space> to ? (backwards search)
-map <space> /
-map <c-space> ?
-
" Disable highlight when <leader><cr> is pressed
map <silent> <leader><cr> :noh<cr>
@@ -229,42 +131,6 @@ map <C-k> <C-W>k
map <C-h> <C-W>h
map <C-l> <C-W>l
-" Close the current buffer
-map <leader>bd :Bclose<cr>:tabclose<cr>gT
-
-" Close all the buffers
-map <leader>ba :bufdo bd<cr>
-
-map <leader>l :bnext<cr>
-map <leader>h :bprevious<cr>
-
-" Useful mappings for managing tabs
-map <leader>tn :tabnew<cr>
-map <leader>to :tabonly<cr>
-map <leader>tc :tabclose<cr>
-map <leader>tm :tabmove
-map <leader>t<leader> :tabnext<cr>
-
-" Let 'tl' toggle between this and the last accessed tab
-let g:lasttab = 1
-nmap <Leader>tl :exe "tabn ".g:lasttab<CR>
-au TabLeave * let g:lasttab = tabpagenr()
-
-
-" Opens a new tab with the current buffer's path
-" Super useful when editing files in the same directory
-map <leader>te :tabedit <c-r>=expand("%:p:h")<cr>/
-
-" Switch CWD to the directory of the open buffer
-map <leader>cd :cd %:p:h<cr>:pwd<cr>
-
-" Specify the behavior when switching between buffers
-try
- set switchbuf=useopen,usetab,newtab
- set stal=2
-catch
-endtry
-
" Return to last edit position when opening files (You want this!)
au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
@@ -286,69 +152,12 @@ endif
" Always show the status line
set laststatus=2
-" Format the status line
-" TODO: Check this thing!
-" set statusline=\ %{HasPaste()}%F%m%r%h\ %w\ \ CWD:\ %r%{getcwd()}%h\ \ \ Line:\ %l\ \ Column:\ %c
-
-
-"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
-" => Editing mappings
-"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
-" Remap VIM 0 to first non-blank character
-map 0 ^
-
-" Move a line of text using ALT+[jk] or Command+[jk] on mac
-nmap <M-j> mz:m+<cr>`z
-nmap <M-k> mz:m-2<cr>`z
-vmap <M-j> :m'>+<cr>`<my`>mzgv`yo`z
-vmap <M-k> :m'<-2<cr>`>my`<mzgv`yo`z
-
-if has("mac") || has("macunix")
- nmap <D-j> <M-j>
- nmap <D-k> <M-k>
- vmap <D-j> <M-j>
- vmap <D-k> <M-k>
-endif
-
-" Delete trailing white space on save, useful for some filetypes ;)
-fun! CleanExtraSpaces()
- let save_cursor = getpos(".")
- let old_query = getreg('/')
- silent! %s/\s\+$//e
- call setpos('.', save_cursor)
- call setreg('/', old_query)
-endfun
-
-if has("autocmd")
- autocmd BufWritePre *.txt,*.js,*.py,*.wiki,*.sh,*.coffee :call CleanExtraSpaces()
-endif
-
-
-"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
-" => Spell checking
-"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
-" Pressing ,ss will toggle and untoggle spell checking
-map <leader>ss :setlocal spell!<cr>
-
-" Shortcuts using <leader>
-map <leader>sn ]s
-map <leader>sp [s
-map <leader>sa zg
-map <leader>s? z=
-
-
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Misc
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
-" Remove the Windows ^M - when the encodings gets messed up
-noremap <Leader>m mmHmt:%s/<C-V><cr>//ge<cr>'tzt'm
-
" Quickly open a buffer for scribble
map <leader>q :e ~/buffer<cr>
-" Quickly open a markdown buffer for scribble
-map <leader>x :e ~/buffer.md<cr>
-
" Toggle paste mode on and off
map <leader>pp :setlocal paste!<cr>
@@ -360,10 +169,6 @@ set title
" Toggle displaying special characters
map <leader><tab> :call ToggleListChars()<cr>
-" Load and save session
-map <leader>sm :mksession! vim_session.vim<cr>
-map <leader>sl :source vim_session.vim<cr>
-
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Helper functions
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
@@ -388,213 +193,3 @@ function! HasPaste()
endif
return ''
endfunction
-
-" Don't close window, when deleting a buffer
-command! Bclose call <SID>BufcloseCloseIt()
-function! <SID>BufcloseCloseIt()
- let l:currentBufNum = bufnr("%")
- let l:alternateBufNum = bufnr("#")
-
- if buflisted(l:alternateBufNum)
- buffer #
- else
- bnext
- endif
-
- if bufnr("%") == l:currentBufNum
- new
- endif
-
- if buflisted(l:currentBufNum)
- execute("bdelete! ".l:currentBufNum)
- endif
-endfunction
-
-function! CmdLine(str)
- exe "menu Foo.Bar :" . a:str
- emenu Foo.Bar
- unmenu Foo
-endfunction
-
-function! VisualSelection(direction, extra_filter) range
- let l:saved_reg = @"
- execute "normal! vgvy"
-
- let l:pattern = escape(@", "\\/.*'$^~[]")
- let l:pattern = substitute(l:pattern, "\n$", "", "")
-
- if a:direction == 'gv'
- call CmdLine("Ack '" . l:pattern . "' " )
- elseif a:direction == 'replace'
- call CmdLine("%s" . '/'. l:pattern . '/')
- endif
-
- let @/ = l:pattern
- let @" = l:saved_reg
-endfunction
-
-
-"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
-" => Plugins
-"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
-
-call plug#begin()
-Plug 'scrooloose/nerdTree'
-Plug 'ctrlpvim/ctrlp.vim'
-Plug 'bling/vim-airline'
-Plug 'vim-airline/vim-airline-themes'
-Plug 'tpope/vim-fugitive'
-Plug 'ARM9/arm-syntax-vim'
-Plug 'airblade/vim-gitgutter'
-Plug 'junegunn/fzf'
-Plug 'junegunn/fzf.vim'
-Plug 'terryma/vim-multiple-cursors'
-Plug 'preservim/nerdcommenter'
-Plug 'neoclide/coc.nvim', {'branch': 'release'}
-Plug 'evanleck/vim-svelte', {'branch': 'main'}
-Plug 'preservim/tagbar'
-Plug 'evanleck/vim-svelte', {'branch': 'main'}
-Plug 'tpope/vim-dadbod'
-Plug 'christoomey/vim-tmux-navigator'
-Plug 'tpope/vim-dotenv'
-Plug 'kristijanhusak/vim-dadbod-ui'
-Plug 'zivyangll/git-blame.vim'
-Plug 'smithbm2316/centerpad.nvim'
-
-"Plug 'neoclide/coc-tsserver', {'do': 'yarn install --frozen-lockfile'}
-"Plug 'clangd/coc-clangd', {'do': 'yarn install --frozen-lockfile'}
-"Plug 'voldikss/coc-cmake', {'do': 'yarn install --frozen-lockfile'}
-"Plug 'neoclide/coc-css', {'do': 'yarn install --frozen-lockfile'}
-"Plug 'neoclide/coc-eslint', {'do': 'yarn install --frozen-lockfile'}
-"Plug 'neoclide/coc-highlight', {'do': 'yarn install --frozen-lockfile'}
-"Plug 'neoclide/coc-html', {'do': 'yarn install --frozen-lockfile'}
-"Plug 'neoclide/coc-java', {'do': 'yarn install --frozen-lockfile'}
-"Plug 'fannheyward/coc-pyright', {'do': 'yarn install --frozen-lockfile'}
-"Plug 'josa42/coc-sh', {'do': 'yarn install --frozen-lockfile'}
-"Plug 'fannheyward/coc-texlab', {'do': 'yarn install --frozen-lockfile'}
-"Plug 'dense-analysis/ale'
-call plug#end()
-
-" Setup AirLine
-let g:airline_powerline_fonts = 1
-if !exists('g:airline_symbols')
- let g:airline_symbols = {}
-endif
-"let g:airline_symbols.space = "\ua0"
-
-let g:airline#extensions#tabline#enabled = 1
-let g:airline#extensions#tabline#show_buffers = 0
-let g:airline_theme='minimalist'
-
-let g:airline#extensions#hunks#enabled=0
-let g:airline#extensions#branch#enabled=1
-
-" Setup NerdTree
-let NERDTreeShowHidden=1
-map <F3> :NERDTreeToggle<CR>
-
-" Setup tagbar
-map <F2> :TagbarToggle<CR>
-
-" Map FuzzyFinder key to ;
-map ; :Files<CR>
-" Add fzf path for mac
-set rtp+=/usr/local/opt/fzf
-
-" Setup Coc
-" Always show the signcolumn, otherwise it would shift the text each time
-" diagnostics appear/become resolved.
-if has("patch-8.1.1564")
- " Recently vim can merge signcolumn and number column into one
- set signcolumn=number
-else
- set signcolumn=yes
-endif
-" Use tab for trigger completion with characters ahead and navigate.
-" NOTE: Use command ':verbose imap <tab>' to make sure tab is not mapped by
-" other plugin before putting this into your config.
-inoremap <silent><expr> <TAB>
- \ pumvisible() ? "\<C-n>" :
- \ <SID>check_back_space() ? "\<TAB>" :
- \ coc#refresh()
-inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>"
-
-function! s:check_back_space() abort
- let col = col('.') - 1
- return !col || getline('.')[col - 1] =~# '\s'
-endfunction
-
-" GoTo code navigation.
-nmap <silent> gd <Plug>(coc-definition)
-nmap <silent> gy <Plug>(coc-type-definition)
-nmap <silent> gi <Plug>(coc-implementation)
-nmap <silent> gr <Plug>(coc-references)
-
-" Use K to show documentation in preview window.
-nnoremap <silent> K :call <SID>show_documentation()<CR>
-
-function! s:show_documentation()
- if (index(['vim','help'], &filetype) >= 0)
- execute 'h '.expand('<cword>')
- elseif (coc#rpc#ready())
- call CocActionAsync('doHover')
- else
- execute '!' . &keywordprg . " " . expand('<cword>')
- endif
-endfunction
-
-" Attempt to make pyright don't care about git root
-autocmd FileType python let b:coc_root_patterns = ['.git', '.env']
-
-" Highlight the symbol and its references when holding the cursor.
-autocmd CursorHold * silent call CocActionAsync('highlight')
-
-" Symbol renaming.
-nmap <leader>rn <Plug>(coc-rename)
-
-" Formatting selected code.
-xmap <leader>f <Plug>(coc-format-selected)
-nmap <leader>f <Plug>(coc-format-selected)
-
-
-" vim-multiple-cursors
-let g:multi_cursor_use_default_mapping=0
-
-" Default mapping
-let g:multi_cursor_start_word_key = '<C-d>'
-let g:multi_cursor_select_all_word_key = '<A-d>'
-let g:multi_cursor_start_key = 'g<C-d>'
-let g:multi_cursor_select_all_key = 'g<A-d>'
-let g:multi_cursor_next_key = '<C-d>'
-let g:multi_cursor_prev_key = '<C-p>'
-let g:multi_cursor_skip_key = '<C-x>'
-let g:multi_cursor_quit_key = '<Esc>'
-
-" vim-tmux-naviagtor
-nnoremap <C-J> <C-W><C-J>
-nnoremap <C-K> <C-W><C-K>
-nnoremap <C-L> <C-W><C-L>
-nnoremap <C-H> <C-W><C-H>
-
-" dadbod
-xnoremap <expr> <Plug>(DBExe) db#op_exec()
-nnoremap <expr> <Plug>(DBExe) db#op_exec()
-nnoremap <expr> <Plug>(DBExeLine) db#op_exec() . '_'
-
-xmap <leader>db <Plug>(DBExe)
-nmap <leader>db <Plug>(DBExe)
-omap <leader>db <Plug>(DBExe)
-nmap <leader>dbb <Plug>(DBExeLine)
-
-autocmd FileType dbout setlocal nofoldenable
-
-if !empty(glob("~/.env.vim"))
- source ~/.env.vim
-endif
-
-" git-blame
-nnoremap <Leader>s :<C-u>call gitblame#echo()<CR>
-
-" Disable annoying svelte indenting
-let g:svelte_indent_script = 0
-let g:svelte_indent_style = 0