Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
28 changes: 28 additions & 0 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Lint

on:
push:
branches: [ '*' ]
pull_request:
branches: [ main, master ]

jobs:
lua-lint:
name: Lua Linting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Setup Lua
uses: leafo/gh-actions-lua@v10
with:
luaVersion: "5.1"

- name: Install luacheck
run: |
sudo apt-get update
sudo apt-get install -y luarocks
sudo luarocks install luacheck

- name: Run luacheck
run: luacheck lua/
17 changes: 0 additions & 17 deletions .github/workflows/vint.yml

This file was deleted.

10 changes: 10 additions & 0 deletions .luacheckrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
-- Ignore warning about unused self
ignore = {"212/self"}

-- Globals available in nvim Lua
globals = {
"vim",
}

-- Settings
max_line_length = 120
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2020 Chris Cuming
Copyright (c) 2025 Chris Watkins

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
27 changes: 27 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Makefile for syfe Neovim plugin

.PHONY: lint lint.lua help

# Lint Lua code
lint.lua:
@echo "Linting Lua code..."
@if command -v luacheck >/dev/null 2>&1; then \
luacheck lua/; \
else \
echo "luacheck not found. Please install luacheck: 'luarocks install luacheck'"; \
exit 1; \
fi
@echo "Lua linting complete"

# Lint all code
lint: lint.lua
@echo "All linting complete"

# Help target
help:
@echo "Syfe Makefile"
@echo ""
@echo "Available commands:"
@echo " make lint Run all linters"
@echo " make lint.lua Run Lua linter (luacheck)"
@echo " make help Show this help message"
61 changes: 48 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,29 @@ syfe

use git or your plugin manager of choice to install syfe.

## syntax, indentation, and folding
## features

### terminal

* disables whitespace highlighting in terminals

### languages

* go
* autoindentation; 8 spaces per tab.
* hcl
* syntax highlighting and folding for HashiCorp Configuration Language (HCL).
* supports terraform/opentofu (.tf, .tfvars) and nomad (.nomad) files.
* indentation; 2 spaces per tab.
* makefile
* autoindentation; 8 spaces per tab.
* markdown
* syntax highlighting, including fenced code blocks.
* basic syntax highlighting, fenced code blocks.
* python
* indentation-based folding.
* vimscript
* folding via [explicit comment markers](https://learnvimscriptthehardway.stevelosh.com/chapters/18.html#grouping): `" {{` and `" }}` start and stop a fold, respectively.
* yaml
* autoindention on -, =, 0, or # characters.
* autoindention on -, =, and other key characters.
* no autoindent on # to make block commenting easier.

## whitespace management

Expand All @@ -30,18 +39,44 @@ syfe will highlight trailing whitespace when entering a **modifiable** buffer.

### commands

* `SyfeWhitespaceClear`: call to remove any trailing whitespace in a **modifiable** buffer.
* `SyfeWipe`: call to remove any trailing whitespace and CRLF line endings in a **modifiable** buffer.

#### mapping example

add the following to your vim configuration to remove trailing whitespace by pressing Leader-w:
add the following to your vim configuration to clean up a file by pressing Leader-w:

```lua
-- syfe:
vim.keymap.set("n", "<Leader>w", "<cmd>SyfeWipe<CR>", { silent = true })
```

## development

```vimscript
" syfe:
nnoremap <silent><Leader>w :execute 'SyfeWhitespaceClear'<CR>
this project uses a Makefile to automate common development tasks.

to see all available tasks:

```bash
make help
```

## acknowledgements
### makefile tab completion (optional)

add the following function to your bash config:

```bash
_make_completion() {
local cur prev targets

COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"

# Parse Makefile targets
targets=$(make -qp | awk -F':' '/^[a-zA-Z0-9][^$#\/\t=]*:([^=]|$)/ {split($1,A,/ /);print A[1]}' | sort -u)

* [ben williams'](https://plasticboy.com/), [vim-markdown](https://github.com/plasticboy/vim-markdown), as the starting point for markdown support.
* [steve losh's](https://stevelosh.com/) book, [learn vimscript the hard way](https://learnvimscriptthehardway.stevelosh.com/), was a great and useful read.
COMPREPLY=( $(compgen -W "${targets}" -- ${cur}) )
return 0
}
complete -F _make_completion make
```
26 changes: 0 additions & 26 deletions autoload/syfe/crlf.vim

This file was deleted.

4 changes: 0 additions & 4 deletions autoload/syfe/init.vim

This file was deleted.

37 changes: 0 additions & 37 deletions autoload/syfe/whitespace.vim

This file was deleted.

118 changes: 118 additions & 0 deletions fixtures/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
# Example Makefile to demonstrate folding and syntax highlighting

# Variables
CC := gcc
CXX := g++
CFLAGS := -Wall -Wextra -pedantic -O2
CXXFLAGS := $(CFLAGS) -std=c++17
LDFLAGS := -L/usr/local/lib
INCLUDES := -I./include -I/usr/local/include
TARGET := example
BUILD_DIR := build
SRC_DIR := src
TEST_DIR := tests

# Source files
C_SOURCES := $(wildcard $(SRC_DIR)/*.c)
CXX_SOURCES := $(wildcard $(SRC_DIR)/*.cpp)
OBJECTS := $(patsubst $(SRC_DIR)/%.c,$(BUILD_DIR)/%.o,$(C_SOURCES))
OBJECTS += $(patsubst $(SRC_DIR)/%.cpp,$(BUILD_DIR)/%.o,$(CXX_SOURCES))

# Phony targets
.PHONY: all clean test debug release install uninstall format check

# Default target
all: $(BUILD_DIR) $(TARGET)

# Create build directory
$(BUILD_DIR):
mkdir -p $(BUILD_DIR)

# Linking the final target
$(TARGET): $(OBJECTS)
$(CXX) $(CXXFLAGS) -o $@ $^ $(LDFLAGS)
@echo "Build complete: $(TARGET)"

# Compile C source files
$(BUILD_DIR)/%.o: $(SRC_DIR)/%.c
$(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $<

# Compile C++ source files
$(BUILD_DIR)/%.o: $(SRC_DIR)/%.cpp
$(CXX) $(CXXFLAGS) $(INCLUDES) -c -o $@ $<

# Clean build artifacts
clean:
rm -rf $(BUILD_DIR) $(TARGET)
@echo "Cleaned build artifacts"

# Run tests
test: all
@echo "Running tests..."
$(TEST_DIR)/run_tests.sh

# Debug build
debug: CFLAGS += -g -DDEBUG
debug: CXXFLAGS += -g -DDEBUG
debug: all

# Release build
release: CFLAGS += -O3 -DNDEBUG
release: CXXFLAGS += -O3 -DNDEBUG
release: all

# Install the application
install: all
@echo "Installing $(TARGET) to /usr/local/bin"
cp $(TARGET) /usr/local/bin/
@echo "Installation complete"

# Uninstall the application
uninstall:
@echo "Removing $(TARGET) from /usr/local/bin"
rm -f /usr/local/bin/$(TARGET)
@echo "Uninstallation complete"

# Format the source code
format:
@echo "Formatting source code..."
find $(SRC_DIR) $(TEST_DIR) -name "*.c" -o -name "*.h" -o -name "*.cpp" -o -name "*.hpp" | xargs clang-format -i
@echo "Formatting complete"

# Static code analysis
check:
@echo "Running static analysis..."
cppcheck --enable=all $(SRC_DIR)
@echo "Static analysis complete"

# Generate documentation
docs:
@echo "Generating documentation..."
doxygen Doxyfile
@echo "Documentation complete"

# Dependency generation
deps:
@echo "Generating dependencies..."
$(CC) -MM $(CFLAGS) $(INCLUDES) $(C_SOURCES) > deps.mk
$(CXX) -MM $(CXXFLAGS) $(INCLUDES) $(CXX_SOURCES) >> deps.mk
@echo "Dependencies generated"

# Include generated dependencies if they exist
-include deps.mk

# Help target
help:
@echo "Available targets:"
@echo " all - Build the project (default)"
@echo " clean - Remove build artifacts"
@echo " test - Run tests"
@echo " debug - Build with debug symbols"
@echo " release - Build optimized release version"
@echo " install - Install to /usr/local/bin"
@echo " uninstall - Remove from /usr/local/bin"
@echo " format - Format source code"
@echo " check - Run static analysis"
@echo " docs - Generate documentation"
@echo " deps - Generate dependencies"
@echo " help - Show this help message"
Loading
Loading