Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
0f4cbd5
Add nvim Dockerfile
matt-savvy Aug 28, 2024
3ac648d
Add init.lua
matt-savvy Aug 28, 2024
1f3fe93
Add hidden
matt-savvy Aug 28, 2024
85eb144
Add termguicolors
matt-savvy Aug 28, 2024
2629d54
Add colorscheme
matt-savvy Aug 28, 2024
3f4e6d3
Add UTF-8 encoding
matt-savvy Aug 28, 2024
ac86503
Add incsearch
matt-savvy Aug 28, 2024
1b9433b
Add laststatus
matt-savvy Aug 28, 2024
897e040
Add default comments
matt-savvy Aug 28, 2024
13ef2ad
Add report
matt-savvy Aug 28, 2024
d0b986d
Add scrolloff
matt-savvy Aug 28, 2024
19aa1c2
Add showcmd
matt-savvy Aug 28, 2024
0658298
Add showmatch
matt-savvy Aug 28, 2024
6a08861
Add backspace
matt-savvy Aug 28, 2024
808415c
Add tabstop, etc
matt-savvy Aug 28, 2024
fb9d9d3
Add virtualedit
matt-savvy Aug 28, 2024
c9951ac
Add relativenumber, number, numberwidth
matt-savvy Aug 28, 2024
935aff5
Add sidescrolloff
matt-savvy Aug 28, 2024
b6f891e
Add list
matt-savvy Aug 28, 2024
6b5a354
Add listchars
matt-savvy Aug 28, 2024
8741362
Add clipboard
matt-savvy Aug 28, 2024
9a6540b
Add mouse
matt-savvy Aug 28, 2024
4e097ea
Add autoread
matt-savvy Aug 28, 2024
eecfe79
Add TextEdit comment
matt-savvy Aug 28, 2024
b662eed
Add backup, writebackup
matt-savvy Aug 28, 2024
ceb1b5d
Add cmdheight
matt-savvy Aug 28, 2024
fc97d9c
Add updatetime
matt-savvy Aug 28, 2024
46d89ab
Add shortmess
matt-savvy Aug 28, 2024
3dfc5af
Update backspace, prefer table
matt-savvy Aug 28, 2024
45e46f0
Update listchars, prefer table
matt-savvy Aug 28, 2024
590e900
Add signcolumn
matt-savvy Aug 28, 2024
b56f7c8
Add stty -ixon
matt-savvy Aug 29, 2024
1ad22f6
Add VimLeave ssty autocmd
matt-savvy Aug 29, 2024
bb8985a
Add save keymaps
matt-savvy Aug 29, 2024
08fd979
Refactor save keymaps, use save function
matt-savvy Aug 29, 2024
db9704a
Add javascript keymap autocmd
matt-savvy Aug 29, 2024
6276e48
Add javascript/typescript autocommands
matt-savvy Aug 29, 2024
0d6e794
Add buffer mappings
matt-savvy Aug 29, 2024
0acf2eb
Add window navigation
matt-savvy Aug 29, 2024
3a53761
Extract plugs.vim
matt-savvy Aug 29, 2024
5e7cc80
Add themes
matt-savvy Aug 29, 2024
f65f692
Add coc
matt-savvy Aug 29, 2024
29420b1
Add editor plugs
matt-savvy Aug 29, 2024
670c2a2
Add Elixir & Erlang
matt-savvy Aug 29, 2024
f860572
Add Elm
matt-savvy Aug 29, 2024
408edb0
Add Ruby
matt-savvy Aug 29, 2024
06f2d24
Add Go
matt-savvy Aug 29, 2024
018e79d
Add Docker
matt-savvy Aug 29, 2024
40928b5
Add CSS
matt-savvy Aug 29, 2024
ac2f142
Add Javascript
matt-savvy Aug 29, 2024
c5daea5
Add json/graphQL
matt-savvy Aug 29, 2024
9b2af1e
Add Brackets & Parentheses highlighting
matt-savvy Aug 29, 2024
d6a2b3e
Add emmet opts
matt-savvy Aug 29, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM ubuntu:latest

USER root

RUN apt-get update
RUN apt-get install neovim curl git nodejs -y

RUN useradd -ms /bin/bash myuser

USER myuser

RUN sh -c 'curl -fLo "${XDG_DATA_HOME:-$HOME/.local/share}"/nvim/site/autoload/plug.vim --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'

WORKDIR /home/myuser
233 changes: 233 additions & 0 deletions init.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,233 @@
local plug = vim.fn["plug#"]

vim.call("plug#begin", "~/.vim/plugged")

vim.cmd.source("~/dotfiles/plugs.vim")

-- Coc-nvim
plug("neoclide/coc.nvim", {branch = "release"})

-- Editor plugs
plug("nvim-treesitter/nvim-treesitter", {["do"] = ":TSUpdate"})
plug("scrooloose/nerdtree", { on = "NERDTreeToggle" })
plug("itchyny/lightline.vim")
plug("jreybert/vimagit")
plug("Lokaltog/vim-easymotion")
plug("tpope/vim-surround")
plug("junegunn/fzf", { dir = "~/.fzf", ["do"] = "./install --all --no-update-rc" })
plug("junegunn/fzf.vim")
plug("tpope/vim-repeat")
plug("jiangmiao/auto-pairs")
plug("vim-test/vim-test")

-- Elixir & Erlang
plug("elixir-editors/vim-elixir")
plug("mhinz/vim-mix-format")
vim.g.mix_format_on_save = 1
plug("fishcakez/vim-erlang")

-- Elm
plug("ElmCast/elm-vim")
vim.g.elm_format_autosave = 1

-- Ruby
plug("thoughtbot/vim-rspec")
plug("aklt/plantuml-syntax")

-- Go
plug("fatih/vim-go")
vim.g.go_fmt_autosave = 1
vim.g.go_metalinter_autosave = 0

-- Docker
plug("ekalinin/Dockerfile.vim")

-- CSS syntax highlight
plug("othree/csscomplete.vim")
-- Add Support css3 properties
plug("hail2u/vim-css3-syntax")
plug("cakebaker/scss-syntax.vim")
-- highlight hex colors in color
vim.api.nvim_create_autocmd({"BufRead", "BufNewFile"}, {
pattern = "*.scss",
callback = function(_)
vim.opt.filetype = "scss.css"
end
})
vim.api.nvim_create_autocmd({"BufRead", "BufNewFile"}, {
pattern = "*.sass",
callback = function(_)
vim.opt.filetype = "sass.css"
end
})
-- scss lint
plug("gcorne/vim-sass-lint")

------- Javascript
-- Syntax highlighting for .jsx (typescript)
plug("peitalin/vim-jsx-typescript")
-- Typescript -
plug("leafgarland/typescript-vim")
plug("Shougo/vimproc.vim", {
build = {
windows = "tools\\update-dll-mingw",
cygwin = "make -f make_cygwin.mak",
mac = "make -f make_mac.mak",
linux = "make",
unix = "gmake",
},
})

plug("elzr/vim-json")
vim.g.vim_json_syntax_conceal = 0
-- GraphQL syntax highlighting
-- plug("jparise/vim-graphql")
-- plug("posva/vim-vue")


------- Brackets & Parentheses highlighting
-- Valloric/MatchTagAlways --
vim.keymap.set("n", "<Leader>%", ":MtaJumpToOtherTag<CR>", { remap = false })
vim.g.mta_filetypes = {
html= 1,
xhtml = 1,
xml = 1,
javascript = 1,
[ "javascript.jsx" ] = 1,
[ "javascript.tsx" ] = 1,
[ "typescript.tsx" ] = 1,
typescript = 1
}

-- C-m is synonymous with "enter", so will cause enter key to lag
vim.g.user_emmet_leader_key = "<C-k>"
vim.g.user_emmet_settings = { javascript = { extends = "jsx" }}

-- Color themes
plug("morhetz/gruvbox")
plug("jnurmine/Zenburn")
plug("petobens/colorish")
plug("dracula/vim", { as = "dracula" })
plug("NLKNguyen/papercolor-theme")

vim.call("plug#end")

vim.cmd.source("~/dotfiles/vimrc")

vim.opt.hidden = true -- Allow buffers to become hidden (default)
vim.opt.encoding = "utf-8" -- Use UTF-8 encoding (default)
vim.opt.incsearch = true -- Move while searching (default)
vim.opt.laststatus = 2 -- Always show the status line (default)
vim.opt.report = 2 -- Tell us when anything is changed via :...
vim.opt.scrolloff = 10 -- Keep 10 lines (top/bottom) for scope
vim.opt.showcmd = true -- Show the command being typed (default)
vim.opt.showmatch = true -- Show matching brackets
vim.opt.backspace = { "indent", "eol" , "start" } -- (default)
vim.opt.tabstop = 2
vim.opt.softtabstop = 2
vim.opt.shiftwidth = 2
vim.opt.expandtab = true
vim.opt.virtualedit = "block" -- Allow the cursor to go anywhere in visual block mode
vim.opt.relativenumber = true -- Relative line numbers
vim.opt.number = true -- Line numbers [:set number!] to turn off
vim.opt.numberwidth = 5 -- We are good up to 99999 lines
vim.opt.sidescrolloff = 10 -- Keep 5 lines at the size
vim.opt.list = true -- Show whitespace and tabs
vim.opt.listchars = { tab = "¦·", trail = "·" } -- Show tabs and trailing whitespace
vim.opt.clipboard = "unnamed" -- Copy and paste with *
vim.opt.mouse = "a" -- Scrollable term-vim
vim.opt.autoread = true -- (default)
-- TextEdit might fail if hidden is not set.

-- Some servers have issues with backup files, see #649.
vim.opt.backup = false -- (default)
vim.opt.writebackup = false

-- Give more space for displaying messages.
vim.opt.cmdheight = 2

-- Having longer updatetime (default is 4000 ms = 4 s) leads to noticeable
-- delays and poor user experience.
vim.opt.updatetime = 300

-- Don't pass messages to |ins-completion-menu|.
vim.opt.shortmess:append({ c = true })

-- Always show the signcolumn, otherwise it would shift the text each time
-- diagnostics appear/become resolved.
vim.opt.signcolumn = "yes"

-- Allow us to use Ctrl-s and Ctrl-q as keybinds
vim.cmd("silent !stty -ixon")

-- Restore default behaviour when leaving Vim.
vim.api.nvim_create_autocmd("VimLeave", {
pattern = "*", -- default pattern
command = "silent !stty ixon",
})

local function save()
vim.cmd.write()
vim.print("Saved")
end
vim.keymap.set({"n", "v", "o", "i"}, "<C-s>", save)

vim.api.nvim_create_autocmd({"BufNewFile", "BufRead"}, {
pattern = {"*.ts", "*.js"},
callback = function(_)
vim.print("set filetype to typescript")
vim.opt.filetype = "typescript.tsx"
end
})
vim.api.nvim_create_autocmd({"BufNewFile", "BufRead"}, {
pattern = "*.vue",
callback = function(_)
vim.opt.filetype = "vue.typescript"
end
})

-- replace tabs with 4 whitespace
-- nmap <F4> :%s/\t/ /g<CR>

vim.api.nvim_create_autocmd("FileType", {
pattern = {"typescript.tsx", "javascript.tsx", "javascript", "typescript"},
callback = function(_)
vim.keymap.set("n", "<Leader>s", function()
vim.cmd("%s/\t/ /g")
end)
end
})

vim.api.nvim_create_autocmd("FileType", {
pattern = {
"vue.typescript",
"typescript",
-- "*.jsx",
-- "*.tsx",
"json"},
callback = function(_)
vim.opt_local.commentstring = "// %s"
end
})

-- buffers
vim.keymap.set("", "gn", vim.cmd.bnext)
vim.keymap.set("", "gp", vim.cmd.bprev)
vim.keymap.set("n", "<Leader>b", vim.cmd.buffers)
vim.keymap.set("n", "<Leader>bd", ":bp<bar>sp<bar>bn<bar>bd<CR>")

----------- window navigation
function wincmd(direction)
return function()
vim.cmd.wincmd(direction)
end
end
vim.keymap.set("n", "<C-k>", wincmd("k"), { silent = true })
vim.keymap.set("n", "<C-j>", wincmd("j"), { silent = true })
vim.keymap.set("n", "<C-h>", wincmd("h"), { silent = true })
vim.keymap.set("n", "<C-l>", wincmd("l"), { silent = true })

------------- Color Schemes ----------------
vim.opt.termguicolors = true
vim.cmd.colorscheme("heraldish")

Loading