Skip to content

Instantly share code, notes, and snippets.

@r3nya
Created February 4, 2022 16:51
Show Gist options
  • Select an option

  • Save r3nya/49e980dd4ba35182b5ea14ea6cbbd1b8 to your computer and use it in GitHub Desktop.

Select an option

Save r3nya/49e980dd4ba35182b5ea14ea6cbbd1b8 to your computer and use it in GitHub Desktop.

Revisions

  1. r3nya created this gist Feb 4, 2022.
    101 changes: 101 additions & 0 deletions init.vim
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,101 @@
    " --- General

    let mapleader = " "

    " enables syntax highlighting
    syntax on

    " Better colors
    set termguicolors

    " number of spaces in a <Tab>
    set tabstop=4
    set softtabstop=4
    set expandtab

    " enable autoindents
    set smartindent

    " number of spaces used for autoindents
    set shiftwidth=4

    " adds line numbers
    set number
    set relativenumber

    " columns used for the line number
    set numberwidth=4

    " highlights the matched text pattern when searching
    set incsearch
    set nohlsearch

    " open splits intuitively
    set splitbelow
    set splitright

    " navigate buffers without losing unsaved work
    set hidden

    " start scrolling when 8 lines from top or bottom
    set scrolloff=8

    " Save undo history
    set undofile

    " Enable mouse support
    set mouse=a

    " case insensitive search unless capital letters are used
    set ignorecase
    set smartcase

    " --- Plugins
    call plug#begin('~/.config/nvim/plugged')

    Plug 'cormacrelf/vim-colors-github'
    Plug 'nvim-lua/plenary.nvim'
    Plug 'nvim-telescope/telescope.nvim'
    Plug 'editorconfig/editorconfig-vim'
    Plug 'itchyny/lightline.vim'
    " File explorer
    Plug 'kyazdani42/nvim-web-devicons' " for file icons
    Plug 'kyazdani42/nvim-tree.lua'

    call plug#end()

    " UI
    colorscheme github
    set background=light
    let g:lightline = {
    \ 'colorscheme': 'ayu_light',
    \ }

    " telescope
    " Find files using Telescope command-line sugar.
    nnoremap <leader>ff <cmd>Telescope find_files<cr>
    nnoremap <leader>fg <cmd>Telescope live_grep<cr>
    nnoremap <leader>fb <cmd>Telescope buffers<cr>
    nnoremap <leader>fh <cmd>Telescope help_tags<cr>
    lua <<EOF
    require('telescope').setup{ defaults = { file_ignore_patterns = { "node_modules" }} }

    vim.g.nvim_tree_show_icons = {
    git = 0,
    folders = 0,
    files = 0,
    folder_arrows = 0,
    }

    require'nvim-tree'.setup()
    EOF

    " No arrow keys --- force yourself to use hjkl
    nnoremap <up> <nop>
    nnoremap <down> <nop>
    " File explorer
    nnoremap <leader>tt :NvimTreeToggle<CR>
    nnoremap <leader>tr :NvimTreeRefresh<CR>
    nnoremap <leader>tn :NvimTreeFindFile<CR>