Last active
November 25, 2022 15:08
-
-
Save dimitriacosta/6649561d64d5a1ae8779e9f9a37ccc7e to your computer and use it in GitHub Desktop.
Vim Settings
This file contains 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
if has("gui_running") | |
" Add a little space to the line number column | |
set foldcolumn=2 | |
" Set the background of the line number to match the theme background | |
hi LineNr guibg=bg | |
" Set the background color for the foldcolumn to match the theme background | |
hi foldcolumn guibg=bg | |
" Remove splits separators | |
hi VertSplit guifg=bg guibg=bg | |
" Use the tallest window as possible | |
set lines=999 | |
" Hide fold column | |
set foldcolumn=0 | |
"-----MacVim Only-----" | |
if has("gui_macvim") | |
" Set the default theme | |
colorscheme nord | |
" Set font type and size | |
set guifont=Hasklig:h15 | |
" Don't show GUI tabs | |
set guioptions-=e | |
" Hide left-hand scrollbar | |
set guioptions-=l | |
" Hide left-hand scrollbar on splits | |
set guioptions-=L | |
" Hide right-hand scrollbar | |
set guioptions-=r | |
" Hide right-hand scrollbar no splits | |
set guioptions-=R | |
" Set the vertical height | |
set linespace=2 | |
" Show ligatures | |
set macligatures | |
" Start MacVim in fullscreeen | |
set fullscreen | |
" Disable GUI shortcut for cmd+p | |
macmenu &File.Print key=<nop> | |
" Show NERDTree with cmd+1 | |
nmap <D-1> :NERDTreeToggle<cr> | |
endif | |
"-----Linux Only-----" | |
if has("gui_gtk2") || has("gui_gtk3") | |
set guifont=Fira\ Mono\ for\ Powerline | |
" Show NERDTree with alt+1 | |
nmap <M-1> :NERDTreeToggle<cr> | |
endif | |
endif |
This file contains 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
" Import plugins | |
so ~/.vim/plugins.vim | |
" Higlight syntax | |
syntax enable | |
" Fix backspace behaviour | |
set backspace=indent,eol,start | |
" Set the leader to comma | |
let mapleader=',' | |
" Hide line numbers | |
set number | |
" Show relative line numbers | |
set relativenumber | |
" Set tab width to 4 columns | |
set tabstop=4 | |
" Set reverse tab width to 4 columns | |
set softtabstop=4 | |
" Insert 4 spaces when tab is pressed | |
set shiftwidth=4 | |
" Use spaces instead of tabs | |
set expandtab | |
" Show the line and column number of the cursor position | |
set ruler | |
" Display the incomplete commands in the bottom right-hand side of your screen. | |
set showcmd | |
" Ignore case when searching | |
set ignorecase | |
" Override the 'ignorecase' option if the search pattern contains upper case characters. | |
set smartcase | |
" Avoid issues related to unicode. | |
set encoding=utf-8 | |
" Show an identifier of the current line | |
set cursorline | |
"-----Visuals-----" | |
" Set the default theme | |
colorscheme nord | |
" Force 256 colors for terminal vim | |
set t_CO=256 | |
" Show a few lines of context around the cursor | |
set scrolloff=3 | |
" Display completion matches on your status line | |
set wildmenu | |
" Disable wrapping | |
set nowrap | |
" Allow us to switch buffers even if they haven't been unsaved | |
set hidden | |
" Use custom symbols for tabs and EOLs | |
set listchars=tab:▸\ ,eol:¬ | |
"-----Search-----" | |
" Highlight search query | |
set hlsearch | |
" Highlight search query as I type | |
set incsearch | |
"-----Split Management-----" | |
" Open splits below current window | |
set splitbelow | |
" Open splits to the right of the current window | |
set splitright | |
" Use Ctrl+H to navigate to left pane | |
nmap <C-H> <C-W><C-H> | |
" Use Ctrl+J to navigate to lower pane | |
nmap <C-J> <C-W><C-J> | |
" Use Ctrl+K to navigate to upper pane | |
nmap <C-K> <C-W><C-k> | |
" Use Ctrl+L to navigate to right pane | |
nmap <C-L> <C-W><C-L> | |
"-----Mappings-----" | |
" | |
" Normal mappings | |
" | |
" Edit ~/.vimrc with ,ev shortcut | |
nmap <Leader>ev :tabedit $MYVIMRC<CR> | |
" Edit ~/.gvimrc with ,eg shortcut | |
nmap <Leader>eg :tabedit $MYGVIMRC<CR> | |
" Edit ~/.vim/plugins.vim with ,ep shortcut | |
nmap <Leader>ep :tabedit ~/.vim/plugins.vim<CR> | |
" Remove search query highlight | |
nmap <Leader><space> :nohlsearc<CR> | |
" Toggle NERDTree | |
nmap <C-n> :NERDTreeToggle<CR> | |
" Open NERDTree on the current file location | |
nmap <Leader>f :NERDTreeFind<CR> | |
" Toggle special characters | |
nmap <Leader>l :set list!<CR> | |
" Toggle wrapping | |
nmap <Leader>w :set wrap!<CR> | |
" Toggle spell check | |
nmap <Leader>s :set spell!<CR> | |
" Toggle relative line numbers | |
nmap <Leader>r :set relativenumber!<CR> | |
" Toggle git line highlights | |
nmap <Leader>gt :GitGutterLineHighlightsToggle<CR> | |
" Run Go script | |
nmap <Leader>gr :GoRun<CR> | |
" Execute currenti Python script | |
nmap <Leader>pe :!python %<CR> | |
" Lint current Python script | |
nmap <Leader>pl :!pylint %<CR> | |
" | |
" Visual mappings | |
" | |
vmap ,su ! awk '{ print length(), $0 \| "sort -n \| cut -d\\ -f2-" }'<CR> | |
"-----Plugins-----" | |
"/ | |
"/ NERDTree | |
"/ | |
let g:NERDTreeHijackNetrw=0 | |
" let NERDTreeIgnore=['\.git$[[dir]]', '\.idea$[[dir]]', '\.swp$[[file]]'] | |
let NERDTreeHighlighCursorline=0 | |
let NERDTreeQuitOnOpen=3 | |
"/ | |
"/ NERDCommenter | |
"/ | |
let g:NERDSpaceDelims=1 | |
"/ | |
"/ CtrlP | |
"/ | |
let g:ctrlp_match_window='top,order:ttb,min:1,max:15,results:15' | |
let g:ctrlp_custom_ignore={ 'dir': '\v[\/](vendor|node_modules|\.git|\.idea)' } | |
nmap <D-p> :CtrlP<cr> | |
nmap <D-r> :CtrlPBufTag<cr> | |
nmap <D-e> :CtrlPMRUFiles<cr> | |
"/ | |
"/ vim-airline | |
"/ | |
let g:airline_detect_modified=1 | |
let g:airline_detect_paste=1 | |
let g:airline_powerline_fonts=1 | |
"/ | |
"/ php-cs-fixer | |
"/ | |
" let g:php_cs_fixer_path='/Users/dimitriacosta/.composer/vendor/bin/php-cs-fixer' | |
" let g:php_cs_fixer_config_file='/Users/dimitriacosta/.phpcsfixer' | |
"-----Functions-----" | |
" Set tabstop, softtabstop and shiftwidth to the same value | |
command! -nargs=* Stab call Stab() | |
function! Stab() | |
let l:tabstop=1 * input('set tabstop = softtabstop = shiftwidth = ') | |
if l:tabstop > 0 | |
let &l:sts=l:tabstop | |
let &l:ts=l:tabstop | |
let &l:sw=l:tabstop | |
endif | |
call SummarizeTabs() | |
endfunction | |
function! SummarizeTabs() | |
try | |
echohl ModeMsg | |
echon 'tabstop='.&l:ts | |
echon ' shiftwidth='.&l:sw | |
echon ' softtabstop='.&l:sts | |
if &l:et | |
echon ' expandtab' | |
else | |
echon ' noexpandtab' | |
endif | |
finally | |
echohl None | |
endtry | |
endfunction | |
"-----Auto-Commands-----" | |
augroup autosourcing | |
autocmd! | |
autocmd BufWritePost $MYVIMRC source % | |
autocmd BufWritePost ~/.gvimrc source ~/.gvimrc | |
autocmd BufWritePost ~/.vim/plugins.vim source ~/.vim/plugins.vim | |
augroup END | |
if has("autocmd") | |
" Enable file type detection | |
filetype on | |
autocmd FileType css setlocal ts=2 sts=2 sw=2 et | |
autocmd FileType html setlocal ts=2 sts=2 sw=2 et | |
autocmd FileType yaml setlocal ts=2 sts=2 sw=2 et | |
autocmd FileType yml setlocal ts=2 sts=2 sw=2 et | |
autocmd FileType sh setlocal ts=4 sts=4 sw=4 et | |
autocmd FileType python,docset set ai ts=4 sts=4 sw=4 et | |
autocmd FileType php setlocal ts=4 sts=4 sw=4 et | |
autocmd FileType javascript setlocal ts=4 sts=4 sw=4 noet | |
endif |
This file contains 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 " be iMproved, required | |
filetype off " required | |
" set the runtime path to include Vundle and initialize | |
set rtp+=~/.vim/bundle/Vundle.vim | |
call vundle#begin() | |
" let Vundle manage Vundle, required | |
Plugin 'VundleVim/Vundle.vim' | |
" Plugin 'dracula/vim', { 'name': 'dracula' } | |
" Plugin 'jwalton512/vim-blade' | |
" Plugin 'sheerun/vim-polyglot' | |
" Plugin 'stephpy/vim-php-cs-fixer' | |
" Plugin 'trevordmiller/nova-vim' | |
Plugin 'airblade/vim-gitgutter' | |
Plugin 'arcticicestudio/nord-vim' | |
Plugin 'ctrlpvim/ctrlp.vim' | |
Plugin 'fatih/vim-go', { 'do': ':GoInstallBinaries' } | |
Plugin 'gosukiwi/vim-atom-dark' | |
Plugin 'jiangmiao/auto-pairs' | |
Plugin 'mattn/emmet-vim' | |
Plugin 'scrooloose/nerdcommenter' | |
Plugin 'scrooloose/nerdtree' | |
Plugin 'tpope/vim-fugitive' | |
Plugin 'tpope/vim-vinegar' | |
Plugin 'vim-airline/vim-airline' | |
" All of your Plugins must be added before the following line | |
call vundle#end() " required | |
filetype plugin indent on " required |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment