Last active
November 17, 2022 13:14
-
-
Save tomasflopes/2f9074b04e0104bf9ecfedc08d2af724 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set nocompatible " disable compatibility to old-time vi | |
set showmatch " show matching | |
set ignorecase " case insensitive | |
set mouse=v " middle-click paste with | |
set hlsearch " highlight search | |
set incsearch " incremental search | |
set termguicolors | |
set scrolloff=8 | |
set colorcolumn=80 | |
set nowrap | |
set tabstop=2 " number of columns occupied by a tab | |
set softtabstop=2 " see multiple spaces as tabstops so <BS> does the right thing | |
set expandtab " converts tabs to white space | |
set shiftwidth=2 " width for autoindents | |
set autoindent " indent a new line the same amount as the line just typed | |
set number " add line numbers | |
set relativenumber " add relative lines | |
set wildmode=longest,list " get bash-like tab completions | |
set cc=80 " set an 80 column border for good coding style | |
filetype plugin indent on "allow auto-indenting depending on file type | |
syntax on " syntax highlighting | |
set mouse=a " enable mouse click | |
set clipboard=unnamedplus " using system clipboard | |
filetype plugin on | |
set cursorline " highlight current cursorline | |
set ttyfast " Speed up scrolling in Vim | |
" set spell " enable spell check (may need to download language package) | |
" set noswapfile " disable creating swap file | |
" set backupdir=~/.cache/vim " Directory to store backup files. | |
call plug#begin() | |
" Plugin Section | |
Plug 'dracula/vim' | |
Plug 'SirVer/ultisnips' | |
Plug 'honza/vim-snippets' | |
Plug 'scrooloose/nerdtree' | |
Plug 'preservim/nerdcommenter' | |
Plug 'mhinz/vim-startify' | |
Plug 'ctrlpvim/ctrlp.vim' | |
Plug 'neoclide/coc.nvim', {'branch': 'release'} | |
Plug 'dyng/ctrlsf.vim' | |
Plug 'psliwka/vim-smoothie' | |
call plug#end() | |
" color schemes | |
syntax enable | |
" colorscheme evening | |
colorscheme dracula | |
" open new split panes to right and below | |
set splitright | |
set splitbelow | |
" use <tab> for trigger completion and navigate to the next complete item | |
function! s:check_back_space() abort | |
let col = col('.') - 1 | |
return !col || getline('.')[col - 1] =~ '\s' | |
endfunction | |
inoremap <silent><expr> <Tab> | |
\ pumvisible() ? "\<C-n>" : | |
\ <SID>check_back_space() ? "\<Tab>" : | |
\ coc#refresh() | |
" use <c-space>for trigger completion | |
inoremap <silent><expr> <c-space> coc#refresh() | |
inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>" | |
inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>" | |
" Coc Mappings | |
nmap <silent> gd <Plug>(coc-definition) | |
nmap <silent> gy <Plug>(coc-type-definiton) | |
nmap <silent> gi <Plug>(coc-implementations) | |
nmap <silent> gr <Plug>(coc-references) | |
nmap <silent> rn <Plug>(coc-rename) | |
" move line or visually selected block - alt+j/k | |
inoremap <A-j> <Esc>:m .+1<CR>==gi | |
inoremap <A-k> <Esc>:m .-2<CR>==gi | |
vnoremap <A-j> :m '>+1<CR>gv=gv | |
vnoremap <A-k> :m '<-2<CR>gv=gv | |
" move split panes to left/bottom/top/right | |
nnoremap <A-h> <C-W>H | |
nnoremap <A-j> <C-W>J | |
nnoremap <A-k> <C-W>K | |
nnoremap <A-l> <C-W>L | |
" move between panes to left/bottom/top/right | |
nnoremap <C-h> <C-w>h | |
nnoremap <C-j> <C-w>j | |
nnoremap <C-k> <C-w>k | |
nnoremap <C-l> <C-w>l | |
" Press i to enter insert mode, and ii to exit insert mode. | |
:inoremap ii <Esc> | |
:inoremap jk <Esc> | |
:inoremap kj <Esc> | |
:vnoremap jk <Esc> | |
:vnoremap kj <Esc> | |
nnoremap <silent> <C-T> :NERDTreeToggle<CR> | |
" open file in a text by placing text and gf | |
nnoremap gf :vert winc f<cr> | |
" copies filepath to clipboard by pressing yf | |
:nnoremap <silent> yf :let @+=expand('%:p')<CR> | |
" copies pwd to clipboard: command yd | |
:nnoremap <silent> yd :let @+=expand('%:p:h')<CR> | |
" Vim jump to the last position when reopening a file | |
if has("autocmd") | |
au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") | |
\| exe "normal! g'\"" | endif | |
endif | |
let g:ctrlp_working_path_mode = 'ra' | |
set wildignore+=*/tmp/*,*.so,*.swp,*.zip,*/vendor/bundle/*,*/node_modules/ | |
nmap <C-F>f <Plug>CtrlSFPrompt | |
nmap <C-F>n <Plug>CtrlSFCwordPath | |
nmap <C-F>p <Plug>CtrlSFPwordPath |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment