dotfiles/.config/nvim/init.vim

126 lines
4.0 KiB
VimL

set nocompatible " disable compatibility to old-time vi
set showmatch " show matching
set hlsearch " highlight search
set incsearch " incremental search
set tabstop=4 " number of columns occupied by a tab
set softtabstop=4 " see multiple spaces as tabstops so <BS> does the right thing
set expandtab " converts tabs to white space
set shiftwidth=4 " width for autoindents
set autoindent " indent a new line the same amount as the line just typed
set number " add line numbers
set wildmode=longest,list " get bash-like tab completions
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
:imap jk <Esc>
" Set up colors
colorscheme murphy
highlight clear SignColumn
" Open and close terminal with shortcut
nnoremap <F4> :call vimterm#toggle() <CR>
tnoremap <F4> <C-\><C-n>:call vimterm#toggle() <CR>
" 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>
" Configure how we Git blame people
nnoremap <leader>gb <cmd>GitBlameToggle<cr>
let g:gitblame_enabled = 0
let g:gitblame_date_format = '%x'
let g:gitblame_highlight_group = "SignColumn"
call plug#begin()
" Fuzzy finder
Plug 'nvim-lua/plenary.nvim'
Plug 'nvim-telescope/telescope.nvim'
" Git blame
Plug 'f-person/git-blame.nvim'
" Marks plugin
Plug 'chentoast/marks.nvim'
" File Explorer for Nvim
Plug 'kyazdani42/nvim-web-devicons' " optional, for file icons
Plug 'kyazdani42/nvim-tree.lua'
" rust
Plug 'rust-lang/rust.vim'
call plug#end()
" Set up Marks plugin
lua << EOF
require'marks'.setup {
-- whether to map keybinds or not. default true
default_mappings = true,
-- which builtin marks to show. default {}
builtin_marks = { ".", "<", ">", "^" },
-- whether movements cycle back to the beginning/end of buffer. default true
cyclic = true,
-- whether the shada file is updated after modifying uppercase marks. default false
force_write_shada = false,
-- how often (in ms) to redraw signs/recompute mark positions.
-- higher values will have better performance but may cause visual lag,
-- while lower values may cause performance penalties. default 150.
refresh_interval = 250,
-- sign priorities for each type of mark - builtin marks, uppercase marks, lowercase
-- marks, and bookmarks.
-- can be either a table with all/none of the keys, or a single number, in which case
-- the priority applies to all marks.
-- default 10.
sign_priority = { lower=10, upper=15, builtin=8, bookmark=20 },
-- disables mark tracking for specific filetypes. default {}
excluded_filetypes = {},
-- marks.nvim allows you to configure up to 10 bookmark groups, each with its own
-- sign/virttext. Bookmarks can be used to group together positions and quickly move
-- across multiple buffers. default sign is '!@#$%^&*()' (from 0 to 9), and
-- default virt_text is "".
bookmark_0 = {
sign = "⚑",
virt_text = "hello world"
},
mappings = {}
}
EOF
" Set syntax highlighting
au BufNewFile,BufRead *.f set syntax=verilog
" Configure nvim-tree
nmap <leader>n :NvimTreeToggle <CR>
lua << EOF
-- disable netrw at the very start of your init.lua (strongly advised)
vim.g.loaded = 1
vim.g.loaded_netrwPlugin = 1
-- OR setup with some options
require'nvim-tree'.setup {
sort_by = "case_sensitive",
view = {
adaptive_size = true,
mappings = {
list = {
{ key = "u", action = "dir_up" },
},
},
},
renderer = {
group_empty = true,
},
filters = {
dotfiles = true,
},
}
EOF