Skip to content

Instantly share code, notes, and snippets.

@dhoboy
Last active July 25, 2023 02:08
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 dhoboy/150b5e5d7d59551d952d0e267f9515a7 to your computer and use it in GitHub Desktop.
Save dhoboy/150b5e5d7d59551d952d0e267f9515a7 to your computer and use it in GitHub Desktop.
My vimrc for neovim
" just for vim, since nvim removed :hardcopy
if (!has("nvim"))
set tabstop=2 softtabstop=2
set expandtab
set printoptions=header:0 " dont print a header with :hardcopy command
set clipboard=unnamed " yy copies to system clipboard
set textwidth=0
endif
" for a writing workflow in nvim just run :set wrap when you start up
if (has("nvim")) " all this breaks vim, and my ~/.gitconfig isn't finding nvim anymore but it was working for awhile
set nocompatible " not compatible with vi
set autoindent " keep indenting as i go
set guicursor= " block cursor
set mouse=a
set virtualedit=all
set ruler
set nohlsearch " set nohighlight search
set showcmd
set relativenumber
set nu " also show actual line number
set hidden " keeps unsaved buffers in memory
set noerrorbells " no noises from computer on error
set tabstop=2 softtabstop=2
set shiftwidth=2
set nowrap
set textwidth=0 wrapmargin=0 " so i dont wrap lines in files
set linebreak " only matters if you turn set wrap on, for writing long form text
set ignorecase
set smartcase
set incsearch " incremental search
set scrolloff=2 " starts scrolling 8 lines away from bottom
set colorcolumn=80 " big red line at 80 char line length
"set signcolumn=yes " shows git conflicts?
filetype plugin indent on
set clipboard=unnamed " yy copies to system clipboard
" No more ~ files polluting my directories!
set backupdir=~/.vim/tmp//,.
set directory=~/.vim/tmp//,.
set backupcopy=yes " attempting to get docker to stop compiling unnecessarily
if has("vms")
set nobackup " do not keep a backup file, use versions instead
else
set backup " keep a backup file (restore to previous version)
if has('persistent_undo')
set undofile " keep an undo file (undo changes after closing)
endif
endif
if &t_Co > 2 || has("gui_running")
" Switch on highlighting the last used search pattern.
set hlsearch
endif
" *** PLUGINS ***
" Plugins will be downloaded under the specified directory.
call plug#begin(has('nvim') ? stdpath('data') . '/plugged' : '~/.vim/plugged')
" Declare the list of plugins.
" General and Color theme
Plug 'tpope/vim-sensible'
Plug 'tpope/vim-commentary'
Plug 'tpope/vim-surround'
Plug 'evanleck/vim-svelte'
Plug 'sheerun/vim-polyglot'
Plug 'luochen1990/rainbow'
" i've been back and forth between joshdick and navarasu as treesitter,
" semantic highlighting, etc have messed up my color theme along the neovim journey
Plug 'navarasu/onedark.nvim'
" Plug 'joshdick/onedark.vim'
"Plug 'tomasiser/vim-code-dark'
"Plug 'ghifarit53/tokyonight-vim'
" Clojure
Plug 'guns/vim-sexp', {'for': 'clojure'}
Plug 'liquidz/vim-iced', {'for': 'clojure'}
Plug 'liquidz/vim-iced-coc-source'
Plug 'tpope/vim-sexp-mappings-for-regular-people'
" File Explorer
Plug 'kyazdani42/nvim-web-devicons' " for file icons
Plug 'kyazdani42/nvim-tree.lua'
" Telescope
Plug 'nvim-lua/popup.nvim'
Plug 'nvim-lua/plenary.nvim'
Plug 'nvim-telescope/telescope.nvim'
Plug 'nvim-telescope/telescope-fzy-native.nvim'
" Treesitter
Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'} " We recommend updating the parsers on update
Plug 'nvim-treesitter/playground'
" Lualine status line
Plug 'nvim-lualine/lualine.nvim'
" Nvim LSP
Plug 'neovim/nvim-lspconfig'
Plug 'jose-elias-alvarez/null-ls.nvim' " so you can hook into eslint, etc. deprecated, what will I migrate to? or just stop using eslint in favor of diagnostics + prettier
" Register helper
Plug 'tversteeg/registers.nvim'
" Formatter to run Prettier for js
Plug 'sbdchd/neoformat'
" My relative path thing
Plug 'dhoboy/relpath.vim'
" List ends here. Plugins become visible to Vim after this call.
call plug#end()
" *** USING PLUGINS....
set t_Co=256
syntax on
"Use 24-bit (true-color) mode in Vim/Neovim when outside tmux.
"If you're using tmux version 2.2 or later, you can remove the outermost $TMUX check and use tmux's 24-bit color support
"(see < http://sunaku.github.io/tmux-24bit-color.html#usage > for more information.)
if (empty($TMUX))
if (has("nvim"))
"For Neovim 0.1.3 and 0.1.4 < https://github.com/neovim/neovim/pull/2198 >
let $NVIM_TUI_ENABLE_TRUE_COLOR=1
endif
"For Neovim > 0.1.5 and Vim > patch 7.4.1799 < https://github.com/vim/vim/commit/61be73bb0f965a895bfb064ea3e55476ac175162 >
"Based on Vim patch 7.4.1770 (`guicolors` option) < https://github.com/vim/vim/commit/8a633e3427b47286869aa4b96f2bfc1fe65b25cd >
" < https://github.com/neovim/neovim/wiki/Following-HEAD#20160511 >
if (has("termguicolors"))
set termguicolors
endif
endif
" colorscheme codedark " i love this, but too dark background?
" let g:tokyonight_style = 'night' " available: night, storm
" colorscheme tokyonight
let g:rainbow_active = 1
" Configure plugin: Vim-sexp
let g:sexp_enable_insert_mode_mappings=0
" Configure plugin: Vim-iced
let g:iced_enable_default_key_mappings = v:true
let g:iced#nrepl#skip_evaluation_when_buffer_size_is_exceeded = v:true
aug VimIcedAutoFormatOnWriting
au!
" Format whole buffer on writing files
au BufWritePre *.clj,*.cljs,*.cljc,*.edn execute ':IcedFormatSyncAll'
" Format only current form on writing files
" au BufWritePre *.clj,*.cljs,*.cljc,*.edn execute ':IcedFormatSync'
aug END
" Configure plugin: Neoformat, works for js with prettier, mix format with
" elixir, and a lot more languages
let g:neoformat_try_node_exe = 1 " use copy of prettier in project's node modules if available
" doesn't work, but i need something like this to format the .heex files with
" neoformat on save. mix format formats heex files when run from the command
" line
" let g:neoformat_elixir_eelixir = {
" \ 'exe': 'mix',
" \ 'args': ['format'],
" \ 'stdin': 1,
" \ 'always_enabled': 1,
" \ }
autocmd BufWritePre *.js Neoformat " run prettier on save
autocmd BufWritePre *.css Neoformat " run prettier on save
autocmd BufWritePre *.ex Neoformat " run mix format on save
autocmd BufWritePre *.exs Neoformat " run mix format on save
autocmd BufWritePre *.heex Neoformat " run mix format on save
" Leader key stuff
let mapleader = "," " map leader to , I liked space but too much for my thumbs
map <leader>h :noh<CR>
" nnoremap is normal mode, no recursive execution, map: myBinding whatItRuns
" Clear search highlights with esc
nnoremap <esc> :noh<return><esc>
" trim all trailing whitespace on save hook
fun! TrimWhitespace()
let l:save = winsaveview()
keeppatterns %s/\s\+$//e
call winrestview(l:save)
endfun
augroup TRIM_THAT_WHITESPACE " thank you ThePrimeagen!
autocmd!
autocmd BufWritePre * :call TrimWhitespace()
augroup END
" Project File Explorer
" let g:nvim_tree_gitignore = 1 "0 by default
" let g:nvim_tree_indent_markers = 1 "0 by default, this option shows indent markers when folders are open
let g:nvim_tree_highlight_opened_files = 1 "0 by default, will enable folder and file icon highlight for opened files/directories.
let g:nvim_tree_show_icons = {
\ 'git': 1,
\ 'folders': 1,
\ 'files': 0,
\ 'folder_arrows': 0,
\ }
set termguicolors " this variable must be enabled for colors to be applied properly
" FYI -- this is all for the navarasu one dark theme. josh dick doesn't use this
" If you're looking for plugin-specific highlights see their documentation or readme.
" If you're looking for diagnostic highlights see :h diagnostic-highlights.
" Otherwise use something like :TSHighlightCapturesUnderCursor or see what
" highlight groups are implemented by various colorschemes
let g:onedark_config = {
\ 'style': 'dark',
\ 'toggle_style_key': '<leader>ts',
\ 'ending_tildes': v:true,
\ 'diagnostics': {
\ 'darker': v:false,
\ 'background': v:false,
\ 'hint_color': "#56b6c2",
\ },
\ 'code_style': {
\ 'comments': 'none'
\ },
\ 'highlights': {
\ '@parameter': { 'fg': "#abb2bf" },
\ '@property': { 'fg': "#abb2bf" },
\ '@warning': { 'fg': "#56b6c2" },
\ 'scss@type': { 'fg': "#56b6c2" },
\ 'css@property': { 'fg': "#56b6c2" },
\ 'scss@string': { 'fg': "#56b6c2" },
\ 'jsArrowFunction': { 'fg': "#c678dd" },
\ 'jsTemplateString': { 'fg': "#98c379" },
\ 'jsTemplateBraces': { 'fg': "#e86671" },
\ 'jsFuncArgs': { 'fg': "#abb2bf" },
\ 'jsFuncBlock': { 'fg': "#abb2bf" },
\ 'jsParen': { 'fg': "#abb2bf" },
\ 'jsArrowFuncArgs': { 'fg': "#abb2bf" },
\ 'jsStorageClass': { 'fg': "#c678dd" },
\ 'jsxTagName': { 'fg': "#61afef" },
\ 'jsxBraces': { 'fg': "#61afef" },
\ 'javascript@constructor': { 'fg': "#61afef" },
\ 'javascript@tag': { 'fg': "#61afef" },
\ 'javascript@tagDelimiter': { 'fg': "#848b98" },
\ 'javascript@tagAttribute': { 'fg': "#e5c07b" },
\ 'jsdoc@keyword': { 'fg': "#5c6370" },
\ 'comment@constant': { 'fg': "#5c6370" },
\ 'javascript@operator': { 'fg': "#c678dd" },
\ 'DiagnosticHint': { 'fg': "#56b6c2" },
\ 'DiagnosticVirtualTextHint': { 'fg': "#56b6c2" },
\ },
\ }
colorscheme onedark
" a list of groups can be found at `:help nvim_tree_highlight`
" highlight NvimTreeFolderIcon guibg=blue
" This is a work around for the fact that neovim at
" version 0.9 added semantic highlighting to neovim, and they take precendence
" over treesitter, and colorthemes have to update themselves to work with it
" and navarasu onedark hasn't updated yet.
" https://www.reddit.com/r/neovim/comments/12gvms4/this_is_why_your_higlights_look_different_in_90/
lua << EOF
for _, group in ipairs(vim.fn.getcompletion("@lsp", "highlight")) do
vim.api.nvim_set_hl(0, group, {})
end
EOF
lua << EOF
require'nvim-tree'.setup {
disable_netrw = true,
hijack_netrw = true,
open_on_setup = false,
ignore_ft_on_setup = {},
auto_close = false,
open_on_tab = false,
hijack_cursor = true,
update_cwd = false,
update_to_buf_dir = {
enable = true,
auto_open = false,
},
diagnostics = {
enable = false,
icons = {
hint = "",
info = "",
warning = "",
error = "",
}
},
update_focused_file = {
enable = false,
update_cwd = false,
ignore_list = {}
},
system_open = {
cmd = nil,
args = {}
},
filters = {
dotfiles = false,
custom = {}
},
view = {
width = 30,
height = 30,
hide_root_folder = false,
side = 'left',
auto_resize = true,
number = true,
relativenumber = true,
mappings = {
custom_only = false,
list = {}
}
}
}
EOF
" Open and close NvimTree
nnoremap <C-n> :keepjumps NvimTreeToggle<CR>
" Telescope
lua << EOF
require('telescope').setup{
defaults = { file_ignore_patterns = {"node_modules","temp"} }
}
EOF
" Lualine
lua << EOF
-- Eviline config for lualine
-- Author: shadmansaleh
-- Credit: glepnir
local lualine = require('lualine')
-- Color table for highlights
-- stylua: ignore
local colors = {
bg = '#262f39',
fg = '#bbc2cf',
yellow = '#ECBE7B',
cyan = '#008080',
darkblue = '#081633',
green = '#98be65',
orange = '#FF8800',
violet = '#a9a1e1',
magenta = '#c678dd',
blue = '#51afef',
red = '#ec5f67',
}
local conditions = {
buffer_not_empty = function()
return vim.fn.empty(vim.fn.expand('%:t')) ~= 1
end,
hide_in_width = function()
return vim.fn.winwidth(0) > 80
end,
check_git_workspace = function()
local filepath = vim.fn.expand('%:p:h')
local gitdir = vim.fn.finddir('.git', filepath .. ';')
return gitdir and #gitdir > 0 and #gitdir < #filepath
end,
}
-- Config
local config = {
options = {
-- Disable sections and component separators
component_separators = '',
section_separators = '',
theme = {
-- We are going to use lualine_c an lualine_x as left and
-- right section. Both are highlighted by c theme . So we
-- are just setting default looks o statusline
normal = { c = { fg = colors.fg, bg = colors.bg } },
inactive = { c = { fg = colors.fg, bg = colors.bg } },
},
},
sections = {
-- these are to remove the defaults
lualine_a = {},
lualine_b = {},
lualine_y = {},
lualine_z = {},
-- These will be filled later
lualine_c = {},
lualine_x = {},
},
inactive_sections = {
-- these are to remove the defaults
lualine_a = {},
lualine_b = {},
lualine_y = {},
lualine_z = {},
lualine_c = { 'filename' },
lualine_x = {},
lualine_z = { 'location', 'progress' },
},
}
-- Inserts a component in lualine_c at left section
local function ins_left(component)
table.insert(config.sections.lualine_c, component)
end
-- Inserts a component in lualine_x ot right section
local function ins_right(component)
table.insert(config.sections.lualine_x, component)
end
ins_left {
function()
return '▊'
end,
color = { fg = colors.bg }, -- Sets highlighting of component
padding = { left = 0, right = 1 }, -- We don't need space before this
}
ins_left {
-- mode component
-- icons from here -> https://www.nerdfonts.com/cheat-sheet
function()
--return ''
--return ''
--return ''
--return ''
--return ''
return ''
--return ''
--return ''
--return ''
end,
color = function()
-- auto change color according to neovims mode
local mode_color = {
n = colors.red,
i = colors.green,
v = colors.blue,
[''] = colors.blue,
V = colors.blue,
c = colors.magenta,
no = colors.red,
s = colors.orange,
S = colors.orange,
[''] = colors.orange,
ic = colors.yellow,
R = colors.violet,
Rv = colors.violet,
cv = colors.red,
ce = colors.red,
r = colors.cyan,
rm = colors.cyan,
['r?'] = colors.cyan,
['!'] = colors.red,
t = colors.red,
}
return { fg = mode_color[vim.fn.mode()] }
end,
padding = { right = 1 },
}
ins_left {
'filename',
cond = conditions.buffer_not_empty,
color = { fg = colors.fg, gui = 'bold' },
}
ins_right { 'location' }
ins_right { 'progress', color = { fg = colors.fg, gui = 'bold' } }
ins_right {
function()
return '▊'
end,
color = { fg = colors.bg },
padding = { left = 1 },
}
-- Now don't forget to initialize lualine
lualine.setup(config)
EOF
lua << EOF
require("registers").setup({})
EOF
" Neovim newer than 0.7 with tree sitter and navarasu/onedark takes differently
" configured overrides, replacing TS with @. But it doesn't work like it should?
" i think the issue is with the tree sitter highlight enable = true...
" it adds extra highlighting that i dont necissarily need
" ** Treesitter
lua << EOF
require'nvim-treesitter.configs'.setup {
-- A list of parser names, or "all"
ensure_installed = { "clojure", "css", "elixir", "eex", "heex", "html", "json", "javascript", "typescript", "scss", "regex", "vim", "vue" },
-- Install parsers synchronously (only applied to `ensure_installed`)
sync_install = false,
-- List of parsers to ignore installing (for "all")
ignore_install = {},
highlight = {
-- `false` will disable the whole extension, i.e. extra highlighting from treesitter
enable = true,
-- NOTE: these are the names of the parsers and not the filetype. (for example if you want to
-- disable highlighting for the `tex` filetype, you need to include `latex` in this list as this is
-- the name of the parser)
-- list of language that will be disabled
-- MY NOTE: extra tree-sitter highlighting is looking bad in JS code for both josh dick and navarasu one dark themes
-- But, extra tree-sitter highlighting looks good in this .vimrc
-- Lets see how it goes on a language by language basis
-- Navarasu one dark with JS disabled still looks fucky lately so switching back to josh dick for now
-- MY OTHER NOTE: heex formatting isn't great in joshdick. it needs a treesitter enabled colortheme to work.
-- yet, navarasu still looks fucky, as stated above. grr
disable = { "javascript" },
-- Setting this to true will run `:h syntax` and tree-sitter at the same time.
-- Set this to `true` if you depend on 'syntax' being enabled (like for indentation).
-- Using this option may slow down your editor, and you may see some duplicate highlights.
-- Instead of true it can also be a list of languages
additional_vim_regex_highlighting = false,
},
playground = {
enable = true,
disable = {},
updatetime = 25, -- Debounced time for highlighting nodes in the playground from source code
persist_queries = false, -- Whether the query persists across vim sessions
keybindings = {
toggle_query_editor = 'o',
toggle_hl_groups = 'i',
toggle_injected_languages = 't',
toggle_anonymous_nodes = 'a',
toggle_language_display = 'I',
focus_language = 'f',
unfocus_language = 'F',
update = 'R',
goto_node = '<cr>',
show_help = '?',
},
},
}
EOF
" Setting up LSP
" Add a setting for each language you want, remind me how to see installed
" servers and install new ones
" Servers installed: svelte, vue, typescript (it covers javascript too)
lua << EOF
require('lspconfig').svelte.setup{
on_attach = function() -- this function runs inside every buffer when it attaches to lsp
--print("hello, this prints to vim below the status line!")
-- mode, key u press, function you want executed, in the current buffer
-- could pass more than 1 mode here, if so, pass as a lua table
vim.keymap.set("n", "K", vim.lsp.buf.hover, {buffer=0})
vim.keymap.set("n", "gd", vim.lsp.buf.definition, {buffer=0})
vim.keymap.set("n", "gt", vim.lsp.buf.type_definition, {buffer=0})
vim.keymap.set("n", "gi", vim.lsp.buf.implementation, {buffer=0})
vim.keymap.set("n", "<leader>d", vim.diagnostic.goto_next, {buffer=0})
vim.keymap.set("n", "<leader>D", vim.diagnostic.goto_prev, {buffer=0})
vim.keymap.set("n", "<leader>r", vim.lsp.buf.rename, {buffer=0}) -- need to :wa after, to write changes to all files
vim.keymap.set("n", "ca", vim.lsp.buf.code_action, {buffer=0})
-- without this, the lsp stuff jumps on/off everytime you go in and out of insert mode
vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(
vim.lsp.diagnostic.on_publish_diagnostics, {
update_in_insert = true,
}
)
end,
}
require('lspconfig').tsserver.setup{
on_attach = function() -- this function runs inside every buffer when it attaches to lsp
-- mode, key u press, function you want executed, in the current buffer
vim.keymap.set("n", "K", vim.lsp.buf.hover, {buffer=0})
vim.keymap.set("n", "gd", vim.lsp.buf.definition, {buffer=0}) -- C-t takes you back before you jumped
vim.keymap.set("n", "gt", vim.lsp.buf.type_definition, {buffer=0})
vim.keymap.set("n", "gi", vim.lsp.buf.implementation, {buffer=0})
vim.keymap.set("n", "<leader>d", vim.diagnostic.goto_next, {buffer=0})
vim.keymap.set("n", "<leader>D", vim.diagnostic.goto_prev, {buffer=0})
vim.keymap.set("n", "<leader>r", vim.lsp.buf.rename, {buffer=0}) -- need to :wa after, to write changes to all files
vim.keymap.set("n", "ca", vim.lsp.buf.code_action, {buffer=0})
-- without this, the lsp stuff jumps on/off everytime you go in and out of insert mode
vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(
vim.lsp.diagnostic.on_publish_diagnostics, {
update_in_insert = true,
}
)
end,
}
require('lspconfig').elixirls.setup{
cmd = { "/Users/daniel/.elixir-ls/language_server.sh" };
on_attach = function() -- this function runs inside every buffer when it attaches to lsp
-- mode, key u press, function you want executed, in the current buffer
vim.keymap.set("n", "K", vim.lsp.buf.hover, {buffer=0})
vim.keymap.set("n", "gd", vim.lsp.buf.definition, {buffer=0}) -- C-t takes you back before you jumped
vim.keymap.set("n", "gt", vim.lsp.buf.type_definition, {buffer=0})
vim.keymap.set("n", "gi", vim.lsp.buf.implementation, {buffer=0})
vim.keymap.set("n", "<leader>d", vim.diagnostic.goto_next, {buffer=0})
vim.keymap.set("n", "<leader>D", vim.diagnostic.goto_prev, {buffer=0})
vim.keymap.set("n", "<leader>r", vim.lsp.buf.rename, {buffer=0}) -- need to :wa after, to write changes to all files
vim.keymap.set("n", "ca", vim.lsp.buf.code_action, {buffer=0})
-- without this, the lsp stuff jumps on/off everytime you go in and out of insert mode
vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(
vim.lsp.diagnostic.on_publish_diagnostics, {
update_in_insert = true,
}
)
end,
}
-- got it set up, but its not doing much, it doesn't find missing parens, for example.
-- TODO: look more into what vim iced can do, and ask Sudsy
require'lspconfig'.clojure_lsp.setup{
on_attach = function() -- this function runs inside every buffer when it attaches to lsp
-- mode, key u press, function you want executed, in the current buffer
vim.keymap.set("n", "K", vim.lsp.buf.hover, {buffer=0})
vim.keymap.set("n", "gd", vim.lsp.buf.definition, {buffer=0}) -- C-t takes you back before you jumped
vim.keymap.set("n", "gt", vim.lsp.buf.type_definition, {buffer=0})
vim.keymap.set("n", "gi", vim.lsp.buf.implementation, {buffer=0})
vim.keymap.set("n", "<leader>d", vim.diagnostic.goto_next, {buffer=0})
vim.keymap.set("n", "<leader>D", vim.diagnostic.goto_prev, {buffer=0})
vim.keymap.set("n", "<leader>r", vim.lsp.buf.rename, {buffer=0}) -- need to :wa after, to write changes to all files
vim.keymap.set("n", "ca", vim.lsp.buf.code_action, {buffer=0})
-- without this, the lsp stuff jumps on/off everytime you go in and out of insert mode
vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(
vim.lsp.diagnostic.on_publish_diagnostics, {
update_in_insert = true,
}
)
end,
}
-- null-ls is what lets eslint, etc hook into the lsp
require("null-ls").setup{
on_attach = function() -- this function runs inside every buffer when it attaches to lsp
--print("hello, this prints to vim below the status line!")
-- mode, key u press, function you want executed, in the current buffer
-- could pass more than 1 mode here, if so, pass as a lua table
vim.keymap.set("n", "K", vim.lsp.buf.hover, {buffer=0})
vim.keymap.set("n", "gd", vim.lsp.buf.definition, {buffer=0})
vim.keymap.set("n", "gt", vim.lsp.buf.type_definition, {buffer=0})
vim.keymap.set("n", "gi", vim.lsp.buf.implementation, {buffer=0})
vim.keymap.set("n", "<leader>d", vim.diagnostic.goto_next, {buffer=0})
vim.keymap.set("n", "<leader>D", vim.diagnostic.goto_prev, {buffer=0})
vim.keymap.set("n", "<leader>r", vim.lsp.buf.rename, {buffer=0}) -- need to :wa after, to write changes to all files
vim.keymap.set("n", "ca", vim.lsp.buf.code_action, {buffer=0})
-- without this, the lsp stuff jumps on/off everytime you go in and out of insert mode
vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(
vim.lsp.diagnostic.on_publish_diagnostics, {
update_in_insert = true,
}
)
end,
sources = {
require("null-ls").builtins.code_actions.eslint,
require("null-ls").builtins.diagnostics.eslint,
require("null-ls").builtins.formatting.eslint,
require("null-ls").builtins.completion.spell,
require("null-ls").builtins.diagnostics.clj_kondo.with({
extra_args = { "--lint" }
})
-- require("null-ls").builtins.formatting.cljstyle, -- not seeing this working, going to format with vim-iced
},
}
EOF
lua << EOF
require('lspconfig').html.setup{}
EOF
lua << EOF
require('lspconfig').cssls.setup{
cmd = { "vscode-css-language-server", "--stdio" }
}
EOF
" Fix eslint stuff
nnoremap <leader>ef :!node_modules/eslint/bin/eslint.js --fix %<CR>
" Shift L and Shift H to move large sections to the right and left
nnoremap <S-l> zL
nnoremap <S-h> zH
" when :set wrap is on, lets you move across wrapped lines
" toggle :set wrap when writing long form text
nnoremap <C-h> gh
nnoremap <C-j> gj
nnoremap <C-k> gk
nnoremap <C-l> gl
" Toggle between nvim tabs
nnoremap <S-Tab> gt
" vim iced shortcuts
let g:iced_formatter="cljstyle"
nnoremap <leader>cb :IcedStdoutBufferClear
" matched paren always in blue
hi MatchParen cterm=underline ctermfg=39 ctermbg=6 gui=underline guifg=#61AFEF guibg=none guisp=blue
" harpoon
" delete harpoon marks with dd in the viewer
nnoremap <leader>hm :lua require("harpoon.mark").add_file()<CR>
nnoremap <leader>hs :lua require("harpoon.ui").toggle_quick_menu()<CR>
endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment