Skip to content

Instantly share code, notes, and snippets.

@semperprimum
Last active February 9, 2024 12:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save semperprimum/05d099631d6da6f5b35800081e949bf9 to your computer and use it in GitHub Desktop.
Save semperprimum/05d099631d6da6f5b35800081e949bf9 to your computer and use it in GitHub Desktop.
:set number
:set relativenumber
:set expandtab
:set autoindent
:set smartindent
:set tabstop=2
:set shiftwidth=2
:set mouse=a
:set encoding=UTF8
call plug#begin('~/.config/nvim/plugged')
Plug 'vim-airline/vim-airline' " Airline
Plug 'terryma/vim-multiple-cursors' " Multiple Cursors
Plug 'vim-airline/vim-airline-themes' " Airline Themes
Plug 'pocco81/auto-save.nvim' " Auto Save
Plug 'tpope/vim-commentary' " Comments
Plug 'preservim/nerdtree' " NERDTree
Plug 'tpope/vim-surround' " Vim Surround
Plug 'morhetz/gruvbox' " Gruvbox Theme
Plug 'cakebaker/scss-syntax.vim' " SCSS Syntax Highlighting
Plug 'ctrlpvim/ctrlp.vim' " Fzf
Plug 'ryanoasis/vim-devicons' " Icons (Devicons)
Plug 'othree/yajs.vim' " JavaScript Highlighting (YAJS)
Plug 'MaxMEllon/vim-jsx-pretty' " JSX Syntax Highlighting
Plug 'ap/vim-css-color' " CSS Colors
Plug 'neoclide/coc.nvim', {'branch': 'release'} " Autocomplete
Plug 'barrett-ruth/live-server.nvim' " Live Server
Plug 'styled-components/vim-styled-components' " Styled Components Syntax Highlighting
" Plug 'hail2u/vim-css3-syntax' " CSS3 Syntax Highlighting
" Plug 'pangloss/vim-javascript' " JavaScript Highlighting
call plug#end()
:set completeopt-=preview " For No Previews
:colorscheme gruvbox
" <esc> to clear selection after search
nnoremap <silent> <esc> :noh<CR>
" Shortcutting split navigation (only left & right)
map <C-h> <C-w>h
map <C-l> <C-w>l
" Leader + p to format a file
nnoremap <Leader>p :Prettier <CR>
"--Airline------------------------------------ "
let g:airline_left_sep = ''
let g:airline_right_sep = ""
let g:airline_theme='base16_gruvbox_dark_hard'
"--Live Server-------------------------------- "
:lua <<EOF
require('live-server').setup({
args = {
'--port=5500',
'--browser=/Applications/Firefox Developer Edition.app/'
},
})
EOF
"-- NERDTree---------------------------------- "
" Close the tab if NERDTree is the only window remaining in it.
autocmd BufEnter * if winnr('$') == 1 && exists('b:NERDTree') && b:NERDTree.isTabTree() | quit | endif
" Start NERDTree and leave the cursor in it.
" autocmd VimEnter * NERDTree
nnoremap <C-f> :NERDTreeFocus<CR>
nnoremap <C-n> :NERDTree<CR>
nnoremap <C-t> :NERDTreeToggle<CR>
let g:NERDTreeDirArrowExpandable="+"
let g:NERDTreeDirArrowCollapsable="~"
let NERDTreeShowHidden=1
let NERDTreeIgnore=['\.DS_Store$', '\~$']
"-- COC--------------------------------------- "
" <Tab> completion
inoremap <silent><expr> <Tab> coc#pum#visible() ? coc#pum#confirm() : "\<Tab>"
" :Prettier command
command! -nargs=0 Prettier :CocCommand prettier.forceFormatDocument
"-- Ctrlp------------------------------ "
" Ignore random files
let g:ctrlp_custom_ignore = '\v[\/](node_modules|target|dist)|(\.(swp|ico|git|svn))$'
" Check if NERDTree is open or active
function! IsNERDTreeOpen()
return exists("t:NERDTreeBufName") && (bufwinnr(t:NERDTreeBufName) != -1)
endfunction
" Call NERDTreeFind iff NERDTree is active, current window contains a modifiable
" file, and we're not in vimdiff
function! SyncTree()
if &modifiable && IsNERDTreeOpen() && strlen(expand('%')) > 0 && !&diff
NERDTreeFind
wincmd p
endif
endfunction
" Highlight currently open buffer in NERDTree
autocmd BufRead * call SyncTree()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment